From 6b74e1dcf5642c8f56975471e27780d695953989 Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期日, 26 四月 2026 15:48:01 +0800
Subject: [PATCH] 同步代码

---
 项目代码/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/pullLock.cs |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/pullLock.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/pullLock.cs"
index 321f303..5af1993 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/pullLock.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/pullLock.cs"
@@ -34,6 +34,13 @@
                 Console.WriteLine(jsondata);
                 var result = JsonConvert.DeserializeObject<List<pullLockInfo>>(jsondata.ToString());
 
+                var lockInfo = _MESLockInfoRepository.QueryData().OrderByDescending(x => x.sequenceNo).FirstOrDefault();
+                int serial = 1;
+                if (lockInfo != null)
+                {
+                    serial = lockInfo.sequenceNo + 1;
+                }
+
                 foreach (var item in result)
                 {
                     var assemblyOrderInfo = _assemblyOrderInfoRepository.QueryFirst(x => x.workOrderNo == item.workOrderNo && x.orderType == item.workOrderType);
@@ -44,9 +51,7 @@
                     //Dt_CarBodyInfo carbodyinfo = null;
                     if (!string.IsNullOrEmpty(item.pvi))
                     {
-                        // carinfo = _palletStockInfoRepository.QueryFirst(x => x.PVI == item.pvi && x.pbMaterial == item.pbMaterial);
-                        //carbodyinfo = _carBodyRepository.QueryFirst(x => x.pbMaterial == item.pbMaterial && x.PVI == item.pvi);
-                        OutStock = _VVStockInfoRepository.QueryFirst(x => x.PVI == item.pvi /*&& x.pbMaterial == item.pbMaterial*/ && x.StockStatus == 0 && x.LockOrder == 0 && x.StayStatus == 0);
+                        OutStock = _VVStockInfoRepository.QueryFirst(x => x.PVI == item.pvi && x.StockStatus == 0 && x.LockOrder == 0 && x.StayStatus == 0 && x.CarType == (int)BodyType.PaintedBody);
                         if (OutStock == null)
                         {
                             throw new Exception($"鏈壘鍒版寚瀹歅VI杞﹁韩淇℃伅{item.pvi}");
@@ -54,11 +59,20 @@
                     }
                     else
                     {
-                        //carinfo = _palletStockInfoRepository.QueryData(x => x.pbMaterial == item.pbMaterial).OrderBy(x => x.biwInPassTime).FirstOrDefault();
-                        //carbodyinfo = _carBodyRepository.QueryData(x => x.pbMaterial == item.pbMaterial && x.BodyStatus == 0).OrderBy(x => x.biwInPassTime).FirstOrDefault();
-                        OutStock = _VVStockInfoRepository.QueryData(x => x.pbMaterial == item.pbMaterial && x.StockStatus == 0 && x.LockOrder == 0 && x.StayStatus == 0 && x.workOrderType == item.workOrderType).OrderBy(x => x.biwInPassTime).FirstOrDefault();
-                    }
+                        OutStock = _VVStockInfoRepository.QueryData(x => x.pbMaterial == item.pbMaterial && x.StockStatus == 0 && x.LockOrder == 0 && x.StayStatus == 0 && x.workOrderType == item.workOrderType && x.CarType == (int)BodyType.PaintedBody && x.RoadwayNo != lockInfo.TCLine).OrderBy(x => x.biwInPassTime).FirstOrDefault();
 
+                        if (null == OutStock)
+                        {
+                            OutStock = _VVStockInfoRepository.QueryData(x => x.pbMaterial == item.pbMaterial && x.StockStatus == 0 && x.LockOrder == 0 && x.StayStatus == 0 && x.workOrderType == item.workOrderType && x.CarType == (int)BodyType.PaintedBody).OrderBy(x => x.biwInPassTime).FirstOrDefault();
+                        }
+                        //var stockList = _VVStockInfoRepository.QueryData(x => x.pbMaterial == item.pbMaterial && x.StockStatus == 0 && x.LockOrder == 0 && x.StayStatus == 0 && x.workOrderType == item.workOrderType && x.CarType == (int)BodyType.PaintedBody).ToList();
+
+                        //if (stockList.Any())
+                        //{
+                        //    var maxStock = stockList.GroupBy(x => x.RoadwayNo).OrderByDescending(x => x.Count());
+                        //    OutStock = stockList.Where(x => x.RoadwayNo == maxStock.FirstOrDefault().Key).FirstOrDefault();
+                        //}
+                    }
                     if (OutStock == null)
                     {
                         throw new Exception("鏈尮閰嶅埌杞﹁韩,鎷夊姩閿佸畾澶辫触");
@@ -67,12 +81,12 @@
 
                     var carBody = _carBodyRepository.QueryFirst(x => x.PVI == OutStock.PVI);
 
-                    var lockInfo = _MESLockInfoRepository.QueryData().OrderByDescending(x => x.sequenceNo).FirstOrDefault();
-                    int serial = 1;
-                    if (lockInfo != null)
-                    {
-                        serial = lockInfo.sequenceNo + 1;
-                    }
+                    //var lockInfo = _MESLockInfoRepository.QueryData().OrderByDescending(x => x.sequenceNo).FirstOrDefault();
+                    //int serial = 1;
+                    //if (lockInfo != null)
+                    //{
+                    //    serial = lockInfo.sequenceNo + 1;
+                    //}
 
                     Dt_MESLockInfo mESLockInfo = new Dt_MESLockInfo
                     {

--
Gitblit v1.9.3