Bläddra i källkod

Merge branch '71博创自动立库' of http://www.imaodou.com.cn:30030/c_jack/EICP3.0_69 into 71博创自动立库

莫海杰 3 månader sedan
förälder
incheckning
bdbbeaa55b
1 ändrade filer med 8 tillägg och 6 borttagningar
  1. 8 6
      SCADA_DAQ/Customer/Service/Wcs_WmsService.cs

+ 8 - 6
SCADA_DAQ/Customer/Service/Wcs_WmsService.cs

@@ -318,6 +318,7 @@ namespace SCADA_DAQ.Customer.Service
             wmsTasks.Sort((item1, item2) => item1.TaskNo.CompareTo(item2.TaskNo)); //排序
             var dbRes = Env.DAL.Insert(wmsTasks);
             Log.Info(taskNos);
+            AddDeviceTaskList(wmsHaveSourceLocationTask);
             wmsUpLoad(wmsHaveSourceLocationTask);
             if (dbRes.IsSucceed == true)
             {
@@ -335,8 +336,6 @@ namespace SCADA_DAQ.Customer.Service
         /// <param name="task"></param>
         public static void wmsUpLoad(List<AppBCItemTaskModel> task)
         {
-            var sourceLocations = task.ToLookup(i=>i.SourceLocation).Select(j=>j.Key).ToList();
-            AddDeviceTaskList(sourceLocations);
             var message = "";
             var itemTaskUpList = new List<AppBCItemTaskModel>();   //更新任务状态
             var successItemTaskQty = new List<AppBCItemTaskModel>();  //更新物料库存
@@ -463,14 +462,15 @@ namespace SCADA_DAQ.Customer.Service
         /// 自动下发堆垛机任务
         /// </summary>
         /// <param name="sourceLocations"></param>
-        public static void AddDeviceTaskList(List<string> sourceLocations)
+        public static void AddDeviceTaskList(List<AppBCItemTaskModel> sourceLocations)
         {
+            var sourceLocationGroupBy = sourceLocations.GroupBy(i => i.SourceLocation).Select(j => j.FirstOrDefault()).ToList();
             var sourceLocationList = new List<OperationBo>();
             var endLine1 = 1;
             var endLine2 = 3;
-            foreach (var item in sourceLocations)
+            foreach (var item in sourceLocationGroupBy)
             {
-                var sourceLocation = item.Split('-');
+                var sourceLocation = item.SourceLocation.Split('-');
                 var crane = 2;
                 var endCol = 65;
                 var endRow = endLine2;
@@ -493,10 +493,12 @@ namespace SCADA_DAQ.Customer.Service
                     EndRow = endRow,
                     EndCol = endCol,
                     EndLayer = 1,
+                    ItemCode = item.ItemCode,
+                    ItemName = item.ItemName,
                 });
                 if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 1)
                 {
-                    endLine1 = 2;
+                    endLine1 = 2; 
                 }
                 else if ((Convert.ToInt32(sourceLocation[1]) == 01 || Convert.ToInt32(sourceLocation[1]) == 02) && endLine1 == 2)
                 {