|
@@ -1,19 +1,11 @@
|
|
|
using SCADA.CommonLib;
|
|
|
+using SCADA.CommonLib.Helper;
|
|
|
using SCADA_DAQ.Customer.Machines;
|
|
|
using SCADA_DAQ.Customer.Models;
|
|
|
using SCADA_DAQ.Plugin.Machine;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using System.Threading;
|
|
|
-using System.Windows.Shapes;
|
|
|
-using SCADA.CommonLib.Helper;
|
|
|
-using System.Runtime.InteropServices.WindowsRuntime;
|
|
|
-using static Xceed.Wpf.Toolkit.Calculator;
|
|
|
-using SCADA.CommonLib.Data.DIL;
|
|
|
-using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
namespace SCADA_DAQ.Customer.Service
|
|
|
{
|
|
@@ -366,5 +358,84 @@ namespace SCADA_DAQ.Customer.Service
|
|
|
return res;
|
|
|
}
|
|
|
#endregion
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 下发堆垛机任务,更新子表库位信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="itemNoAndSourceLocation"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public RpcResponse<object> OperateMachineTaskList(List<SourceLocationItemVo> sourceLocationItemList)
|
|
|
+ {
|
|
|
+ var res = new RpcResponse<object>();
|
|
|
+ var sourceLocationList = new List<OperationBo>();
|
|
|
+ var endLine1 = 1;
|
|
|
+ var endLine2 = 3;
|
|
|
+
|
|
|
+ foreach (var sourceLocationItem in sourceLocationItemList)
|
|
|
+ {
|
|
|
+ var sourceLocation = sourceLocationItem.SourceLocation.Split('-');
|
|
|
+ var crane = 2;
|
|
|
+ var endCol = 65;
|
|
|
+ var endRow = endLine2;
|
|
|
+ if (Convert.ToInt32(sourceLocation[1]) == 1 || Convert.ToInt32(sourceLocation[1]) == 2)
|
|
|
+ {
|
|
|
+ crane = 1;
|
|
|
+ endCol = 47;
|
|
|
+ endRow = endLine1;
|
|
|
+ }
|
|
|
+ sourceLocationList.Add(new OperationBo()
|
|
|
+ {
|
|
|
+ StartRow = Convert.ToInt32(sourceLocation[1]),
|
|
|
+ StartCol = Convert.ToInt32(sourceLocation[2]),
|
|
|
+ StartLayer = Convert.ToInt32(sourceLocation[3]),
|
|
|
+ IsStart = false,
|
|
|
+ OperateNo = Guid.NewGuid().ToString(),
|
|
|
+ MachineTaskId = 5,
|
|
|
+ Crane = crane,
|
|
|
+ Line = endRow,
|
|
|
+ EndRow = endRow,
|
|
|
+ EndCol = endCol,
|
|
|
+ EndLayer = 1,
|
|
|
+ ItemCode = sourceLocationItem.ItemCode,
|
|
|
+ ItemName = sourceLocationItem.ItemName
|
|
|
+ });
|
|
|
+ if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 1)
|
|
|
+ {
|
|
|
+ endLine1 = 2;
|
|
|
+ }
|
|
|
+ else if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 2)
|
|
|
+ {
|
|
|
+ endLine1 = 1;
|
|
|
+ }
|
|
|
+ if ((Convert.ToInt32(sourceLocation[1]) == 03 || Convert.ToInt32(sourceLocation[1]) == 04) && endLine2 == 3)
|
|
|
+ {
|
|
|
+ endLine2 = 4;
|
|
|
+ }
|
|
|
+ else if ((Convert.ToInt32(sourceLocation[1]) == 03 || Convert.ToInt32(sourceLocation[1]) == 04) && endLine2 == 4)
|
|
|
+ {
|
|
|
+ endLine2 = 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var operationCrane1List = sourceLocationList.Where(i => i.Crane == 1).ToList();
|
|
|
+ var operationCrane2List = sourceLocationList.Where(i => i.Crane == 2).ToList();
|
|
|
+ operationCrane1List.ForEach(t =>
|
|
|
+ {
|
|
|
+ if (!CustomerEnv.OperationCrane1List.Any(i => i.StartLayer == t.StartLayer && i.StartCol == t.StartCol && i.StartRow == t.StartRow))
|
|
|
+ {
|
|
|
+ CustomerEnv.OperationCrane1List.Add(t);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ operationCrane2List.ForEach(t =>
|
|
|
+ {
|
|
|
+ if (!CustomerEnv.OperationCrane2List.Any(i => i.StartLayer == t.StartLayer && i.StartCol == t.StartCol && i.StartRow == t.StartRow))
|
|
|
+ {
|
|
|
+ CustomerEnv.OperationCrane2List.Add(t);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ res.IsSucceed = false;
|
|
|
+ res.Message = $"下发堆垛机任务成功";
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|
|
|
}
|