From f02d3a8ffc05a10a64859b2a16d5d43c8abb0fb9 Mon Sep 17 00:00:00 2001
From: xiaojiao <xiaojiao@kaokeziliao.com>
Date: 星期一, 23 三月 2026 11:13:36 +0800
Subject: [PATCH] 北京回长沙的最终版

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/BearingOutboundAction.cs |  252 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 231 insertions(+), 21 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/BearingOutboundAction.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/BearingOutboundAction.cs"
index ee5a3f9..5f0801a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/BearingOutboundAction.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA.Services/Common/BearingOutboundAction.cs"
@@ -1,10 +1,12 @@
 锘縰sing Newtonsoft.Json;
+using NPOI.HPSF;
 using System;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
 using System.Text;
 using WIDESEA.Common;
+using WIDESEA.Core.BaseProvider;
 using WIDESEA.Core.Extensions;
 using WIDESEA.Core.ManageUser;
 using WIDESEA.Core.Services;
@@ -18,6 +20,7 @@
 {
     public partial class CommonFunction
     {
+
         /// <summary>
         /// 杞存壙鍑哄簱
         /// </summary>
@@ -76,11 +79,16 @@
 
                 foreach (var item in materielinfo)
                 {
+                    //        List<VV_ContainerInfo> listContainer = VV_ContainerInfoRepository.Instance.Find(r => !r.location_islocked
+                    // && r.location_state == LocationState.LocationState_Stored.ToString() && r.containerdtl_madeUnit == Manufacturer
+                    //&& r.containerdtl_standard.Contains(zcState) && r.materiel_id == item.materiel_id && r.containerdtl_standardResult == 1
+                    // && (string.IsNullOrEmpty(r.csize_out_result) || r.csize_out_result == "鍚堟牸") && r.containerdtl_qualityCheck == true
+                    // && r.containerdtl_takeGoogsCheck == true);
+
                     List<VV_ContainerInfo> listContainer = VV_ContainerInfoRepository.Instance.Find(r => !r.location_islocked
              && r.location_state == LocationState.LocationState_Stored.ToString() && r.containerdtl_madeUnit == Manufacturer
-            && r.containerdtl_standard.Contains(zcState) && r.materiel_id == item.materiel_id && r.containerdtl_standardResult == 1
-             && (string.IsNullOrEmpty(r.csize_out_result) || r.csize_out_result == "鍚堟牸") && r.containerdtl_qualityCheck == true
-             && r.containerdtl_takeGoogsCheck == true);
+            && r.containerdtl_standard.Contains(zcState) && r.materiel_id == materiel && r.containerdtl_standardResult == 1
+             && (string.IsNullOrEmpty(r.csize_out_result) || r.csize_out_result == "鍚堟牸"));
 
                     //listContainer = listContainer.OrderBy(x => DateTime.ParseExact(x.containerdtl_ProductDate,"yyyy-MM-dd",CultureInfo.InvariantCulture)).ToList();
 
@@ -181,6 +189,157 @@
             return content;
         }
 
+        /// <summary>
+        /// 鎵嬪姩閫夐厤
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public static WebResponseContent Manual_configuration(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                //杞鏉$爜
+                string barcode = saveModel.MainData["barcode"].ToString();
+                //杞﹀瀷
+                string materiel = saveModel.MainData["materiel"].ToString();
+                //杞存壙鐘舵�佹柊鏃�
+                string zcState = saveModel.MainData["zcState"].ToString();
+                //杞存壙鍘傚
+                string Manufacturer = saveModel.MainData["Manufacturer"].ToString();
+                //鍙抽槻灏樻澘
+                string yfcbAVG = saveModel.MainData["yfcbAVG"]?.ToString();
+                //宸﹂槻灏樻澘
+                string zfcbAVG = saveModel.MainData["zfcbAVG"]?.ToString();
+                //宸︽补妗�
+                string zydAVG = saveModel.MainData["zydAVG"]?.ToString();
+                //鍙虫补妗�
+                string yydAVG = saveModel.MainData["yydAVG"]?.ToString();
+                //宸﹁酱寰�
+                string zzjAVG = saveModel.MainData["zzjAVG"]?.ToString();
+                //鍙宠酱寰�
+                string yzjAVG = saveModel.MainData["yzjAVG"]?.ToString();
+                //鍛煎彨宸ヤ綅
+                string targetStation = saveModel.MainData["targetStation"].ToString();
+                //杞存壙鏂瑰悜
+                string ZCdirection = saveModel.MainData["ZCdirection"].ToString();
+
+                //杞鍙�
+                string ldCode = saveModel.MainData["ldCode"].ToString();
+
+                // 鍚庢。鍐呭緞鍊�
+                string csize_four_3 = saveModel.MainData["csize_four_3"].ToString();
+                // 鍚庢。鍐呭緞缁撴灉
+                string csize_four_result = saveModel.MainData["csize_four_result"].ToString();
+                // 杞存壙鍐呭緞鍊�
+                string csize_in_value = saveModel.MainData["csize_in_value"].ToString();
+                // 杞存壙鍐呭緞缁撴灉
+                string csize_in_result = saveModel.MainData["csize_in_result"].ToString();
+                // 杞存壙缂栫爜
+                string Bearing_code = saveModel.MainData["Bearing_code"].ToString();
+
+                // 鑾峰彇杞存壙璇︽儏鏁版嵁鍜屾祴閲忕殑鏁版嵁
+                Dt_container_size_info_hty size_info_hty = Dt_container_size_info_htyRepository.Instance.Find(x => x.csize_barcode == Bearing_code).ToList().LastOrDefault();
+                Dt_container_detail_hty detail_hty = Dt_container_detail_htyRepository.Instance.Find(x => x.containerdtl_goodsCode == Bearing_code).ToList().LastOrDefault();
+
+                // 鏈�缁堢殑缁撴灉
+                bool Flag = false;
+
+                //宸﹀嚭搴撹酱鎵�
+                VV_ContainerInfo leftContainer = null;
+                //鍙冲嚭搴撹酱鎵�
+                VV_ContainerInfo rightContainer = null;
+                List<Dt_materielinfo> materielinfo = Dt_materielinfoRepository.Instance.Find(r => r.materiel_suitMateriel.Contains(materiel));
+
+
+                //鑾峰彇閫夐厤鏍囧噯
+                List<Dt_selection_standards> listStandard = null;
+                foreach (var item in materielinfo)
+                {
+                    listStandard = Dt_selection_standardsRepository.Instance.Find(r => r.selection_carId == item.materiel_id
+                 && r.selection_zc_manufacturer == Manufacturer && r.selection_zc_type.Contains(zcState));
+                    if (null != listStandard && listStandard.Count > 0)
+                        break;
+                }
+
+                if (listStandard.Count > 0 && listStandard != null)
+                {
+
+                    if (!(detail_hty.containerdtl_standardResult == 1))
+                    {
+                        return content.Error("绉伴噸缁撴灉涓嶆甯� 涓嶈兘杩涜鎵嬪姩閫夐厤");
+                    }
+
+                    if (!(detail_hty.containerdtl_materielid == materiel))
+                    {
+                        return content.Error("杞﹀瀷涓嶄竴鑷� 涓嶈兘杩涜鎵嬪姩閫夐厤");
+                    }
+
+                    if (!(detail_hty.containerdtl_madeUnit == Manufacturer))
+                    {
+                        return content.Error("鍘傚涓嶄竴鑷� 涓嶈兘杩涜鎵嬪姩閫夐厤");
+                    }
+
+                    if (!(detail_hty.containerdtl_standard.Contains(zcState)))
+                    {
+                        return content.Error("杞存壙鏂版棫鐘舵�佷笉涓�鑷� 涓嶈兘杩涜鎵嬪姩閫夐厤");
+                    }
+
+                    if ("left".Equals(ZCdirection))
+                    {
+                        string left_result = GetContainer2(listStandard, size_info_hty, zzjAVG, zfcbAVG, zydAVG, "left");
+                        if (left_result == "True")
+                        {
+                            Flag = true;
+                        }
+                    }
+                    else if ("right".Equals(ZCdirection))
+                    {
+                        string right_result = GetContainer2(listStandard, size_info_hty, yzjAVG, yfcbAVG, yydAVG, "right");
+                        if (right_result == "True")
+                        {
+                            Flag = true;
+                        }
+                    }
+                }
+                else
+                {
+                    return content.Error("娌℃湁閫夐厤鏍囧噯 涓嶈兘杩涜鎵嬪姩閫夐厤");
+                }
+
+                if ("all".Equal(ZCdirection))
+                {
+                    if (null == leftContainer || null == rightContainer)
+                        return content.Error("鏈壘鍒板彲鍖归厤鐨勫嚭搴撹酱鎵�,杞﹀瀷锛�" + materiel);
+                }
+
+                if (Flag)
+                {
+                    if ("left".Equals(ZCdirection))
+                    {
+                        CommonFunction.GetZCInfo2(size_info_hty, detail_hty, materiel, barcode, zfcbAVG, zydAVG, zzjAVG, ldCode, targetStation, "left", materiel);
+                    }
+
+                    if ("right".Equals(ZCdirection))
+                    {
+                        CommonFunction.GetZCInfo2(size_info_hty, detail_hty, materiel, barcode, zfcbAVG, zydAVG, zzjAVG, ldCode, targetStation, "right", materiel);
+                    }
+
+                    content.OK($"杞存壙閫夐厤鎴愬姛锛屽彲浠ヨ繘琛屽帇瑁�");
+                }
+                else
+                    return content.Error("鏈壘鍒板搴旂殑杞﹀瀷鎴栬�呮暟鎹绠楅敊璇� 涓嶈兘杩涜閫夐厤浠ュ強鍘嬭");
+            }
+            catch (Exception ex)
+            {
+                content.Error("鍒涘缓鎵嬪姩閫夐厤澶辫触:" + ex.Message);
+            }
+            finally
+            {
+                LogRecord.WriteLog((int)LogEnum.OutBound, $"{UserContext.Current.UserTrueName}杞存壙閫夐厤鍑哄簱锛氬弬鏁�:{saveModel.Serialize()},杩斿洖鍙傛暟:{content.Serialize()}");
+            }
+            return content;
+        }
         private static Dt_taskinfo GetOutboundTask(VV_ContainerInfo container, string target, string direction, object zcInfo)
         {
             Dt_locationinfo locationinfo = Dt_locationinfoRepository.Instance.FindFirst(x => x.location_id == container.location_id);
@@ -267,24 +426,24 @@
                 queryble = queryble.Where(r => r.csize_four_result != "涓嶅悎鏍�");
 
             ////娌规。
-            Dt_selection_standards ydStand = listStand.Find(r => r.selection_standard_type == "3");
-            if (null != ydStand)
-            {
-                if (!string.IsNullOrEmpty(ydAVG))
-                {
-                    //涓婇檺
-                    decimal ydStandQty_positive = ydStand.selection_positive_value.GetValueOrDefault();
-                    //涓嬮檺
-                    decimal ydStandQty_negative = ydStand.selection_negative_value.GetValueOrDefault();
-                    decimal mesStand = decimal.Parse(ydAVG);
-                    queryble = queryble.Where(r => r.csize_three_result == "鍚堟牸" && (mesStand - decimal.Parse(r.csize_three_3)) >= ydStandQty_negative
-                    && mesStand - (decimal.Parse(r.csize_three_3)) <= ydStandQty_positive);
-                }
-                else
-                    queryble = queryble.Where(r => r.csize_three_result != "涓嶅悎鏍�");
-            }
-            else
-                queryble = queryble.Where(r => r.csize_three_result != "涓嶅悎鏍�");
+            //Dt_selection_standards ydStand = listStand.Find(r => r.selection_standard_type == "3");
+            //if (null != ydStand)
+            //{
+            //    if (!string.IsNullOrEmpty(ydAVG))
+            //    {
+            //        //涓婇檺
+            //        decimal ydStandQty_positive = ydStand.selection_positive_value.GetValueOrDefault();
+            //        //涓嬮檺
+            //        decimal ydStandQty_negative = ydStand.selection_negative_value.GetValueOrDefault();
+            //        decimal mesStand = decimal.Parse(ydAVG);
+            //        queryble = queryble.Where(r => r.csize_three_result == "鍚堟牸" && (mesStand - decimal.Parse(r.csize_three_3)) >= ydStandQty_negative
+            //        && mesStand - (decimal.Parse(r.csize_three_3)) <= ydStandQty_positive);
+            //    }
+            //    else
+            //        queryble = queryble.Where(r => r.csize_three_result != "涓嶅悎鏍�");
+            //}
+            //else
+            //    queryble = queryble.Where(r => r.csize_three_result != "涓嶅悎鏍�");
 
 
 
@@ -344,6 +503,57 @@
 
             return queryble.OrderBy(r => r.containerdtl_ProductDate).ThenBy(r => r.containerdtl_createtime).FirstOrDefault();
         }
+        public static string GetContainer2(List<Dt_selection_standards> listStand, Dt_container_size_info_hty size_info_hty,
+         string zjAVG, string fcbAVG, string ydAVG, string direction)
+        {
+            //IQueryable<VV_ContainerInfo> queryble = listContainer.AsQueryable();
+
+            //杞存壙鍐呭緞
+
+            Dt_selection_standards zjStand = listStand.Find(r => r.selection_standard_type == "1");
+            if (null != zjStand)
+            {
+                if (!string.IsNullOrEmpty(zjAVG))
+                {
+                    //涓婇檺
+                    decimal zjStandQty_positive = zjStand.selection_positive_value.GetValueOrDefault();
+                    //涓嬮檺
+                    decimal zjStandQty_negative = zjStand.selection_negative_value.GetValueOrDefault();
+                    decimal mesStand = decimal.Parse(zjAVG);
+                    bool flag = size_info_hty.csize_in_result == "鍚堟牸" && mesStand - (decimal.Parse(size_info_hty.csize_in_value)) >= zjStandQty_negative
+                                && mesStand - (decimal.Parse(size_info_hty.csize_in_value)) <= zjStandQty_positive;
+                    if (!flag)
+                    {
+                        return direction + "鐨勬柟鍚� 杞存壙鍐呭緞 杩囩泩閲忎笉绗﹀悎 鍊间负," + (mesStand - (decimal.Parse(size_info_hty.csize_in_value))).ToString();
+                    }
+                }
+            }
+
+            ////闃插皹鏉�
+            Dt_selection_standards fcbStand = listStand.Find(r => r.selection_standard_type == "2");
+            if (null != fcbStand)
+            {
+
+                if (!string.IsNullOrEmpty(fcbAVG))
+                {
+                    //涓婇檺
+                    decimal fcbStandQty_positive = fcbStand.selection_positive_value.GetValueOrDefault();
+                    //涓嬮檺
+                    decimal fcbStandQty_negative = fcbStand.selection_negative_value.GetValueOrDefault();
+                    decimal mesStand = decimal.Parse(fcbAVG);
+
+                    bool flag = size_info_hty.csize_four_result == "鍚堟牸" && mesStand - (decimal.Parse(size_info_hty.csize_four_3)) >= fcbStandQty_negative
+                    && mesStand - (decimal.Parse(size_info_hty.csize_four_3)) <= fcbStandQty_positive;
+                    if (!flag)
+                    {
+                        return direction + "鐨勬柟鍚� 闃插皹鏉� 杩囩泩閲忎笉绗﹀悎 鍊间负," + (mesStand - (decimal.Parse(size_info_hty.csize_four_3))).ToString();
+                    }
+                }
+
+            }
+
+            return "True";
+        }
 
 
     }

--
Gitblit v1.9.3