From b532ba8806996246ab7a0896bf34b884c47dee7e Mon Sep 17 00:00:00 2001
From: xiaojiao <xiaojiao@kaokeziliao.com>
Date: 星期二, 14 四月 2026 14:06:25 +0800
Subject: [PATCH] 试生产版本

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/AddBoxContainer.cs |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/AddBoxContainer.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/AddBoxContainer.cs"
index 7923e52..0de5794 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/AddBoxContainer.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/AddBoxContainer.cs"
@@ -5,6 +5,7 @@
 using WIDESEA.Core.ManageUser;
 using WIDESEA.Entity.DomainModels;
 using WIDESEA.Services.Repositories;
+using static WIDESEA_Entity.CustomModels.RGVModel.RgvDeviceStatusModel;
 
 namespace WIDESEA.Services.Services
 {
@@ -21,13 +22,13 @@
             if (boxHead == null || boxDetail == null || goodsInfo == null)
                 throw new Exception($"娌℃湁鎵惧埌瀵逛换鍔℃墭鐩樺彿锛氥�恵taskInfo.task_barcode}銆戝搴旂殑缁勭洏淇℃伅鎴栬�呮槸褰曞叆淇℃伅");
 
-            //杩欓噷鏄幏鍙栫┖鎵樼洏閲嶉噺锛岃皟璇曞崰鏃舵敞閲�
-            Dt_container_head_hty container_Head_Hty = Dt_container_head_htyRepository.Instance.Find(x => x.containerhead_barcode == taskInfo.task_barcode
-            && x.containerhead_operatetype == "empty" && x.containerhead_creator != "WCS" && !string.IsNullOrEmpty(x.containerhead_palletweight) && "0" != x.containerhead_palletweight)
-                .OrderByDescending(x => x.containerhead_finishtime).First();
+            
+
+            //杩欓噷鑾峰彇绌烘墭鐩樼殑閲嶉噺
+            Dt_EmptyPallet dt_EmptyPallet = Dt_EmptyPalletRepository.Instance.Find(x => x.EmptyPallet_name == taskInfo.task_barcode).First();
 
 
-            if (container_Head_Hty == null)
+            if (dt_EmptyPallet == null)
                 throw new Exception($"娌℃湁鎵惧埌瀵逛换鍔℃墭鐩樺彿锛氥�恵taskInfo.task_barcode}銆戝搴旂殑绌烘墭鐩樺嚭搴撹褰�");
             //0涓嶅悎鏍�,1鍚堟牸
             int weighingResult = 0;
@@ -36,13 +37,14 @@
             if (null != standars)
             {
                 //褰撳墠杞存壙 
-                decimal currentWeighing = (decimal.Parse(taskInfo.task_weight) - decimal.Parse(container_Head_Hty.containerhead_palletweight))
+                decimal currentWeighing = (decimal.Parse(taskInfo.task_weight) - decimal.Parse(dt_EmptyPallet.EmptyPallet_palletweight))
                     + standars.weighing_addWeighing.GetValueOrDefault();
                 //鏄惁璁$畻
                 if (standars.weighing_isCompute == 1)
                 {
                     //宸紓鍊�  
-                    decimal differencWeiging = standars.weighing_standard_value.GetValueOrDefault() - currentWeighing;
+                    // decimal differencWeiging = standars.weighing_standard_value.GetValueOrDefault() - currentWeighing;
+                    decimal differencWeiging = int.Parse(goodsInfo.mesInfo_bak_3) - currentWeighing; // 鑲栦郊淇垚
                     if (differencWeiging < 0)
                     {
                         if (standars.weighing_positive_value >= -differencWeiging)
@@ -57,13 +59,17 @@
                 else
                     weighingResult = 1;
             }
+            else // 鑲栦郊鍔犵殑鍚﹀垯鍒ゆ柇
+            {
+                weighingResult = 1; 
+            }
 
             Dt_container_head conHead = new Dt_container_head();
             conHead.containerhead_id = Guid.NewGuid();
             conHead.containerhead_barcode = taskInfo.task_barcode;
             conHead.containerhead_creator = taskInfo.task_creator;
             conHead.containerhead_createtime = DateTime.Now;
-            conHead.containerhead_palletweight = container_Head_Hty.containerhead_palletweight;
+            conHead.containerhead_palletweight = dt_EmptyPallet.EmptyPallet_palletweight;
             Dt_container_headRepository.Instance.Add(conHead, true);
 
             Dt_container_detail conDetail = new Dt_container_detail();
@@ -82,11 +88,23 @@
             conDetail.containerdtl_madeUnit = goodsInfo.mesInfo_madeUnit;
             conDetail.containerdtl_number = goodsInfo.mesInfo_number;
             conDetail.containerdtl_goodsCode = goodsInfo.mesInfo_qrCode;
-            conDetail.containerdtl_goodsWeight = ((decimal.Parse(taskInfo.task_weight) - decimal.Parse(container_Head_Hty.containerhead_palletweight))
-                + standars.weighing_addWeighing.GetValueOrDefault()).ToString();
+            conDetail.Standard_value = goodsInfo.mesInfo_bak_3; // 鑲栦郊鍔犱笂杩欎釜
+
+            conDetail.containerdtl_goodsWeight = "0"; // 鑲栦郊鍔犱笂浜嗚繖涓猧f 92 - 100琛�
+            if (standars != null)
+            {
+                if (standars.weighing_isCompute == 1) 
+                {
+                    conDetail.containerdtl_goodsWeight = ((decimal.Parse(taskInfo.task_weight) - decimal.Parse(dt_EmptyPallet.EmptyPallet_palletweight))
+                    + standars.weighing_addWeighing.GetValueOrDefault()).ToString();
+                }
+            }
+            
+                
             conDetail.containerdtl_creator = taskInfo.task_creator;
             conDetail.containerdtl_createtime = DateTime.Now;
             conDetail.containerdtl_text1 = "鏈祴閲�";
+            conDetail.containerdtl_text3 = "鏈妫�";
 
             //绉伴噸缁撴灉
             conDetail.containerdtl_standardResult = weighingResult;

--
Gitblit v1.9.3