From 5c272c606bdf2da3577dbaa5f48d0ee163f1e7d2 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 26 三月 2026 10:35:24 +0800
Subject: [PATCH] 纸张淋膜半成品入库逻辑优化

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index c5848e0..1b3794c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -365,9 +365,14 @@
                     throw new Exception($"鏈壘鍒版潯鐮亄stockInfoOld.PalletCode}涓�鏈烢RP搴撳瓨涓嶅瓨鍦�");
                 }
                 BSTStockInfoDTO bSTStockInfoDTO = bSTResponse.Data ?? throw new Exception($"涓�鏈烢RP鏈繑鍥瀧stockInfoOld.PalletCode}鐨勫簱瀛樹俊鎭�");
+                if (stockInfoOld.StockLength <= 0 || bSTStockInfoDTO.StockMeter<=0)
+                {
+                    throw new Exception($"{stockInfoOld.RfidCode}缁戝畾鏉$爜{stockInfoOld.PalletCode}搴撳瓨涓�0");
+                }
                 stockInfoOld.IsPick = WhetherEnum.False.ObjToInt();
                 decimal stockLength = bSTStockInfoDTO.StockMeter;
-                if (weight != bSTStockInfoDTO.Qty && weight < stockInfoOld.InitialWeight)
+                decimal errWeight = Math.Abs(weight - bSTStockInfoDTO.Qty);
+                if (weight != bSTStockInfoDTO.Qty && weight < stockInfoOld.InitialWeight && errWeight <= AppSettings.Get("ErrWeight").ObjToInt())
                 {
                     Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterialSourceId == stockInfoOld.MaterielId);
                     int gramWeight = (int)(materielInfo.MaterielWeight * 1000);
@@ -376,7 +381,7 @@
                         Paper_code = stockInfoOld.PalletCode,
                         Estimate_weight = bSTStockInfoDTO.Qty,
                         Actual_weight = weight,
-                        Error_weight = Math.Abs(weight - bSTStockInfoDTO.Qty),
+                        Error_weight = errWeight,
                         Weigh_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                         Operator = "LiKu",
                         Width = bSTStockInfoDTO.W,
@@ -397,6 +402,11 @@
                 stockInfoOld.StockLength = stockLength;
                 stockInfoOld.StockOutLength = 0;
                 stockInfoOld.WarehouseId = WarehouseEnum.LLDYL.ObjToInt();
+                List<Dt_OutLineView> outLineViewsDel = _outboundRepository.OutLineViewRepository.QueryData(x=>x.PalletCode==stockInfoOld.PalletCode);
+                if (outLineViewsDel.Count>0)
+                {
+                    _outboundRepository.OutLineViewRepository.DeleteData(outLineViewsDel);
+                }
                 content.OK("鎴愬姛",data:stockInfoOld);
             }
             catch (Exception ex)
@@ -964,6 +974,10 @@
                 if (count != null)
                 {
                     item.Count -= count.Count;
+                }
+                if (item.Count >= 50 && count?.Count<=2)
+                {
+                    return item.RoadwayNo;
                 }
             }
             return locationCounts.Where(x => x.Count > 0).OrderByDescending(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
@@ -2059,7 +2073,7 @@
                         NextAddress = "",
                         PalletCode = item.BarCode,
                         Roadway = "",
-                        SourceAddress = CheckPointCode.AGVStationCode,
+                        SourceAddress = item.PointCode.StartsWith("YS") ? CheckPointCode.AGVStationCode : CheckPointCode.MESPointCode,
                         TargetAddress = "",
                         TaskType = 0,
                         TaskStatus = TaskStatusEnum.New.ObjToInt(),

--
Gitblit v1.9.3