Commit 860f29f7e45411f4636963638367b968664b5bde

Authored by liufu
1 parent 8227adb6

bug修改、出库拣选循环执行

HHWCS.Dao/Bll.cs
@@ -18,7 +18,7 @@ namespace HHWCS.Bll @@ -18,7 +18,7 @@ namespace HHWCS.Bll
18 //string str = ""; 18 //string str = "";
19 //for (int i = 1; i < 3; i++) 19 //for (int i = 1; i < 3; i++)
20 //{ 20 //{
21 - // for (int j = 1; j < 17; j++) 21 + // for (int j = 1; j < 33; j++)
22 // { 22 // {
23 // for (int k = 1; k < 6; k++) 23 // for (int k = 1; k < 6; k++)
24 // { 24 // {
@@ -61,7 +61,7 @@ namespace HHWCS.Bll @@ -61,7 +61,7 @@ namespace HHWCS.Bll
61 { 61 {
62 try 62 try
63 { 63 {
64 - string sql = $"update task set isBoubleIn = {flag},secondDestinationLocation = '{location}' WHERE id = {taskId}"; 64 + string sql = $"update task set isDoubleIn = {flag},secondDestinationLocation = '{location}' WHERE id = {taskId}";
65 int i = MySqlHelper.ExecuteNonQuery(AppCommon.ConnectionString, sql); 65 int i = MySqlHelper.ExecuteNonQuery(AppCommon.ConnectionString, sql);
66 if (i == 0) 66 if (i == 0)
67 { 67 {
@@ -104,7 +104,7 @@ namespace HHWCS.Bll @@ -104,7 +104,7 @@ namespace HHWCS.Bll
104 { 104 {
105 sql += " and created<='" + endTime.ToString() + "'"; 105 sql += " and created<='" + endTime.ToString() + "'";
106 } 106 }
107 - sql += " ORDER BY lastUpdated desc"; 107 + sql += " ORDER BY lastUpdated ";
108 108
109 DataSet ds = MySqlHelper.ExecuteDataset(AppCommon.ConnectionString, sql); 109 DataSet ds = MySqlHelper.ExecuteDataset(AppCommon.ConnectionString, sql);
110 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) 110 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
@@ -464,7 +464,7 @@ namespace HHWCS.Bll @@ -464,7 +464,7 @@ namespace HHWCS.Bll
464 Bll.SetLocationPallet(location.Code, task.ContainerCode); 464 Bll.SetLocationPallet(location.Code, task.ContainerCode);
465 } 465 }
466 //更新任务状态 466 //更新任务状态
467 - Bll.SetTaskStatus(task.Id, 40); 467 + Bll.SetTaskStatus(task.Id, 10);
468 } 468 }
469 if (task.Type == 300 || task.Type == 600) 469 if (task.Type == 300 || task.Type == 600)
470 { 470 {
@@ -623,7 +623,8 @@ namespace HHWCS.Bll @@ -623,7 +623,8 @@ namespace HHWCS.Bll
623 Enable = Convert.ToBoolean(t["enable"]), 623 Enable = Convert.ToBoolean(t["enable"]),
624 DeviceTypeId = (int)t["deviceTypeId"], 624 DeviceTypeId = (int)t["deviceTypeId"],
625 Roadway = t["roadway"] is DBNull ? -1 : Convert.ToInt32(t["roadway"]), 625 Roadway = t["roadway"] is DBNull ? -1 : Convert.ToInt32(t["roadway"]),
626 - SelfAddress = t["selfAddress"] is DBNull ? -1 : Convert.ToInt32(t["selfAddress"]) 626 + SelfAddress = t["selfAddress"] is DBNull ? -1 : Convert.ToInt32(t["selfAddress"]),
  627 + BackAddress = t["backAddress"] is DBNull ? null: t["backAddress"].ToString()
627 }).ToList(); 628 }).ToList();
628 return BllResultFactory.Sucess<List<DeviceEntity>>(list, "成功"); 629 return BllResultFactory.Sucess<List<DeviceEntity>>(list, "成功");
629 630
@@ -1061,11 +1062,11 @@ namespace HHWCS.Bll @@ -1061,11 +1062,11 @@ namespace HHWCS.Bll
1061 /// <param name="v"></param> 1062 /// <param name="v"></param>
1062 /// <param name="task"></param> 1063 /// <param name="task"></param>
1063 /// <returns></returns> 1064 /// <returns></returns>
1064 - public static BllResult EmptyOutHandle(string v, TaskEntity task) 1065 + public static BllResult EmptyOutHandle(string v,string status, TaskEntity task)
1065 { 1066 {
1066 try 1067 try
1067 { 1068 {
1068 - string sql = $"UPDATE task set isEmptyOut ={v} where id = {task.Id}"; 1069 + string sql = $"UPDATE task set isEmptyOut ={v} ,status = {status} where id = {task.Id}";
1069 int i = MySqlHelper.ExecuteNonQuery(AppCommon.ConnectionString, sql); 1070 int i = MySqlHelper.ExecuteNonQuery(AppCommon.ConnectionString, sql);
1070 if (i == 0) 1071 if (i == 0)
1071 { 1072 {
HHWCS.Model/DeviceEntity.cs
@@ -34,5 +34,10 @@ namespace HHWCS.Model @@ -34,5 +34,10 @@ namespace HHWCS.Model
34 { 34 {
35 return this.Code+" "+this.Name; 35 return this.Code+" "+this.Name;
36 } 36 }
  37 +
  38 + /// <summary>
  39 + /// 托盘回退地址
  40 + /// </summary>
  41 + public string BackAddress { get; set; }
37 } 42 }
38 } 43 }
HHWCSHost/App.config
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> 4 <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5 </startup> 5 </startup>
6 <connectionStrings> 6 <connectionStrings>
7 - <add name="MySql" connectionString="server=172.16.29.40;user id=root;password=hhsoftware;persistsecurityinfo=True;database=hhwcs;SslMode=none"/> 7 + <add name="MySql" connectionString="server=127.0.0.1;user id=root;password=123456;persistsecurityinfo=True;database=hhwcs;SslMode=none"/>
8 </connectionStrings> 8 </connectionStrings>
9 <appSettings> 9 <appSettings>
10 <add key="OPCServerIP" value="192.168.10.100"/> 10 <add key="OPCServerIP" value="192.168.10.100"/>
HHWCSHost/Controls/StockerInfo.xaml
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="1" Grid.Column="0" TextWrapping="Wrap" Text="任务校验" /> 48 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="1" Grid.Column="0" TextWrapping="Wrap" Text="任务校验" />
49 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="1" Grid.Column="2" TextWrapping="Wrap" Text="工作模式" /> 49 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="1" Grid.Column="2" TextWrapping="Wrap" Text="工作模式" />
50 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="1" Grid.Column="4" TextWrapping="Wrap" Text="操作模式" /> 50 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="1" Grid.Column="4" TextWrapping="Wrap" Text="操作模式" />
51 - <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="2" Grid.Column="0" TextWrapping="Wrap" Text="工作状态" /> 51 + <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="2" Grid.Column="0" TextWrapping="Wrap" Text="出入执行标记" />
52 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="2" Grid.Column="2" TextWrapping="Wrap" Text="任务标志" /> 52 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="2" Grid.Column="2" TextWrapping="Wrap" Text="任务标志" />
53 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="2" Grid.Column="4" TextWrapping="Wrap" Text="任务号1" /> 53 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="2" Grid.Column="4" TextWrapping="Wrap" Text="任务号1" />
54 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="3" Grid.Column="0" TextWrapping="Wrap" Text="任务号2" /> 54 <TextBlock Style="{DynamicResource txtBlockStyle}" Grid.Row="3" Grid.Column="0" TextWrapping="Wrap" Text="任务号2" />
HHWCSHost/Controls/StockerInfo.xaml.cs
@@ -140,13 +140,13 @@ namespace HHWCSHost.Controls @@ -140,13 +140,13 @@ namespace HHWCSHost.Controls
140 lab_WorkStatus.Content = "出库"; 140 lab_WorkStatus.Content = "出库";
141 break; 141 break;
142 case "3": 142 case "3":
143 - lab_WorkStatus.Content = "拣选"; 143 + lab_WorkStatus.Content = "转库"; //"拣选";
144 break; 144 break;
145 case "4": 145 case "4":
146 lab_WorkStatus.Content = "转库"; 146 lab_WorkStatus.Content = "转库";
147 break; 147 break;
148 case "5": 148 case "5":
149 - lab_WorkStatus.Content = "双重入库"; 149 + lab_WorkStatus.Content = "不可用"; //"双重入库";
150 break; 150 break;
151 case "6": 151 case "6":
152 lab_WorkStatus.Content = "回库台位(入库准备)"; 152 lab_WorkStatus.Content = "回库台位(入库准备)";
@@ -253,7 +253,7 @@ namespace HHWCSHost.Controls @@ -253,7 +253,7 @@ namespace HHWCSHost.Controls
253 var a = (TextBlock)list_Alarm.Items[i]; 253 var a = (TextBlock)list_Alarm.Items[i];
254 if (a.Text.Contains(v)) 254 if (a.Text.Contains(v))
255 { 255 {
256 - list_Alarm.Items.Remove(i); 256 + list_Alarm.Items.Remove(list_Alarm.Items[i]);
257 } 257 }
258 } 258 }
259 } 259 }
HHWCSHost/SysData.txt
@@ -58,3 +58,5 @@ disable 禁用 @@ -58,3 +58,5 @@ disable 禁用
58 1.当条码不识别或外形检测不通过时,电气程序自动退回托盘到入库口; 58 1.当条码不识别或外形检测不通过时,电气程序自动退回托盘到入库口;
59 2.当请求时的条码无对应任务或任务状态不对时,wcs给出回退的回复,即将去向地址写成入库口即可; 59 2.当请求时的条码无对应任务或任务状态不对时,wcs给出回退的回复,即将去向地址写成入库口即可;
60 60
  61 +货架1到2层可以承重,其他不能承重,需要区别;(没有实现)
  62 +
HHWCSHost/View/Frm_Main.xaml.cs
@@ -125,7 +125,7 @@ namespace HHWCSHost.View @@ -125,7 +125,7 @@ namespace HHWCSHost.View
125 var stockers = FindDevByType("stocker").Data; 125 var stockers = FindDevByType("stocker").Data;
126 foreach (var item in stockers) 126 foreach (var item in stockers)
127 { 127 {
128 - StockerMonitor stockerMonitor = new StockerMonitor(16, false, false, 1200, 100) 128 + StockerMonitor stockerMonitor = new StockerMonitor(32, false, false, 1200, 100)
129 { 129 {
130 ControlName = item.Name, 130 ControlName = item.Name,
131 Name = item.Code 131 Name = item.Code
@@ -138,6 +138,7 @@ namespace HHWCSHost.View @@ -138,6 +138,7 @@ namespace HHWCSHost.View
138 Name = item.Code 138 Name = item.Code
139 }; 139 };
140 stockerInfo.DoubleInEvent += this.DoubleInHandle; 140 stockerInfo.DoubleInEvent += this.DoubleInHandle;
  141 + stockerInfo.EmptyOutEvent += this.EmptyOutHandle;
141 panel_Bottom.Children.Add(stockerInfo); 142 panel_Bottom.Children.Add(stockerInfo);
142 } 143 }
143 144
@@ -384,11 +385,6 @@ namespace HHWCSHost.View @@ -384,11 +385,6 @@ namespace HHWCSHost.View
384 } 385 }
385 386
386 #endregion 387 #endregion
387 - //AddLogToUI("线程" + Thread.CurrentThread.ManagedThreadId + "进入", 1);  
388 - //Thread.Sleep(5000);  
389 - //return;  
390 -  
391 - //todo:完善主控时钟  
392 388
393 #region 检查是否连接正常 389 #region 检查是否连接正常
394 if (PLC.GetConnStatus()) 390 if (PLC.GetConnStatus())
@@ -428,35 +424,6 @@ namespace HHWCSHost.View @@ -428,35 +424,6 @@ namespace HHWCSHost.View
428 AddLogToUI("读取地址数据失败,请尝试关闭连接后重新连接;", 2); 424 AddLogToUI("读取地址数据失败,请尝试关闭连接后重新连接;", 2);
429 return; 425 return;
430 } 426 }
431 - //todo:测试值写入  
432 - {  
433 - //var tempds = DeviceAddressEntities.FindAll(t => t.DeviceId == 4);  
434 - ////var temp23 = WriteWCSStationDataAddress(tempds, "1", "6", "1", "0", "1001", "0", tempds.Find(t=>t.DevicePropCode=="Barcode").value, "1003", "0");  
435 -  
436 -  
437 - //var a = DeviceAddressEntities.FindAll(t => t.DeviceId == 5);  
438 - //var b = a.Find(t => t.DevicePropCode == "RunningStatus");  
439 - //b.value = "False";  
440 - //var c = a.Find(t => t.DevicePropCode == "PalletExist");  
441 - //c.value = "True";  
442 - //var d = a.Find(t => t.DevicePropCode == "PalletDestinationAddress");  
443 - //d.value = "1003";  
444 - //var g = a.Find(t => t.DevicePropCode == "ConveyorNo");  
445 - //g.value = "1001";  
446 - //var f = a.Find(t => t.DevicePropCode == "PalletBarcode");  
447 - //f.value = "TP001";  
448 - //var rt = WriteAddress(a);  
449 - //if (rt.Success)  
450 - //{  
451 - // //再读出来  
452 - // var rt2 = ReadAddress(a);  
453 - // AddLogToUI(rt2.Msg, 1);  
454 - //}  
455 - //else  
456 - //{  
457 - // AddLogToUI("写入地址错误:" + rt.Msg, 2);  
458 - //}  
459 - }  
460 427
461 //日志 428 //日志
462 DeviceEntities.ForEach(item => DeviceAddressEntities.FindAll(t => t.DeviceId == item.Id).Join(DevicePropEntities.FindAll(t => t.DeviceTypeId == item.DeviceTypeId && t.IsMonitor == 1), t => t.DevicePropCode, a => a.Code, (a, b) => new { a, b }).Where(t => t.a.value != t.b.MonitorCompareValue).Select(t => t.b).ToList().ForEach(t => AddLogToUI("报警:" + t.Name + " 信息:" + t.MonitorFailure, 2))); 429 DeviceEntities.ForEach(item => DeviceAddressEntities.FindAll(t => t.DeviceId == item.Id).Join(DevicePropEntities.FindAll(t => t.DeviceTypeId == item.DeviceTypeId && t.IsMonitor == 1), t => t.DevicePropCode, a => a.Code, (a, b) => new { a, b }).Where(t => t.a.value != t.b.MonitorCompareValue).Select(t => t.b).ToList().ForEach(t => AddLogToUI("报警:" + t.Name + " 信息:" + t.MonitorFailure, 2)));
@@ -488,27 +455,6 @@ namespace HHWCSHost.View @@ -488,27 +455,6 @@ namespace HHWCSHost.View
488 var stockerMonitor = (StockerMonitor)panel_Stocker.FindName(item.Code); 455 var stockerMonitor = (StockerMonitor)panel_Stocker.FindName(item.Code);
489 stockerMonitor.SetProp(addressEntities); 456 stockerMonitor.SetProp(addressEntities);
490 } 457 }
491 - //foreach (var item in FindDevByType("stationForStockerIn").Data)  
492 - //{  
493 - // var s = this.FindName(item.Code);  
494 - // var address = DeviceAddressEntities.FindAll(t => t.DeviceId == item.Id);  
495 - // if (s is StationH stationH)  
496 - // {  
497 -  
498 - // }  
499 - // else if (s is StationV stationV)  
500 - // {  
501 -  
502 - // }  
503 - //}  
504 - //foreach (var item in FindDevByType("stationForStockerOut").Data)  
505 - //{  
506 -  
507 - //}  
508 - //foreach (var item in FindDevByType("station").Data)  
509 - //{  
510 -  
511 - //}  
512 foreach (var item in FindDevByType("conveyor").Data) 458 foreach (var item in FindDevByType("conveyor").Data)
513 { 459 {
514 var cv = this.FindName(item.Code); 460 var cv = this.FindName(item.Code);
@@ -542,12 +488,6 @@ namespace HHWCSHost.View @@ -542,12 +488,6 @@ namespace HHWCSHost.View
542 //同巷道内的移库,当堆垛机状态为0,1,2时,均可以响应巷道内的移库 488 //同巷道内的移库,当堆垛机状态为0,1,2时,均可以响应巷道内的移库
543 ExcuteTaskTransferInRoadway(stockers); 489 ExcuteTaskTransferInRoadway(stockers);
544 490
545 -  
546 - //响应任务校验为2时,重新写入任务  
547 - //响应双重入库处理  
548 - //响应高度不匹配  
549 - //响应空出及发送地址错的处理  
550 -  
551 } 491 }
552 492
553 #endregion 493 #endregion
@@ -860,8 +800,8 @@ namespace HHWCSHost.View @@ -860,8 +800,8 @@ namespace HHWCSHost.View
860 //表示地址请求,此时可能是分拣回库,也可能是新入库,也可能是空托入库,这里空托入库如果没有任务就自动生成任务(自动生成空托盘入库暂时不实现) 800 //表示地址请求,此时可能是分拣回库,也可能是新入库,也可能是空托入库,这里空托入库如果没有任务就自动生成任务(自动生成空托盘入库暂时不实现)
861 //获取目标库位 801 //获取目标库位
862 //hack:这里临时加个判断,如果任务状态不是31,则不响应 802 //hack:这里临时加个判断,如果任务状态不是31,则不响应
863 - if (taskEntity.Status == 31)  
864 - { 803 + //if (taskEntity.Status == 31)
  804 + //{
865 LocationEntity location; 805 LocationEntity location;
866 if (taskEntity.Type == 100 || taskEntity.Type == 500) 806 if (taskEntity.Type == 100 || taskEntity.Type == 500)
867 { 807 {
@@ -911,7 +851,7 @@ namespace HHWCSHost.View @@ -911,7 +851,7 @@ namespace HHWCSHost.View
911 AddLogToUI("写入" + station + "WCS区地址失败,任务:" + taskEntity.Id.ToString() + "消息:" + result.Msg, 2); 851 AddLogToUI("写入" + station + "WCS区地址失败,任务:" + taskEntity.Id.ToString() + "消息:" + result.Msg, 2);
912 } 852 }
913 } 853 }
914 - } 854 + //}
915 } 855 }
916 856
917 if (addresses.Find(t => t.DevicePropCode == "Type").value == "2") 857 if (addresses.Find(t => t.DevicePropCode == "Type").value == "2")
@@ -1145,7 +1085,7 @@ namespace HHWCSHost.View @@ -1145,7 +1085,7 @@ namespace HHWCSHost.View
1145 private void StationBack(List<DeviceAddressEntity> addresses,DeviceEntity device) 1085 private void StationBack(List<DeviceAddressEntity> addresses,DeviceEntity device)
1146 { 1086 {
1147 //获取地址 1087 //获取地址
1148 - var result = WriteWCSStationDataAddress(addresses, "1", "06", addresses.Find(t => t.DevicePropCode == "PLCNo").value, "0", addresses.Find(t => t.DevicePropCode == "StationNo").value, addresses.Find(t => t.DevicePropCode == "TaskNo").value, addresses.Find(t => t.DevicePropCode == "Barcode").value, addresses.Find(t => t.DevicePropCode == "StationNo").value, "0"); 1088 + var result = WriteWCSStationDataAddress(addresses, "1", "06", addresses.Find(t => t.DevicePropCode == "PLCNo").value, "0", addresses.Find(t => t.DevicePropCode == "StationNo").value, addresses.Find(t => t.DevicePropCode == "TaskNo").value, addresses.Find(t => t.DevicePropCode == "Barcode").value,device.BackAddress, "0");
1149 if (result.Success) 1089 if (result.Success)
1150 { 1090 {
1151 AddLogToUI($"{device}回退成功",1); 1091 AddLogToUI($"{device}回退成功",1);
@@ -1254,7 +1194,7 @@ namespace HHWCSHost.View @@ -1254,7 +1194,7 @@ namespace HHWCSHost.View
1254 var task = taskResult.Data[0]; 1194 var task = taskResult.Data[0];
1255 if (task.Status < 40) 1195 if (task.Status < 40)
1256 { 1196 {
1257 - BllResult temp = Bll.EmptyOutHandle("1",task); 1197 + BllResult temp = Bll.EmptyOutHandle("1","40",task);
1258 if (temp.Success) 1198 if (temp.Success)
1259 { 1199 {
1260 //清空WCS交换区 1200 //清空WCS交换区
@@ -1266,7 +1206,7 @@ namespace HHWCSHost.View @@ -1266,7 +1206,7 @@ namespace HHWCSHost.View
1266 else 1206 else
1267 { 1207 {
1268 //回滚 1208 //回滚
1269 - Bll.EmptyOutHandle("0", task); 1209 + Bll.EmptyOutHandle("0",task.Status.ToString(), task);
1270 return BllResultFactory.Error(null, "空出处理失败:" + sendResult.Msg); 1210 return BllResultFactory.Error(null, "空出处理失败:" + sendResult.Msg);
1271 } 1211 }
1272 } 1212 }
@@ -1552,7 +1492,7 @@ namespace HHWCSHost.View @@ -1552,7 +1492,7 @@ namespace HHWCSHost.View
1552 case "DWORD": obj = Convert.ToUInt32(data); break; 1492 case "DWORD": obj = Convert.ToUInt32(data); break;
1553 case "BOOL": obj = Convert.ToBoolean(data); break; 1493 case "BOOL": obj = Convert.ToBoolean(data); break;
1554 case "WORD": obj = Convert.ToUInt16(data); break; 1494 case "WORD": obj = Convert.ToUInt16(data); break;
1555 - case "CHAR": obj = Bll.StringToASCII(data); break; 1495 + case "CHAR": obj = Bll.StringToASCII(data+"\u0003"); break;
1556 default: 1496 default:
1557 obj = data; 1497 obj = data;
1558 break; 1498 break;
@@ -1582,7 +1522,7 @@ namespace HHWCSHost.View @@ -1582,7 +1522,7 @@ namespace HHWCSHost.View
1582 case "DWORD": 1522 case "DWORD":
1583 case "BOOL": 1523 case "BOOL":
1584 case "WORD": str = data.ToString(); break; 1524 case "WORD": str = data.ToString(); break;
1585 - case "CHAR": str = Bll.ASCIIToString((short[])data).Trim(); break; 1525 + case "CHAR": str = Bll.ASCIIToString((short[])data).Trim().Replace("\u0003",""); break;
1586 default: 1526 default:
1587 str = data.ToString(); 1527 str = data.ToString();
1588 break; 1528 break;
@@ -1602,7 +1542,10 @@ namespace HHWCSHost.View @@ -1602,7 +1542,10 @@ namespace HHWCSHost.View
1602 /// <returns></returns> 1542 /// <returns></returns>
1603 private bool ValidateStockerForCompleteTask(List<DeviceAddressEntity> addresses) 1543 private bool ValidateStockerForCompleteTask(List<DeviceAddressEntity> addresses)
1604 { 1544 {
1605 - if (addresses.Find(t => t.DevicePropCode == "TaskExcuteStatus").value == "3") 1545 + if (addresses.Find(t => t.DevicePropCode == "TaskExcuteStatus").value == "3"
  1546 + //这里加上WCS交换区检测,防止PLC来不及反应重复完成任务,交换区数据是会在完成任务后才会清除
  1547 + && addresses.First(t => t.DevicePropCode == "WCSTaskFlag").value != "0"
  1548 + )
1606 { 1549 {
1607 return true; 1550 return true;
1608 } 1551 }
@@ -1621,6 +1564,7 @@ namespace HHWCSHost.View @@ -1621,6 +1564,7 @@ namespace HHWCSHost.View
1621 private void ExcuteTaskOut(List<DeviceEntity> stockers) 1564 private void ExcuteTaskOut(List<DeviceEntity> stockers)
1622 { 1565 {
1623 List<TaskEntity> taskEntities = GetAllTaskOut(); 1566 List<TaskEntity> taskEntities = GetAllTaskOut();
  1567 + taskEntities = taskEntities.OrderBy(t => t.LastUpdated).ToList();
1624 foreach (var task in taskEntities) 1568 foreach (var task in taskEntities)
1625 { 1569 {
1626 //获取任务所在巷道,即库位对应的巷道 1570 //获取任务所在巷道,即库位对应的巷道
@@ -1919,11 +1863,12 @@ namespace HHWCSHost.View @@ -1919,11 +1863,12 @@ namespace HHWCSHost.View
1919 { 1863 {
1920 if (deviceAddressEntities.First(t => t.DevicePropCode == "WorkModel").value == "2" 1864 if (deviceAddressEntities.First(t => t.DevicePropCode == "WorkModel").value == "2"
1921 && deviceAddressEntities.First(t => t.DevicePropCode == "OperationModel").value == "5" 1865 && deviceAddressEntities.First(t => t.DevicePropCode == "OperationModel").value == "5"
1922 - && (deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "0" || deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "2") 1866 + && (deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "0" || deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "2" )
1923 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskExcuteStatus").value == "1" 1867 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskExcuteStatus").value == "1"
1924 && deviceAddressEntities.First(t => t.DevicePropCode == "HasPallet").value == "1" 1868 && deviceAddressEntities.First(t => t.DevicePropCode == "HasPallet").value == "1"
1925 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskNo1").value == "0" 1869 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskNo1").value == "0"
1926 - // && 1870 + //这里加上WCS交换区检测,防止PLC来不及反应重复写入任务
  1871 + && deviceAddressEntities.First(t => t.DevicePropCode == "WCSTaskFlag").value == "0"
1927 ) 1872 )
1928 { 1873 {
1929 return true; 1874 return true;
@@ -1951,11 +1896,12 @@ namespace HHWCSHost.View @@ -1951,11 +1896,12 @@ namespace HHWCSHost.View
1951 { 1896 {
1952 if (deviceAddressEntities.First(t => t.DevicePropCode == "WorkModel").value == "2" 1897 if (deviceAddressEntities.First(t => t.DevicePropCode == "WorkModel").value == "2"
1953 && deviceAddressEntities.First(t => t.DevicePropCode == "OperationModel").value == "5" 1898 && deviceAddressEntities.First(t => t.DevicePropCode == "OperationModel").value == "5"
1954 - && (deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "0" || deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "2" || deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "1") 1899 + && (deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "0" || deviceAddressEntities.First(t => t.DevicePropCode == "WorkStatus").value == "3")
1955 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskExcuteStatus").value == "1" 1900 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskExcuteStatus").value == "1"
1956 && deviceAddressEntities.First(t => t.DevicePropCode == "HasPallet").value == "1" 1901 && deviceAddressEntities.First(t => t.DevicePropCode == "HasPallet").value == "1"
1957 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskNo1").value == "0" 1902 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskNo1").value == "0"
1958 - // && 1903 + //这里加上WCS交换区检测,防止PLC来不及反应重复写入任务
  1904 + && deviceAddressEntities.First(t => t.DevicePropCode == "WCSTaskFlag").value == "0"
1959 ) 1905 )
1960 { 1906 {
1961 return true; 1907 return true;
@@ -1987,7 +1933,8 @@ namespace HHWCSHost.View @@ -1987,7 +1933,8 @@ namespace HHWCSHost.View
1987 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskExcuteStatus").value == "1" 1933 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskExcuteStatus").value == "1"
1988 && deviceAddressEntities.First(t => t.DevicePropCode == "HasPallet").value == "1" 1934 && deviceAddressEntities.First(t => t.DevicePropCode == "HasPallet").value == "1"
1989 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskNo1").value == "0" 1935 && deviceAddressEntities.First(t => t.DevicePropCode == "TaskNo1").value == "0"
1990 - // && 1936 + //这里加上WCS交换区检测,防止PLC来不及反应重复写入任务
  1937 + && deviceAddressEntities.First(t => t.DevicePropCode == "WCSTaskFlag").value == "0"
1991 ) 1938 )
1992 { 1939 {
1993 return true; 1940 return true;