From 0b5ccdca6263cf7a2cee460f30c76ef1efea2811 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 27 四月 2024 17:47:27 +0800
Subject: [PATCH] 人工出库,人工入库,人工移库,PDA扫码确认外协物料已被取走接口

---
 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
index dfff658..7bf5815 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
@@ -56,21 +56,34 @@
                     return content.Error("杞﹁疆SN鍙锋湁璇紒璇烽噸鏂版壂鎻忥紒");
                 #endregion
 
-                dt_mes_detail info = null;
-                dt_mes_head mes_head = null;
+                //dt_mes_detail info = null;
+                //dt_mes_head mes_head = null;
+                VV_Mes_Workinfo mes_Work = null;
 
                 int count = 0;  //杞﹁疆鏁伴噺
-                foreach (var item in sn.Split(","))
+                string bindSN = "";
+                List<string> list = new List<string>();
+                foreach (var SN in sn.Split(","))
+                {
+                    if (!string.IsNullOrEmpty(SN))
+                        list.Add(SN);
+                }
+                foreach (var item in list)
                 {
                     if (item != null)
                     {
                         count++;
-                        info = freeDB.Select<dt_mes_detail>().Where(x => x.SN == item).First();
-                        if (info == null)
-                            return content.Error($"绗瑊count}涓溅杞棤妫�娴嬩笂鏂欏伐鍗曡鎯咃紝璇锋牳鏌ュ伐鍗曞悗鍦ㄦ壂鎻忥紒");
-                        mes_head = freeDB.Select<dt_mes_head>().Where(x => x.jobID == info.jobID && x.processCode == "28").First();
-                        if (mes_head == null)
+                        bindSN += bindSN == "" ? item : "," + item;
+
+                         mes_Work = freeDB.Select<VV_Mes_Workinfo>().Where(x => x.SN == item && x.processCode == "28").First();
+                        if (mes_Work == null)
                             return content.Error($"绗瑊count}涓溅杞棤妫�娴嬩笂鏂欏伐鍗曚俊鎭紝璇锋牳鏌ュ伐鍗曞悗鍦ㄦ壂鎻忥紒");
+                        //info = freeDB.Select<dt_mes_detail>().Where(x => x.SN == item).First();
+                        //if (info == null)
+                        //    return content.Error($"绗瑊count}涓溅杞棤妫�娴嬩笂鏂欏伐鍗曡鎯咃紝璇锋牳鏌ュ伐鍗曞悗鍦ㄦ壂鎻忥紒");
+                        //mes_head = freeDB.Select<dt_mes_head>().Where(x => x.jobID == info.jobID && x.processCode == "28").First();
+                        //if (mes_head == null)
+                        //    return content.Error($"绗瑊count}涓溅杞棤妫�娴嬩笂鏂欏伐鍗曚俊鎭紝璇锋牳鏌ュ伐鍗曞悗鍦ㄦ壂鎻忥紒");
                     }
                 }
                 VOLContext Context = new VOLContext();
@@ -81,12 +94,12 @@
                 if (!station.enable)
                     return content.Error($"涓嬫枡鍙stationNo}琚鐢紝璇锋牳瀹烇紒");
                 station.quantity = count;
-                station.bindSN = sn;
-                station.stationType = mes_head.drawingNo;
+                station.bindSN = bindSN;
+                station.stationType = mes_Work.drawingNo;
                 station.location_state = "Stroge";
-                station.Number = mes_head.jobID;
-                if (info.heatID != null)
-                    station.heatNumber = info.heatID;
+                station.Number = mes_Work.jobID;
+                if (mes_Work.heatID != null)
+                    station.heatNumber = mes_Work.heatID;
                 station.tray_status = "StrogeTray";
 
                 stationinfoRepository.Update(station, true);
@@ -110,7 +123,7 @@
                     agv_fromaddress = station.stationCode,
                     agv_id = Guid.NewGuid(),
                     agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
-                    agv_grade = 2,
+                    agv_grade = 3,
                     agv_createtime = DateTime.Now,
                     agv_taskstate = "Queue",
                     agv_materielid = station.stationType,
@@ -118,10 +131,10 @@
                     agv_tasktype = "TaskType_OutsourceOutbound",
                     agv_toaddress = "",
                     agv_userid = user,//"绯荤粺",
-                    jobID = mes_head.jobID,
+                    jobID = mes_Work.jobID,
                     bindSN = station.bindSN,
-                    agv_worktype = Convert.ToInt32(mes_head.processCode),
-                    agv_materbarcode = mes_head.materialCode,
+                    agv_worktype = Convert.ToInt32(mes_Work.processCode),
+                    agv_materbarcode = mes_Work.materialCode,
                     agv_Traytype = station.tray_type,
                     agv_TrayStatus = station.tray_status
                 };

--
Gitblit v1.9.3