Commit 458e9dcd 张东亮

confighelper更新最新、料串到位滚筒减少2秒转、库位状态加载失败不重新加载

1 个父辈 e33d2e64
此文件类型无法预览
......@@ -322,6 +322,11 @@
</summary>
<param name="action"></param>
</member>
<member name="M:CommonLib.DeleteWithRemainingCapacity">
<summary>
空间不足5G时自动删除文件
</summary>
</member>
<member name="M:CommonLib.DeleteOverDayFile(System.String,System.String,System.Int32)">
<summary>
删除超过指定天数的文件
......
此文件类型无法预览
此文件的差异太大,无法显示。
......@@ -161,8 +161,8 @@ namespace DeviceLibrary
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_02);
if (IOValue(IO_Type.StringBack_Check).Equals(IO_VALUE.HIGH))
{
Line.LineRun("n", false, 2);
StringMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
// Line.LineRun("n", false, 2);
StringMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
break;
case MoveStep.StringLoad_02:
......
......@@ -35,11 +35,12 @@ namespace TheMachine
Init();
}
}
Dictionary<string,PosState> posState = new Dictionary<string, PosState>();
Dictionary<string, PosState> posState = new Dictionary<string, PosState>();
//如果总配置文件存在,保存到总的配置文件
static string appPath = Application.StartupPath;
static string positionConfigFile = Path.Combine(appPath, "StoreConfig\\linePositions.csv");
class PosState {
class PosState
{
public int InStoreCheck = 0;
public int OutStoreCheck = 0;
......@@ -79,7 +80,8 @@ namespace TheMachine
}
checkVerify();
}
DataGridViewCellStyle GetStyle(string posid) {
DataGridViewCellStyle GetStyle(string posid)
{
if (htpp.ContainsKey(posid) && posState.ContainsKey(posid))
{
var pp = (PosPos)htpp[posid];
......@@ -114,18 +116,20 @@ namespace TheMachine
label_verify.Text = s.ToString("0.0") + "%";
}
Hashtable htpp = new Hashtable();
class PosPos {
class PosPos
{
public string Posid;
public int index;
public int row;
public int col;
}
int PosCompare(string a, string b) {
int PosCompare(string a, string b)
{
if (a.StartsWith("fix"))
return -1;
if (b.StartsWith("fix"))
return 1;
string[] pa = a.Split('_');
string[] pb = b.Split('_');
......@@ -174,7 +178,8 @@ namespace TheMachine
else
return -1;
}
void LoadPosCheck() {
void LoadPosCheck()
{
var poscheckfile = positionConfigFile + ".check";
if (File.Exists(poscheckfile))
{
......@@ -183,12 +188,12 @@ namespace TheMachine
posState = JsonHelper.DeserializeJsonToObject<Dictionary<string, PosState>>(File.ReadAllText(poscheckfile));
File.Copy(poscheckfile, poscheckfile + ".backup", true);
}
catch {
catch
{
if (File.Exists(poscheckfile + ".backup"))
{
File.Copy(poscheckfile + ".backup", poscheckfile, true);
File.Delete(poscheckfile + ".backup");
LoadPosCheck();
}
}
}
......@@ -197,11 +202,12 @@ namespace TheMachine
File.WriteAllText(poscheckfile, JsonHelper.SerializeObject(posState));
}
}
PosState SavePosCheck(string posid,int inStoreCheck,int outStoreCheck) {
PosState SavePosCheck(string posid, int inStoreCheck, int outStoreCheck)
{
if (!posState.ContainsKey(posid))
posState.Add(posid, new PosState());
if (inStoreCheck>0)
if (inStoreCheck > 0)
posState[posid].InStoreCheck = inStoreCheck;
if (outStoreCheck > 0)
posState[posid].OutStoreCheck = outStoreCheck;
......@@ -209,12 +215,13 @@ namespace TheMachine
File.WriteAllText(poscheckfile, JsonHelper.SerializeObject(posState));
return posState[posid];
}
static Font font = new Font("宋体",10);
static Font font = new Font("宋体", 10);
DataGridViewCellStyle dgv_ok = new DataGridViewCellStyle() { BackColor = Color.LightGreen, Font = font };
DataGridViewCellStyle dgv_oin = new DataGridViewCellStyle() { BackColor = Color.LightGray, Font = font };
DataGridViewCellStyle dgv_oout = new DataGridViewCellStyle() { BackColor = Color.LightSeaGreen, Font = font };
DataGridViewCellStyle dgv_none = new DataGridViewCellStyle() { BackColor = Color.White,Font= font };
void FillBoxPos() {
DataGridViewCellStyle dgv_none = new DataGridViewCellStyle() { BackColor = Color.White, Font = font };
void FillBoxPos()
{
if (RobotManage.PositionNumList.Count == 0)
return;
htpp.Clear();
......@@ -223,9 +230,9 @@ namespace TheMachine
LoadPosCheck();
Comparison<string> comparison = new Comparison<string>(PosCompare);
RobotManage.PositionNumList.Sort(comparison);
string[] posstr = RobotManage.PositionNumList[RobotManage.PositionNumList.Count-1].Split('_');
string[] posstr = RobotManage.PositionNumList[RobotManage.PositionNumList.Count - 1].Split('_');
int colcount = 0;
if (!int.TryParse(posstr[1], out colcount))
colcount = int.Parse(posstr[1][0].ToString());
......@@ -234,7 +241,7 @@ namespace TheMachine
{
dataGridView1.Columns.Add("Col" + i + "_A", "Col" + i + "_A");
dataGridView1.Columns.Add("Col" + i + "_B", "Col" + i + "_B");
}
for (int i = 0; i < dataGridView1.Columns.Count; i++)
{
......@@ -249,7 +256,7 @@ namespace TheMachine
for (int i = 0; i < RobotManage.PositionNumList.Count; i++)
{
int ci = RobotManage.PositionNumList.Count-1 - i;
int ci = RobotManage.PositionNumList.Count - 1 - i;
string posname = RobotManage.PositionNumList[ci];
if (posname.StartsWith("fix"))
{
......@@ -277,11 +284,11 @@ namespace TheMachine
lastcol = col;
lastAB = ab;
if (currentRowIndex >= dataGridView1.Rows.Count-1)
if (currentRowIndex >= dataGridView1.Rows.Count - 1)
{
int x = dataGridView1.Rows.Add();
}
var currentRow = dataGridView1.Rows[currentRowIndex];
int currentColIndex = col * 2;
......@@ -291,12 +298,13 @@ namespace TheMachine
currentRow.Cells[currentColIndex].Tag = posname;
htpp.Add(posname, new PosPos() { Posid = posname, index = i, row = currentRowIndex, col = currentColIndex });
currentRow.Cells[currentColIndex].Style = GetStyle(posname);
currentRowIndex++;
}
for (int i = 0; i < dataGridView1.Columns.Count; i++)
{
if (dataGridView1.Rows[0].Cells[i].Value==null) {
if (dataGridView1.Rows[0].Cells[i].Value == null)
{
dataGridView1.Columns[i].Width = 0;
}
}
......@@ -309,14 +317,15 @@ namespace TheMachine
dataGridView1.Rows[0].Cells[dataGridView1.Columns.Count - 2].Selected = true;
}
dataGridView1.Rows.RemoveAt(dataGridView1.Rows.Count - 1);
if (dataGridView1.SelectedCells.Count>0)
if (dataGridView1.SelectedCells.Count > 0)
setData(dataGridView1.SelectedCells[0].Tag.ToString());
else
setData(RobotManage.PositionNumList.Last());
checkVerify();
}
void setData(string posid) {
void setData(string posid)
{
ACStorePosition ktkPosition = CSVPositionReader<ACStorePosition>.GetPositon(posid);
cmbPosition.Text = posid;
label_size.Text = $"[{ktkPosition.BagWidth}x{ktkPosition.BagHigh}]";
......@@ -325,14 +334,15 @@ namespace TheMachine
}
private void btnInStore_Click(object sender, EventArgs e)
{
{
if (RobotManage.mainMachine.runStatus == RunStatus.Running)
{
string selectPositionNum = cmbPosition.Text;
ACStorePosition ktkPosition = CSVPositionReader<ACStorePosition>.GetPositon(selectPositionNum);
JobInfo jobInfo = new JobInfo("IN_TEST", selectPositionNum, ktkPosition.BagWidth, ktkPosition.BagHigh);
if (!RobotManage.mainMachine.StartInStore(jobInfo)) {
if (!RobotManage.mainMachine.StartInStore(jobInfo))
{
MessageBox.Show(crc.GetString(L.reel_not_onposition_cant_manual_in, "料盘没有到位,无法手动入库"));
return;
}
......@@ -340,7 +350,7 @@ namespace TheMachine
}
else
{
MessageBox.Show(crc.GetString(L.start_device_first,"请先启动料仓!"));
MessageBox.Show(crc.GetString(L.start_device_first, "请先启动料仓!"));
}
}
......@@ -350,14 +360,15 @@ namespace TheMachine
{
string selectPositionNum = cmbPosition.Text;
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(selectPositionNum);
if (RobotManage.mainMachine.boxTransportIsFree) {
if (RobotManage.mainMachine.boxTransportIsFree)
{
LogUtil.info($"手动出库:{selectPositionNum}");
RobotManage.mainMachine.AddSingleStoreTask(selectPositionNum, position.BagWidth, position.BagHigh);
}
else
{
MessageBox.Show(crc.GetString(L.store_busy_cant_manual_out, "料仓正在出入库中,无法手动出库"));
}
}
}
else
{
......@@ -401,7 +412,7 @@ namespace TheMachine
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex<0 || dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag == null)
if (e.RowIndex < 0 || dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag == null)
return;
var posid = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag.ToString();
setData(posid);
......@@ -422,9 +433,9 @@ namespace TheMachine
RobotManage.mainMachine.AutoInOutTest = false;
//RobotManage.mainMachine.StopAutoInOut = false;
}
btnInStore.Enabled= cb_inoutdebugmode.Checked;
btnOutStore.Enabled= cb_inoutdebugmode.Checked;
btn_autoinout.Enabled=cb_inoutdebugmode.Checked;
btnInStore.Enabled = cb_inoutdebugmode.Checked;
btnOutStore.Enabled = cb_inoutdebugmode.Checked;
btn_autoinout.Enabled = cb_inoutdebugmode.Checked;
cb_plateheight.Enabled = cb_inoutdebugmode.Checked;
}
......@@ -466,7 +477,7 @@ namespace TheMachine
private void cb_fixpos_SelectedIndexChanged(object sender, EventArgs e)
{
if (cb_fixpos.SelectedItem!=null)
if (cb_fixpos.SelectedItem != null)
setData(cb_fixpos.SelectedItem.ToString());
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!