From 06a8b6963d6d4f229d4e196b4b09ce57e2cbf2dd Mon Sep 17 00:00:00 2001
From: 杨前锦 <1010338399@qq.com>
Date: 星期四, 24 七月 2025 17:21:40 +0800
Subject: [PATCH] 印尼佳通-GT服务开发

---
 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs |  505 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 337 insertions(+), 168 deletions(-)

diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs
index c63c661..eff5c04 100644
--- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs
+++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs
@@ -11,13 +11,16 @@
 using Swashbuckle.Swagger;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Reflection;
 using System.Text.RegularExpressions;
 using System.Threading;
+using Ubiety.Dns.Core;
 using static HH.WCS.Mobox3.YNJT_PT.api.ApiModel;
 using static HH.WCS.Mobox3.YNJT_PT.api.OtherModel;
 using static HH.WCS.Mobox3.YNJT_PT.api.WmsController;
+using static HH.WCS.Mobox3.YNJT_PT.dispatch.WCSDispatch;
 using static HH.WCS.Mobox3.YNJT_PT.util.Settings;
 using static HH.WCS.Mobox3.YNJT_PT.wms.WMSHelper;
 using static System.Net.Mime.MediaTypeNames;
@@ -35,24 +38,26 @@
         /// 鎴愬瀷鏈轰笅绾胯褰�         /// </summary>
         /// <param name="model"></param>
-        public static ResponseResult cxjOffLineRecord(OffLineModel model) 
+        public static ResponseResult cxjOffLineRecord(NotifyDeviceSignalModel model) 
         {
             ResponseResult response = new ResponseResult();
-            var container = ContainerHelper.GetCntr(model.rfid);
+            var container = ContainerHelper.GetCntr(model.cntrNo);
             if (container == null)
             {
-                ContainerHelper.AddCntr(model.rfid);
+                ContainerHelper.AddCntr(model.cntrNo);
             }
 
             try
             {
+                OffLineModel extData1 = JsonConvert.DeserializeObject<OffLineModel>(model.extData.ToString());
                 OffLineRecord record = new OffLineRecord()
                 {
-                    S_RFID = model.rfid,
+                    S_RFID = model.cntrNo,
                     S_DEVICE_NO = model.deviceNo,
-                    N_IS_URGENT = model.isUrgent,
+                    N_IS_URGENT = extData1.isUrgent,
                     T_OFF_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
-                    N_IS_FULL = model.isFull,
+                    N_IS_FULL = extData1.isFull,
+                    N_NEED_PAIR = extData1.needPair,
                     S_LOC = model.loc
                 };
                 WMSHelper.addOffLineRecord(record);
@@ -76,7 +81,7 @@
             var startLoc = LocationHelper.GetLoc(model.loc);
             if (startLoc != null)
             {
-                List<BarcodeModel> extData = model.extData;
+                List<BarcodeModel> extData = JsonConvert.DeserializeObject<List<BarcodeModel>>(model.extData.ToString());
                 int dataCount = extData.Count;
                 if (dataCount > 0)
                 {
@@ -106,7 +111,7 @@
                                     var offLineRecord = WMSHelper.getOffLineRecord(rfid);
                                     if (offLineRecord != null)
                                     {
-                                        if (offLineRecord.N_IS_FULL == 1) 
+                                        if (offLineRecord.N_IS_FULL == 1)
                                         {
                                             if (ext.barcode.Contains("99999999"))
                                             {
@@ -120,30 +125,12 @@
                                                 if (itemBarcodeInfo != null)
                                                 {
                                                     itemBarcodeInfo.N_URGENT_FLAG = offLineRecord.N_IS_URGENT;
-                                                    // 璁$畻鐢熸晥鏃堕棿銆佸け鏁堟椂闂�-                                                    var overage = WMSHelper.getOverage(itemBarcodeInfo.BARCODE);
-                                                    LogHelper.Info($"璁$畻鐢熸晥鏃堕棿銆佸け鏁堟椂闂达紝杩斿洖鍊硷細{JsonConvert.SerializeObject(overage)}", "WMS");
-                                                    if (overage != null)
-                                                    {
-                                                        DateTime txndate = DateTime.Parse(itemBarcodeInfo.TXNDATE);
-                                                        DateTime minTime = txndate.AddHours(overage.MINHOUR);
-                                                        DateTime maxTime = txndate.AddDays(overage.OVERAGE);
-                                                        itemBarcodeInfo.S_EFFECTIVE_TIME = minTime.ToString("yyyy-MM-dd HH:mm:ss");
-                                                        itemBarcodeInfo.S_EXPIRATION_TIME = maxTime.ToString("yyyy-MM-dd HH:mm:ss");
-                                                    }
-                                                    else
-                                                    {
-                                                        response.code = 1;
-                                                        response.msg = $"鏈煡璇㈠埌鐗╂枡瀛樻斁鏃堕棿閰嶇疆淇℃伅锛屾潯褰㈢爜锛歿itemBarcodeInfo.BARCODE}";
-                                                        return response;
-                                                    }
-
                                                     ContainerHelper.addCntrItemRel(rfid, itemBarcodeInfo);
                                                     barcodeList.Add(ext);
                                                 }
                                                 else
                                                 {
-                                                   // 璁板綍鏌ヨ鏉$爜淇℃伅寮傚父
+                                                    // 璁板綍鏌ヨ鏉$爜淇℃伅寮傚父
 
                                                 }
                                             }
@@ -346,7 +333,8 @@
                 }
                 else if (wcsTask.S_TYPE == "鑳氳儙鍙枡鍑哄簱浠诲姟")
                 {
-                    if (model.cntrNo != wcsTask.S_CNTR_CODE)
+                    var cntrItemRels = ContainerHelper.GetCntrItemRel(wcsTask.S_CNTR_CODE);
+                    if (model.cntrNo != wcsTask.S_CNTR_CODE || cntrItemRels.Count == 0 || cntrItemRels.Count > 0 && cntrItemRels[0].S_ITEM_STATE != "OK")
                     {
                         // 璁$畻鎺掑嚭鍙�                         endLoc = WMSHelper.getCallOutLoc(endLoc.N_ROW);
@@ -362,32 +350,58 @@
                         readCodeFeedbackResponse.verifyResult = false;
                         readCodeFeedbackResponse.endLoc = endLoc.S_CODE;
                     }
-                    else 
-                    {
-                        var cntrItemRels = ContainerHelper.GetCntrItemRel(wcsTask.S_CNTR_CODE);
-                        if (cntrItemRels.Count > 0)
-                        {
-                            if (cntrItemRels[0].S_ITEM_STATE != "OK")
-                            {
-                                endLoc = WMSHelper.getMinTaskMiddleLoc(1,endLoc.N_ROADWAY); ;
-
-                                wcsTask.S_END_LOC = endLoc.S_CODE;
-                                wcsTask.S_END_AREA = endLoc.S_AREA_CODE;
-                                WCSHelper.updateTaskEnd(wcsTask);
-
-                                wmsTask.S_END_LOC = endLoc.S_CODE;
-                                wmsTask.S_END_AREA = endLoc.S_AREA_CODE;
-                                WMSHelper.UpdateTaskEnd(wmsTask);
-
-                                readCodeFeedbackResponse.verifyResult = false;
-                                readCodeFeedbackResponse.endLoc = endLoc.S_CODE;
-                            }
-                        }
-                    }
-                      
                 }
             }
             else 
+            {
+                response.code = 1;
+                response.msg = $"浠诲姟鍙凤細{model.taskNo},鏈煡璇㈠埌鎵ц涓殑浠诲姟";
+            }
+            response.data = readCodeFeedbackResponse;
+            return response;
+        }
+
+        /// <summary>
+        /// 寮傚父鐢宠锛堝彇娑堜换鍔★級
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public static ResponseResult anomalyRequest(NotifyDeviceSignalModel model) 
+        {
+            ResponseResult response = new ResponseResult();
+            readCodeFeedbackResponse readCodeFeedbackResponse = new readCodeFeedbackResponse()
+            {
+                verifyResult = true
+            };
+            var wcsTask = WCSHelper.GetTask(model.taskNo);
+            var wmsTask = WMSHelper.GetWmsTask(wcsTask.S_OP_CODE);
+            if (wcsTask != null && wmsTask != null)
+            {
+                Location endLoc = LocationHelper.GetLoc(wmsTask.S_END_LOC);   // 鍘熺粓鐐�+                if (wcsTask.S_TYPE == "婊℃枡涓嬬嚎鍏ュ簱浠诲姟")
+                {
+                    // 鏌ヨ鎺掑嚭鍙�+                    var middleLoc = WMSHelper.getMinTaskMiddleLoc(1, 0, endLoc.N_ROADWAY);
+                    wcsTask.S_END_LOC = middleLoc.S_CODE;
+                    wcsTask.S_END_AREA = middleLoc.S_AREA_CODE;
+                    WCSHelper.updateTaskEnd(wcsTask);
+                    readCodeFeedbackResponse.verifyResult = false;
+                    readCodeFeedbackResponse.endLoc = middleLoc.S_CODE;
+
+                    // 鏌ヨ鏂扮粓鐐�+                    endLoc = WMSHelper.getOnlneLoc(2);
+                }
+                else if (wcsTask.S_TYPE == "鑳氳儙鍙枡鍑哄簱浠诲姟")
+                {
+                    endLoc = WMSHelper.getCallOutLoc(endLoc.N_ROW);
+                    readCodeFeedbackResponse.verifyResult = false;
+                    readCodeFeedbackResponse.endLoc = endLoc.S_CODE;
+                }
+                wmsTask.S_END_LOC = endLoc.S_CODE;
+                wmsTask.S_END_AREA = endLoc.S_AREA_CODE;
+                WMSHelper.UpdateTaskEnd(wmsTask);
+            }
+            else
             {
                 response.code = 1;
                 response.msg = $"浠诲姟鍙凤細{model.taskNo},鏈煡璇㈠埌鎵ц涓殑浠诲姟";
@@ -454,50 +468,43 @@
         }
 
         /// <summary>
-        /// 纭寲鏈哄懠鍙儦鑳庡嚭搴�+        /// 4.纭寲鏈哄懠鍙儦鑳庡嚭搴�+        /// 閫昏緫锛�+        /// 
         /// </summary>
         /// <param name="model"></param>
-        public static ResponseResult callItemOutStock(CallItemModel model)
+        public static ResponseResult callItemOutStock(NotifyDeviceSignalModel model)
         {
             ResponseResult response = new ResponseResult();
 
-            int locNum = model.locCodes.Count;
+            var locCodes = model.loc.Split(',').ToList();
+
+            int locNum = locCodes.Count;
             if (locNum > 0) 
             {
                 Location prevLoc = null;
                 Dictionary<string,Location> outLocDic = new Dictionary<string,Location>();
-                foreach (var mcn in model.locCodes)
+                foreach (var mcn in locCodes)
                 {
                     // 1.涓�釜纭寲鏈哄伐浣嶅彧鑳藉悓鏃跺瓨鍦ㄤ竴涓鍦ㄦ墽琛屼腑鐨勪换鍔�                     var existTask = WCSHelper.GetTaskByEnd(mcn);
                     if (existTask.Count == 0) 
                     {
-                        // 2.鏍规嵁褰撳墠鏃堕棿锛屽垽鏂彮娆℃棩鏈熷拰鐝
-                        var currentTime = DateTime.Now;
-                        var shift = getShift(currentTime.TimeOfDay);  // 鐝
-                        var dateShift = currentTime.ToString("dd/MM/yyyy");
-                        TimeSpan shiftIII_Start = new TimeSpan(7, 00, 0); // 7:00:00
-                        if (shift == "III" && currentTime.TimeOfDay < shiftIII_Start)
+                        // 2.鏍规嵁鐝鏃ユ湡+鐝+纭寲鏈哄伐浣嶅彿鏌ヨ鏈�柊鐨勭~鍖栨満宸ュ崟
+                        var shift = ApiHelper.getShift(DateTime.Now.TimeOfDay);
+                        string planStartDate = shift == "III" ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : DateTime.Now.ToString("yyyy-MM-dd");
+                        var productionShedule = WMSHelper.getProductionShedule(mcn, shift , planStartDate);
+                        if (productionShedule.SCHSTATUS == 1 && productionShedule.N_4M == 0) 
                         {
-                            dateShift = DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy");
-                        }
-
-                        // 3.鏍规嵁鐝鏃ユ湡+鐝+纭寲鏈哄伐浣嶅彿鏌ヨ 纭寲鏈哄伐鍗�涓殑鐗╂枡缂栫爜銆侀璁$敓浜ф暟閲�-                        var productionShedule = WMSHelper.getProductionShedule(dateShift, mcn, shift);
-
-                        if (productionShedule != null && productionShedule.QTY != 0)
-                        {
-                            // 4鏌ヨ銆愯儦鑳庡凡瀹屾垚鐨勬潯鐮佷腑闂磋〃銆戝苟璁$畻褰撳墠鐝鐨勫凡瀹屾垚鏁伴噺
-                            int finishNum = WMSHelper.getEmbryoFinishNum(dateShift, mcn, shift);
-                            if (productionShedule.QTY > finishNum)
+                            var startLoc = WMSHelper.getOutStockStartLoc(productionShedule.ITEMCODE,prevLoc);
+                            if (startLoc != null)
                             {
-                                // 5.鍑哄簱绛栫暐 1.浼樺厛鏌ヨ鍓嶄竴鎷栬揣浣嶇殑宸﹀彸涓よ竟鏄惁婊¤冻鏉′欢  2.璁$畻锛�.宸烽亾涓嶆姤璀︺�2.鐗╂枡鐘舵�OK銆�.灏忎簬澶辨晥鏃堕棿 澶т簬绛変簬鐢熸晥鏃堕棿 4.鍔犳�鏂欏厛鍑恒�5.鍏堝叆鍏堝嚭锛堢敓浜ф椂闂达級锛夊嚭搴撶墿鏂欙紝鐢熸垚浠诲姟
-                                var startLoc = WMSHelper.getOutStockStartLoc(productionShedule.ITEMCODE, prevLoc);
-                                if (startLoc != null) 
-                                {
-                                    outLocDic.Add(mcn, startLoc);
-                                    prevLoc = startLoc;
-                                }
+                                prevLoc = startLoc;
+                                outLocDic.Add(mcn, startLoc);
+                            }
+                            else 
+                            {
+                                LogHelper.Info($"纭寲鏈哄彨鏂欙紝鏈煡璇㈠埌寮�璐т綅锛佺墿鏂欑紪鐮侊細{productionShedule.ITEMCODE}", "WMS");
                             }
                         }
                     }
@@ -584,96 +591,33 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        public static ResponseResult emptyTrayInStock(EmptyTrayInStockModel model) 
+        public static ResponseResult emptyTrayInStock(NotifyDeviceSignalModel model) 
         {
             ResponseResult response = new ResponseResult();
-            Location startLoc = LocationHelper.GetLoc(model.startLoc);
-            var endLocGroup = WMSHelper.getInStockEndLoc(1,null);
-            if (endLocGroup.endLocList.Count == 1)
-            {
-                Location endLoc = endLocGroup.endLocList[0];
-                var wmsTask = new WMSTask()
-                {
-                    S_CNTR_CODE = model.trayCode,
-                    S_CODE = WMSHelper.GenerateTaskNo(),
-                    S_START_LOC = startLoc.S_CODE,
-                    S_START_AREA = startLoc.S_AREA_CODE,
-                    S_END_LOC = endLoc.S_CODE,
-                    S_END_AREA = endLoc.S_AREA_CODE,
-                    S_TYPE = "绌烘墭鍏ュ簱浠诲姟",
-                    S_OP_DEF_CODE = model.reqId,
-                    S_OP_DEF_NAME = "绌烘墭鐩樺洖搴撲换鍔�,
-                    N_PRIORITY = 1,
-                    T_START_TIME = DateTime.Now,
-                };
-                if (WMSHelper.CreateWmsTask(wmsTask))
-                {
-                    // 鍒涘缓涓�鍏ュ簱浠诲姟
-                    WCSTask wcsTask = new WCSTask()
-                    {
-                        S_OP_NAME = wmsTask.S_OP_DEF_NAME,
-                        S_OP_CODE = wmsTask.S_CODE,
-                        S_CODE = WCSHelper.GenerateTaskNo(),
-                        S_CNTR_CODE = wmsTask.S_CNTR_CODE,
-                        S_TYPE = wmsTask.S_TYPE,
-                        S_START_LOC = startLoc.S_CODE,
-                        S_START_AREA = startLoc.S_AREA_CODE,
-                        S_END_LOC = endLoc.S_CODE,
-                        S_END_AREA = endLoc.S_AREA_CODE,
-                        S_SCHEDULE_TYPE = "WCS",
-                        N_PRIORITY = 1,
-                        T_START_TIME = DateTime.Now,
-                    };
+            Location startLoc = LocationHelper.GetLoc(model.loc);
 
-                    if (WCSHelper.CreateTask(wcsTask))
-                    {
-                        // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�-                        LocationHelper.LockLoc(wcsTask.S_START_LOC, 2);
-                        LocationHelper.LockLoc(wcsTask.S_END_LOC, 1);
-
-                        // 鏇存柊浣滀笟浠诲姟鐘舵�
-                        wmsTask.N_B_STATE = 1;
-                        WMSHelper.UpdateTaskState(wmsTask);
-                    }
-                }
-            }
-            else
+            var cntrCodeList = model.loc.Split(',').ToList();
+            if (cntrCodeList.Count > 0) 
             {
-                response.code = 1;
-                response.msg = "搴撳尯娌℃湁鍙叆鐨勭┖璐т綅";
-            }
-            return response;
-        }
-
-        /// <summary>
-        /// 鍛煎彨绌烘墭鍑哄簱
-        /// </summary>
-        /// <returns></returns>
-        public static ResponseResult callEmptyTrayOutStock(CallEmptyTrayOutStockModel model) 
-        {
-            ResponseResult responseResult = new ResponseResult();
-            Location startLoc = WMSHelper.getOutStockStartLoc(null);
-            if (startLoc != null) 
-            {
-                Location endLoc = LocationHelper.GetLoc(model.endLoc);
-                if (endLoc != null)
+                var endLocGroup = WMSHelper.getInStockEndLoc(cntrCodeList.Count, null);
+                if (endLocGroup.endLocList.Count > 0)
                 {
-                    var locCntrRels = LocationHelper.GetLocCntr(startLoc.S_CODE);
-                    if (locCntrRels != null && locCntrRels.Count > 0)
+                    foreach (var endLoc in endLocGroup.endLocList)
                     {
                         var wmsTask = new WMSTask()
                         {
-                            S_CNTR_CODE = locCntrRels[0].S_CNTR_CODE,
+                            S_CNTR_CODE = model.cntrNo,
                             S_CODE = WMSHelper.GenerateTaskNo(),
                             S_START_LOC = startLoc.S_CODE,
                             S_START_AREA = startLoc.S_AREA_CODE,
                             S_END_LOC = endLoc.S_CODE,
                             S_END_AREA = endLoc.S_AREA_CODE,
-                            S_TYPE = "鍛煎彨绌烘墭鍑哄簱",
+                            S_TYPE = "绌烘墭鍏ュ簱浠诲姟",
                             S_OP_DEF_CODE = model.reqId,
-                            S_OP_DEF_NAME = "鍛煎彨绌烘墭鍑哄簱",
+                            S_OP_DEF_NAME = "绌烘墭鐩樺洖搴撲换鍔�,
                             N_PRIORITY = 1,
-                            T_START_TIME = DateTime.Now
+                            T_START_TIME = DateTime.Now,
+                            S_GROUP_NO = endLocGroup.groupNo,
                         };
                         if (WMSHelper.CreateWmsTask(wmsTask))
                         {
@@ -707,16 +651,92 @@
                         }
                     }
                 }
-                else 
+                else
                 {
-                    responseResult.code = 1;
-                    responseResult.msg = $"缁堢偣璐т綅:{model.endLoc}鍦╓MS绯荤粺涓笉瀛樺湪";
+                    response.code = 1;
+                    response.msg = "搴撳尯娌℃湁鍙叆鐨勭┖璐т綅";
                 }
             }
-            else 
+            
+            return response;
+        }
+
+        /// <summary>
+        /// 鍛煎彨绌烘墭鍑哄簱
+        /// </summary>
+        /// <returns></returns>
+        public static ResponseResult callEmptyTrayOutStock(NotifyDeviceSignalModel model) 
+        {
+            ResponseResult responseResult = new ResponseResult();
+            int executeNum = 0;
+            string startLocCode = null;
+            for (int i = 1; i <= 2; i++) 
+            {
+                Location startLoc = WMSHelper.getOutStockStartLoc(startLocCode);
+                if (startLoc != null)
+                {
+                    startLocCode = startLoc.S_CODE;
+                    Location endLoc = WMSHelper.getMinTaskMiddleLoc(1, 0, startLoc.N_ROADWAY);
+                    if (endLoc != null)
+                    {
+                        var locCntrRels = LocationHelper.GetLocCntr(startLoc.S_CODE);
+                        if (locCntrRels != null && locCntrRels.Count > 0)
+                        {
+                            var wmsTask = new WMSTask()
+                            {
+                                S_CNTR_CODE = locCntrRels[0].S_CNTR_CODE,
+                                S_CODE = WMSHelper.GenerateTaskNo(),
+                                S_START_LOC = startLoc.S_CODE,
+                                S_START_AREA = startLoc.S_AREA_CODE,
+                                S_END_LOC = endLoc.S_CODE,
+                                S_END_AREA = endLoc.S_AREA_CODE,
+                                S_TYPE = "鍛煎彨绌烘墭鍑哄簱",
+                                S_OP_DEF_CODE = model.reqId,
+                                S_OP_DEF_NAME = "鍛煎彨绌烘墭鍑哄簱",
+                                N_PRIORITY = 1,
+                                T_START_TIME = DateTime.Now
+                            };
+                            if (WMSHelper.CreateWmsTask(wmsTask))
+                            {
+                                // 鍒涘缓涓�鍏ュ簱浠诲姟
+                                WCSTask wcsTask = new WCSTask()
+                                {
+                                    S_OP_NAME = wmsTask.S_OP_DEF_NAME,
+                                    S_OP_CODE = wmsTask.S_CODE,
+                                    S_CODE = WCSHelper.GenerateTaskNo(),
+                                    S_CNTR_CODE = wmsTask.S_CNTR_CODE,
+                                    S_TYPE = wmsTask.S_TYPE,
+                                    S_START_LOC = startLoc.S_CODE,
+                                    S_START_AREA = startLoc.S_AREA_CODE,
+                                    S_END_LOC = endLoc.S_CODE,
+                                    S_END_AREA = endLoc.S_AREA_CODE,
+                                    S_SCHEDULE_TYPE = "WCS",
+                                    N_PRIORITY = 1,
+                                    T_START_TIME = DateTime.Now,
+                                };
+
+                                if (WCSHelper.CreateTask(wcsTask))
+                                {
+                                    // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�+                                    LocationHelper.LockLoc(wcsTask.S_START_LOC, 2);
+                                    LocationHelper.LockLoc(wcsTask.S_END_LOC, 1);
+
+                                    // 鏇存柊浣滀笟浠诲姟鐘舵�
+                                    wmsTask.N_B_STATE = 1;
+                                    WMSHelper.UpdateTaskState(wmsTask);
+
+                                    executeNum += 1;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+            if (executeNum < 1) 
             {
                 responseResult.code = 1;
-                responseResult.msg = "搴撳唴绌烘墭涓嶈冻";
+                responseResult.msg = "绔嬪簱鍐呯┖鎵樼洏鏁伴噺涓嶈冻";
             }
             return responseResult;
         }
@@ -725,9 +745,9 @@
         /// 鑳氳儙鎶芥鍑哄簱
         /// </summary>
         /// <returns></returns>
-        public static ResponseResult embryoCheckOutStock(EmbryoCheckOutStockModel model) 
+        public static SimpleResult embryoCheckOutStock(EmbryoCheckOutStockModel model) 
         {
-            ResponseResult responseResult = new ResponseResult();
+            SimpleResult result = new SimpleResult();
             var locCntrs = LocationHelper.GetLocCntrRelByCntr(model.trayCode);
             if (locCntrs.Count == 1)
             {
@@ -783,7 +803,7 @@
                     }
                 }
             }
-            return responseResult;
+            return result;
         }
 
         /// <summary>
@@ -791,11 +811,11 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        public static ResponseResult anomalyTrayInStock(AnomalyTrayInStockModel model) 
+        public static ResponseResult anomalyTrayInStock(NotifyDeviceSignalModel model) 
         {
             ResponseResult responseResult = new ResponseResult();
-            LocationHelper.UnBindingLoc(model.startLoc, new List<string>() { model.trayCode });
-            ContainerHelper.deleteCntrItemRelByCntr(model.trayCode);
+            LocationHelper.UnBindingLoc(model.loc, new List<string>() { model.cntrNo });
+            ContainerHelper.deleteCntrItemRelByCntr(model.cntrNo);
             return responseResult;
         }
 
@@ -878,6 +898,157 @@
                     }
                 }
             }
+            return responseResult;
+        }
+
+        /// <summary>
+        /// 鍚屾鎴愬瀷鑳氳儙鐗╂枡淇℃伅
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        public static ReturnResult synMatlInformation(List<BarcodeInfoModel> models)
+        {
+            ReturnResult responseResult = new ReturnResult();
+            List<GreenTireInformation> greenTireInfoList = new List<GreenTireInformation>();
+            CultureInfo enGB = new CultureInfo("en-GB");
+            foreach (BarcodeInfoModel matl in models)
+            {
+                GreenTireInformation greenTireInfo = new GreenTireInformation()
+                {
+                    ITEMCODE = matl.itemcode,
+                    BARCODE = matl.barcode,
+                    MCN = matl.mcn,
+                    TXNDATE = matl.txndate,
+                    DATE_SHIFT = matl.date_shift,
+                    QTY = matl.qty,
+                    JDGE = matl.jdge,
+                    OVERAGE = matl.overage,
+                    MINHOUR = matl.minhour,
+                    INNER_DIAMETER = matl.inner_diameter,
+                    LAST_MODIFY_TIME = DateTime.Parse(matl.last_modify_time)
+                };
+                greenTireInfoList.Add(greenTireInfo);
+            }
+
+            var bo = WMSHelper.batchAddItemBarcodeInfo(greenTireInfoList);
+            if (!bo)
+            {
+                responseResult.ResultCode = 1;
+                responseResult.ResultMsg = "鍚屾鎴愬瀷鑳氳儙鐗╂枡淇℃伅澶辫触";
+            }
+            return responseResult;
+        }
+
+        /// <summary>
+        /// 鍚屾纭寲宸ュ崟琛�+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        public static ReturnResult synProductionShedule(List<ProductionSheduleModel> models)
+        {
+            ReturnResult responseResult = new ReturnResult();
+            List<ProductionShedule> productionShedules = new List<ProductionShedule>();
+            CultureInfo enGB = new CultureInfo("en-GB");
+            foreach (ProductionSheduleModel matl in models)
+            {
+                ProductionShedule productionShedule = new ProductionShedule()
+                {
+                    CUR_MCN = matl.cur_mcn,
+                    SCHSTATUS = matl.schstatus,
+                    N_4M = matl.n_4m,
+                    CUR_PLANSTARTDATE = matl.cur_planstartdate,
+                    CUR_SHIFT = matl.cur_shift,
+                    ITEMCODE = matl.itemcode,
+                    LAST_MODIFY_TIME = DateTime.Parse(matl.last_modify_time)
+                };
+                productionShedules.Add(productionShedule);
+            }
+
+            var bo = WMSHelper.batchAddProductionInfo(productionShedules);
+            if (!bo)
+            {
+                responseResult.ResultCode = 1;
+                responseResult.ResultMsg = "鍚屾纭寲宸ュ崟琛ㄥけ璐�;
+            }
+            return responseResult;
+        }
+
+        /// <summary>
+        /// 鍚屾鏉$爜鐘舵�淇℃伅
+        /// </summary>
+        /// <param name="updateMatlStatuses"></param>
+        /// <returns></returns>
+        public static ReturnResult synBarcodeStatus(List<UpdateMatlStatus> updateMatlStatuses)
+        {
+            ReturnResult responseResult = new ReturnResult();
+            List<iWMS_semi_bld_BCstatus> list = new List<iWMS_semi_bld_BCstatus>();
+            if (updateMatlStatuses.Count > 0)
+            {
+                foreach (var item in updateMatlStatuses)
+                {
+                    iWMS_semi_bld_BCstatus bCstatus = new iWMS_semi_bld_BCstatus()
+                    {
+                        S_BC_ENTRIED = item.bc_entried,
+                        S_MCNGRP = item.mcngrp,
+                        S_JDGE = item.jdge,
+                        LAST_MODIFY_TIME = DateTime.Parse(item.last_modify_time)
+                    };
+                    list.Add(bCstatus);
+                }
+
+                var bo = WMSHelper.synBarcodeStatus(list);
+                if (!bo)
+                {
+                    responseResult.ResultCode = 1;
+                    responseResult.ResultMsg = "鍚屾鏉$爜鐘舵�淇℃伅澶辫触";
+                }
+            }
+            return responseResult;
+        }
+
+        /// <summary>
+        /// 鍚屾鏉$爜鐘舵�淇℃伅
+        /// </summary>
+        /// <param name="updateMatlStatuses"></param>
+        /// <returns></returns>
+        public static ReturnResult synSampleStatus(List<UpdateMatlStatus> updateMatlStatuses)
+        {
+            ReturnResult responseResult = new ReturnResult();
+            List<iWMS_semi_bld_BCsample> list = new List<iWMS_semi_bld_BCsample>();
+            if (updateMatlStatuses.Count > 0)
+            {
+                foreach (var item in updateMatlStatuses)
+                {
+                    iWMS_semi_bld_BCsample bCstatus = new iWMS_semi_bld_BCsample()
+                    {
+                        S_BC_ENTRIED = item.bc_entried,
+                        S_MCNGRP = item.mcngrp,
+                        S_JDGE = item.jdge,
+                        LAST_MODIFY_TIME = DateTime.Parse(item.last_modify_time)
+                    };
+                    list.Add(bCstatus);
+                }
+
+                var bo = WMSHelper.synSamplingStatus(list);
+                if (!bo)
+                {
+                    responseResult.ResultCode = 1;
+                    responseResult.ResultMsg = "鍚屾鏉$爜鐘舵�淇℃伅澶辫触";
+                }
+            }
+            return responseResult;
+        }
+
+        /// <summary>
+        /// 鏌ヨ涓婁竴娆$殑鏁版嵁鍚屾鏃堕棿
+        /// </summary>
+        /// <param name="tableType"></param>
+        /// <returns></returns>
+        public static ReturnResult findDataLastSynTime(int tableType)
+        {
+            ReturnResult responseResult = new ReturnResult();
+            var synDataTime = WMSHelper.getDataLastSynTime(tableType);
+            responseResult.data = synDataTime;
             return responseResult;
         }
 
@@ -1058,11 +1229,9 @@
 
         public class OffLineModel
         {
-            public string loc { get; set; } // 涓嬬嚎浣�-            public string rfid { get; set; } // 鎵樼洏鍙�-            public string deviceNo { get; set; } // 鏈哄彴鍙�             public int isUrgent { get; set; } // N_IS_URGENT 鏄惁鍔犳�锛�.鍚�1.鏄級
             public int isFull { get; set; } // 鏄惁婊℃嫋 0.鍚�1.鏄�+            public int needPair { get; set; } // 0.鍚� 1.鏄紙褰撳墠绌烘墭鐩樹负閰嶅鎵樼洏锛�         }
         public class AddTaskModel {
             public string From { get; set; }

--
Gitblit v1.9.1