yanjinhui
2025-10-17 fc8ec59582b334316650eb5a76349b0fbaab829a
优化入库和出库单逻辑

1
已修改12个文件
已添加2个文件
1015 ■■■■ 文件已修改
新建文件夹/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/CodeChunks.db 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/CodeChunks.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/CodeChunks.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/SemanticSymbols.db 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/SemanticSymbols.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/SemanticSymbols.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_Model/Models/SquareCabin/Dt_DeliveryOrderDetail_Hty.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs 697 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/GoodsJob.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
н¨Îļþ¼Ð/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/CodeChunks.db
Binary files differ
н¨Îļþ¼Ð/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/CodeChunks.db-shm
Binary files differ
н¨Îļþ¼Ð/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/CodeChunks.db-wal
Binary files differ
н¨Îļþ¼Ð/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/SemanticSymbols.db
Binary files differ
н¨Îļþ¼Ð/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/SemanticSymbols.db-shm
Binary files differ
н¨Îļþ¼Ð/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.38.29086/SemanticSymbols.db-wal
Binary files differ
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs
@@ -17,6 +17,8 @@
        /// <returns></returns>
        WebResponseContent GetUpstreamOrder();
        WebResponseContent GetUpstreamOrder2();
        /// <summary>
        /// å…¥åº“报完成接口
@@ -32,6 +34,9 @@
        /// </summary>
        /// <returns></returns>
        WebResponseContent EdiIn();
        WebResponseContent GetCabinOrders(SaveModel saveModel);
        WebResponseContent GetCabinOrderDetail(int pageNo, string orderNo);
        WebResponseContent FeedbackIn(SaveModel saveModel);
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs
@@ -18,6 +18,7 @@
        /// <returns></returns>
        WebResponseContent GetUpstreamOutOrder();
        WebResponseContent GetUpstreamOutOrder2();
        /// <summary>
        /// ç»™ä¸‹æ¸¸wcs出库单
        /// </summary>
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_Model/Models/SquareCabin/Dt_DeliveryOrderDetail_Hty.cs
@@ -30,6 +30,10 @@
        [SugarColumn(ColumnName = "Order_qty", IsNullable = true, ColumnDescription = "出库退货时为负数")]
        public decimal Order_qty { get; set; }
        [SugarColumn(ColumnName = "Order_Outqty", IsNullable = true, ColumnDescription = "出库完成数量")]
        public decimal Order_Outqty { get; set; }
        [SugarColumn(ColumnName = "Batch_num", IsNullable = true, Length = 50, ColumnDescription = "批号")]
        public string Batch_num { get; set; }
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs
@@ -32,7 +32,6 @@
{
    public class CabinOrderServices : ServiceBase<Dt_CabinOrder, IRepository<Dt_CabinOrder>>, ICabinOrderServices
    {
        static string SearchDate = "";
        private readonly IBasicService _basicService;
        private readonly IMedicineGoodsServices _medicineGoodsServices;
@@ -54,104 +53,8 @@
            _supplyTaskService = supplyTaskService;
        }
        /// <summary>
        /// èŽ·å–ä¸Šæ¸¸ç³»ç»Ÿçš„å…¥åº“å•
        /// </summary>
        /// <param name="searchDate"></param>
        /// <returns></returns>
        //public WebResponseContent GetUpstreamOrder(DateTime searchDate)
        //{
        //    var responseContent = new WebResponseContent();
        //    try
        //    {
        //        // è¯·æ±‚地址
        //        var url = "http://127.0.0.1:9090/GYZ2/95fck/inOrder";
        //        //// è¯·æ±‚参数
        //        var requestData = new
        //        {
        //            searchDate = searchDate.ToString("yyyy-MM-dd HH:mm:ss")
        //        };
        //        // å‘起请求
        //        var result = HttpHelper.Post(url, requestData.ToJsonString());
        //        // ååºåˆ—化
        //        var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result);
        //        if (response.resultCode != "0")
        //        {
        //            // è°ƒç”¨å¼‚常接口
        //            SendErrorToUpstream(1, "", response.resultMsg ?? "上游接口返回失败", "");
        //            return responseContent.Error(response.resultMsg ?? "上游接口返回失败");
        //        }
        //        if (response.data == null || !response.data.Any())
        //        {
        //            return responseContent.OK("无新入库单数据");
        //        }
        //        Db.Ado.BeginTran();
        //        List<Dt_CabinOrder> _CabinOrders = new List<Dt_CabinOrder>();
        //        foreach (var order in response.data)
        //        {
        //            try
        //            {
        //                // æ’入入库单表
        //                var entityOrder = new Dt_CabinOrder
        //                {
        //                    Order_no = order.order_no,
        //                    Order_type = order.order_type,
        //                    Supplier_no = order.supplier_no,
        //                    Account_tiem = order.account_time,
        //                    OdrderStatus = "新建",
        //                };
        //                //var orderId = Db.Insertable(entityOrder).ExecuteReturnIdentity(); //就是返回主键ID。
        //                // æ’入入库明细表
        //                var detailEntities = order.details.Select(d => new Dt_CabinOrderDetail
        //                {
        //                    //OrderId= orderId,
        //                    Goods_no = d.goods_no,
        //                    Order_qty = d.order_qty,
        //                    Batch_num = d.batch_num,
        //                    Exp_date = d.exp_date,
        //                    Warehouse_no = d.warehouse_no,
        //                    Status = 0,
        //                }).ToList();
        //                entityOrder.Details.AddRange(detailEntities); //建立主对象与子对象的关联关系
        //                _CabinOrders.Add(entityOrder);
        //                //自己
        //                /// Db.Insertable(detailEntities).ExecuteCommand();
        //                //这里要调用一个接口将上面的信息传给wcs,然后改变状态
        //            }
        //            catch (Exception innerEx)
        //            {
        //                // é’ˆå¯¹æŸæ¡è®¢å•报错时,推送异常给上游
        //                SendErrorToUpstream(1, order.order_no, innerEx.Message, "");
        //                throw; // æŠ›å‡ºå¼‚常,让外层捕获回滚
        //            }
        //        }
        //        // æ‰¹é‡æ’入(SqlSugar自动处理主外键关系)
        //        Db.Insertable(_CabinOrders).ExecuteCommand();
        //        Db.Ado.CommitTran();
        //        //如果EdiIn完成那么就调用CompleteOrder接口
        //        return responseContent.OK("同步入库单成功");
        //    }
        //    catch (Exception ex)
        //    {
        //        // å…¨å±€å¼‚常时,也推送异常给上游
        //        SendErrorToUpstream(1, "", ex.Message, "");
        //        Db.Ado.RollbackTran();
        //        return responseContent.Error("同步失败: " + ex.Message);
        //    }
        //}
        public WebResponseContent GetCabinOrders(SaveModel saveModel)
        {
            WebResponseContent content = new WebResponseContent();
@@ -331,6 +234,12 @@
            return content;
        }
        /// <summary>
        /// èŽ·å–ä¸Šæ¸¸ç³»ç»Ÿçš„å…¥åº“å•
        /// </summary>
        /// <param name="searchDate"></param>
        /// <returns></returns>
        public WebResponseContent GetUpstreamOrder()
        {
            var responseContent = new WebResponseContent();
@@ -533,6 +442,205 @@
        }
        /// <summary>
        /// å¯¹æ²¡æœ‰è¿›è¡Œç»´æŠ¤å•†å“ä¿¡æ¯è¡¨çš„入库单进行过滤处理
        /// </summary>
        /// <returns></returns>
        public WebResponseContent GetUpstreamOrder2()
        {
            var responseContent = new WebResponseContent();
            try
            {
                // è¯·æ±‚地址
                var url = "http://121.37.118.63:80/GYZ2/95fck/inOrder";
                //if (string.IsNullOrEmpty(SearchDate)) SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                //// è¯·æ±‚参数
                var requestData = new
                {
                    //searchDate = SearchDate
                    searchDate = "2020-10-10 20:45:16"  // æ­£ç¡®çš„æ ¼å¼
                };
                //SearchDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
                var result = HttpHelper.Post(url, requestData.ToJsonString());
                var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result);
                if (response.resultCode != "0")
                {
                    SendErrorToUpstream(1, "", response.resultMsg ?? "上游接口返回失败", "");
                    return responseContent.Error(response.resultMsg ?? "上游接口返回失败");
                }
                if (response.data == null || !response.data.Any())
                    return responseContent.OK("无新入库单数据");
                var existingOrderNos = BaseDal.Db.Queryable<Dt_CabinOrder>()
                    .Select(x => x.Order_no)
                    .ToList();
                var newOrders = response.data
                    .Where(order => !existingOrderNos.Contains(order.order_no))
                    .ToList();
                if (!newOrders.Any())
                    return responseContent.OK("所有入库单已存在,无需新增");
                Db.Ado.BeginTran();
                try
                {
                    List<Dt_CabinOrder> _CabinOrders = new();
                    List<string> orderNos = new();
                    foreach (var order in newOrders)
                    {
                        bool skipOrder = false; // æ ‡è®°æ˜¯å¦è·³è¿‡è¯¥å…¥åº“单
                        var entityOrder = new Dt_CabinOrder
                        {
                            Order_no = order.order_no,
                            Order_type = order.order_type,
                            Supplier_no = order.supplier_no,
                            Account_tiem = order.account_time,
                            OdrderStatus = "新建",
                            Supplier_name = order.supplier_name,
                            Warehouse_no = order.warehouse_no,
                            Details = new List<Dt_CabinOrderDetail>()
                        };
                        foreach (var item in order.details)
                        {
                            item.order_qty = Math.Abs(item.order_qty);
                            // æŸ¥è¯¢ç‰©æ–™ä¿¡æ¯
                            var materielInfo = BaseDal.Db.Queryable<Dt_MedicineGoods>()
                                .Where(x => x.Goods_no == item.goods_no)
                                .First();
                            //  è‹¥ç‰©æ–™ä¸å­˜åœ¨æˆ– MaterielSourceType ä¸ºç©ºï¼Œåˆ™è·³è¿‡æ•´ä¸ªå…¥åº“单
                            if (materielInfo == null || !Enum.IsDefined(typeof(MaterielSourceTypeEnum), materielInfo.MaterielSourceType))
                            {
                                skipOrder = true;
                                break;
                            }
                            // åŒºåˆ†å¤§ä»¶/小件
                            if (materielInfo.MaterielSourceType == MaterielSourceTypeEnum.PurchasePart)
                            {
                                var detail = new Dt_CabinOrderDetail
                                {
                                    Reservoirarea = order.warehouse_no,
                                    Goods_no = item.goods_no,
                                    Order_qty = item.order_qty,
                                    Batch_num = item.batch_num,
                                    Exp_date = item.exp_date,
                                    OrderDetailStatus = "新建",
                                    Status = 2
                                };
                                entityOrder.Details.Add(detail);
                            }
                            else
                            {
                                Dt_CabinOrderDetail orderDetail = null;
                                var ys = item.order_qty % materielInfo.BoxQty; // ä¸èƒ½æ•´é™¤çš„æ•£ä»¶
                                var xs = item.order_qty / materielInfo.BoxQty; // æ•´ç®±æ•°é‡
                                // æœ‰æ•£ä»¶
                                if (ys > 0)
                                {
                                    orderDetail = new Dt_CabinOrderDetail
                                    {
                                        Reservoirarea = order.warehouse_no,
                                        Goods_no = item.goods_no,
                                        Order_qty = ys,
                                        Batch_num = item.batch_num,
                                        Exp_date = item.exp_date,
                                        OrderDetailStatus = "新建",
                                        Status = 0
                                    };
                                    materielInfo.Business_qty += ys;
                                }
                                // ä¸è¶³æœ€ä½Žåº“存时补入立库
                                while (materielInfo.Business_qty < materielInfo.MinQty && xs > 0)
                                {
                                    xs--;
                                    if (orderDetail == null)
                                    {
                                        orderDetail = new Dt_CabinOrderDetail
                                        {
                                            Reservoirarea = order.warehouse_no,
                                            Goods_no = item.goods_no,
                                            Order_qty = materielInfo.BoxQty,
                                            Batch_num = item.batch_num,
                                            Exp_date = item.exp_date,
                                            OrderDetailStatus = "新建",
                                            Status = 0
                                        };
                                    }
                                    else
                                    {
                                        orderDetail.Order_qty += materielInfo.BoxQty;
                                    }
                                    materielInfo.Business_qty += materielInfo.BoxQty;
                                }
                                if (orderDetail != null) entityOrder.Details.Add(orderDetail);
                                // å‰©ä½™æ•´ç®±å…¥å¹³åº“
                                if (xs > 0)
                                {
                                    entityOrder.Details.Add(new Dt_CabinOrderDetail
                                    {
                                        Reservoirarea = order.warehouse_no,
                                        Goods_no = item.goods_no,
                                        Order_qty = materielInfo.BoxQty * xs,
                                        Batch_num = item.batch_num,
                                        Exp_date = item.exp_date,
                                        OrderDetailStatus = "新建",
                                        Status = 2
                                    });
                                }
                            }
                            _medicineGoodsServices.Db.Updateable(materielInfo).ExecuteCommand();
                        }
                        // â—如果跳过该单,则直接continue,不保存
                        if (skipOrder)
                        {
                            Console.WriteLine($"跳过入库单 {order.order_no},因为存在未定义物料属性的商品。");
                            continue;
                        }
                        _CabinOrders.Add(entityOrder);
                        orderNos.Add(order.order_no);
                    }
                    if (_CabinOrders.Any())
                    {
                        BaseDal.Db.InsertNav(_CabinOrders).Include(x => x.Details).ExecuteCommand();
                        Db.Ado.CommitTran();
                        return responseContent.OK($"成功同步 {_CabinOrders.Count} æ¡å…¥åº“单");
                    }
                    else
                    {
                        Db.Ado.RollbackTran();
                        return responseContent.OK("无可处理的入库单(商品属性未定义或未找到)");
                    }
                }
                catch (Exception ex)
                {
                    Db.Ado.RollbackTran();
                    SendErrorToUpstream(1, "", ex.Message, "");
                    return responseContent.Error("同步失败: " + ex.Message);
                }
            }
            catch (Exception ex)
            {
                SendErrorToUpstream(1, "", ex.Message, "");
                return responseContent.Error("同步失败: " + ex.Message);
            }
        }
        /// <summary>
        /// ä¼ ç»™wcs
        /// </summary>
        public WebResponseContent EdiIn()
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs
@@ -5,6 +5,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.TaskEnum;
@@ -449,6 +450,306 @@
            }
        }
        /// <summary>
        /// è¿‡æ»¤æ²¡æœ‰å¯¹å•†å“è¿›è¡Œç»´æŠ¤çš„出库单进行过滤
        /// </summary>
        /// <returns></returns>
        public WebResponseContent GetUpstreamOutOrder2()
        {
            var responseContent = new WebResponseContent();
            try
            {
                var url = "http://121.37.118.63:80/GYZ2/95fck/outOrder";
                var requestData = new
                {
                    searchDate = "2022-10-10 20:45:16"
                };
                var result = HttpHelper.Post(url, requestData.ToJsonString());
                var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstramOutOrderInfo>>(result);
                if (response.resultCode != "0")
                {
                    SendErrorToUpstream(3, "", response.resultMsg ?? "上游接口返回失败", "");
                    return responseContent.Error(response.resultMsg ?? "上游接口返回失败");
                }
                if (response.data == null || !response.data.Any())
                {
                    return responseContent.OK("无新出库单数据");
                }
                // å·²å­˜åœ¨å‡ºåº“单号
                var existingOutOrderNos = BaseDal.Db.Queryable<Dt_DeliveryOrder>()
                    .Select(x => x.Out_no)
                    .ToList();
                // æ–°å‡ºåº“单
                var newOutOrders = response.data
                    .Where(outorder => !existingOutOrderNos.Contains(outorder.order_no))
                    .ToList();
                if (!newOutOrders.Any())
                {
                    return responseContent.OK("所有出库单已存在,无需新增");
                }
                Db.Ado.BeginTran();
                try
                {
                    List<Dt_DeliveryOrder> _DeliveryOrders = new List<Dt_DeliveryOrder>();
                    List<string> orderNos = new();
                    foreach (var outorder in newOutOrders)
                    {
                        bool skipOrder = false; // æ ‡è®°æ˜¯å¦è·³è¿‡è¯¥å…¥åº“单
                        var entityOrder = new Dt_DeliveryOrder
                        {
                            Out_no = outorder.order_no,
                            Out_type = outorder.order_type,
                            Client_no = outorder.client_no,
                            Client_name = outorder.client_name,
                            Account_time = outorder.account_time,
                            Warehouse_no = outorder.warehouse_no,
                            OutStatus = "未完成",
                            Details = new List<Dt_DeliveryOrderDetail>()
                        };
                        // éåŽ†å‡ºåº“æ˜Žç»†
                        foreach (var item in outorder.details)
                        {
                            //  1️⃣ è½¬ä¸ºæ­£æ•°ï¼ˆä¸Šæ¸¸å¯èƒ½ä¼ è´Ÿæ•°ï¼‰
                            item.order_qty = Math.Abs(item.order_qty);
                            decimal orderQty = (decimal)item.order_qty;
                            //  2️⃣ æŸ¥ç‰©æ–™åŸºç¡€ä¿¡æ¯ï¼ˆèŽ·å–ç®±è§„ï¼‰
                            var medication = BaseDal.Db.Queryable<Dt_MedicineGoods>()
                                .Where(m => m.Goods_no == item.goods_no)
                                .First();
                            //  è‹¥ç‰©æ–™ä¸å­˜åœ¨æˆ– MaterielSourceType ä¸ºç©ºï¼Œåˆ™è·³è¿‡æ•´ä¸ªå‡ºåº“单
                            if (medication == null || !Enum.IsDefined(typeof(MaterielSourceTypeEnum), medication.MaterielSourceType))
                            {
                                skipOrder = true;
                                break;
                            }
                            if (medication == null)
                            {
                                SendErrorToUpstream(3, "", $"找不到物料信息:{item.goods_no}", "");
                                continue;
                            }
                            decimal boxQty = medication.BoxQty <= 0 ? 1 : medication.BoxQty;
                            //  3️⃣ è®¡ç®—整件与散件数量
                            var fullBoxes = (int)(orderQty / boxQty);   // æ•´ä»¶ç®±æ•°
                            var partialQty = orderQty % boxQty;         // æ•£ä»¶æ•°é‡
                            // è‹¥ä¸Šæ¸¸ç»™äº†æ‰¹æ¬¡å·ï¼Œåˆ™ä¼˜å…ˆåŒ¹é…
                            string requestedBatch = string.IsNullOrEmpty(item.batch_num) ? null : item.batch_num;
                            // helper: æŸ¥è¯¢åº“存函数(按入库时间升序)
                            // å®šä¹‰ä¸€ä¸ªå§”托变量:输入int参数,返回List<Dt_InventoryInfo>
                            Func<int, List<Dt_InventoryInfo>> queryInventoryByStockStatus = (stockStatus) =>
                            {
                                // 1. åˆ›å»ºåŸºç¡€æŸ¥è¯¢
                                var q = BaseDal.Db.Queryable<Dt_InventoryInfo>()
                                    .Where(i => i.MaterielCode == item.goods_no &&           // ç‰©æ–™ç¼–号匹配
                                                (i.StockQuantity - i.OutboundQuantity) > 0 && // å¯ç”¨åº“å­˜>0
                                                i.StockStatus == stockStatus);               // åº“存状态匹配
                                // 2. æ¡ä»¶ç­›é€‰ï¼ˆå¦‚果有批次号要求)
                                if (!string.IsNullOrEmpty(requestedBatch))
                                    q = q.Where(i => i.BatchNo == requestedBatch);
                                // 3. æ‰§è¡ŒæŸ¥è¯¢å¹¶è¿”回结果
                                return q.OrderBy(i => i.InDate).ToList();  // æŒ‰å…¥åº“时间排序
                            };
                            // 4️⃣分配散件(优先立库 Status=0)
                            decimal remainingPartial = partialQty;
                            if (remainingPartial > 0)
                            {
                                var invList_ly = queryInventoryByStockStatus(0);
                                foreach (var inv in invList_ly)
                                {
                                    if (remainingPartial <= 0) break;
                                    decimal available = (decimal)(inv.StockQuantity - inv.OutboundQuantity);
                                    if (available <= 0) continue;
                                    decimal use = Math.Min(available, remainingPartial);
                                    var detail = new Dt_DeliveryOrderDetail
                                    {
                                        Goods_no = item.goods_no,
                                        Order_qty = use,
                                        Batch_num = inv.BatchNo,
                                        Exp_date = inv.ValidityPeriod,
                                        OotDetailStatus = "新建",
                                        Status = 0, //立库
                                        Reservoirarea = inv.LocationCode
                                    };
                                    entityOrder.Details.Add(detail);
                                    inv.OutboundQuantity += (float)use;
                                    BaseDal.Db.Updateable(inv).ExecuteCommand();
                                    remainingPartial -= use;
                                }
                                // ç«‹åº“不够 â†’ å¹³åº“è¡¥ (Status=2)
                                if (remainingPartial > 0)
                                {
                                    var invList_pk = queryInventoryByStockStatus(2);
                                    foreach (var inv in invList_pk)
                                    {
                                        if (remainingPartial <= 0) break;
                                        decimal available = (decimal)(inv.StockQuantity - inv.OutboundQuantity);
                                        if (available <= 0) continue;
                                        decimal use = Math.Min(available, remainingPartial);
                                        var detail = new Dt_DeliveryOrderDetail
                                        {
                                            Goods_no = item.goods_no,
                                            Order_qty = use,
                                            Batch_num = inv.BatchNo,
                                            Exp_date = inv.ValidityPeriod,
                                            OotDetailStatus = "新建",
                                            Status = 2, //平库
                                            Reservoirarea = inv.LocationCode
                                        };
                                        entityOrder.Details.Add(detail);
                                        inv.OutboundQuantity += (float)use;
                                        BaseDal.Db.Updateable(inv).ExecuteCommand();
                                        remainingPartial -= use;
                                    }
                                }
                                if (remainingPartial > 0)
                                {
                                    SendErrorToUpstream(3, "", $"出库单[{outorder.order_no}]物料[{item.goods_no}]散件库存不足,未分配:{remainingPartial}", "");
                                }
                            }
                            //分配整件(优先平库 Status=2)
                            int remainingFullBoxes = fullBoxes;
                            if (remainingFullBoxes > 0)
                            {
                                var invList_pk = queryInventoryByStockStatus(2);
                                foreach (var inv in invList_pk)
                                {
                                    if (remainingFullBoxes <= 0) break;
                                    decimal available = (decimal)(inv.StockQuantity - inv.OutboundQuantity);
                                    if (available < boxQty) continue;
                                    int canProvideBoxes = (int)(available / boxQty);
                                    if (canProvideBoxes <= 0) continue;
                                    int useBoxes = Math.Min(canProvideBoxes, remainingFullBoxes);
                                    decimal useQty = useBoxes * boxQty;
                                    var detail = new Dt_DeliveryOrderDetail
                                    {
                                        Goods_no = item.goods_no,
                                        Order_qty = useQty,
                                        Batch_num = inv.BatchNo,
                                        Exp_date = inv.ValidityPeriod,
                                        OotDetailStatus = "新建",
                                        Status = 2, //平库
                                        Reservoirarea = inv.LocationCode
                                    };
                                    entityOrder.Details.Add(detail);
                                    inv.OutboundQuantity += (float)useQty;
                                    BaseDal.Db.Updateable(inv).ExecuteCommand();
                                    remainingFullBoxes -= useBoxes;
                                }
                                // å¹³åº“不够 â†’ ç«‹åº“è¡¥ (Status=1)
                                if (remainingFullBoxes > 0)
                                {
                                    var invList_ly = queryInventoryByStockStatus(1);
                                    foreach (var inv in invList_ly)
                                    {
                                        if (remainingFullBoxes <= 0) break;
                                        decimal available = (decimal)(inv.StockQuantity - inv.OutboundQuantity);
                                        if (available < boxQty) continue;
                                        int canProvideBoxes = (int)(available / boxQty);
                                        if (canProvideBoxes <= 0) continue;
                                        int useBoxes = Math.Min(canProvideBoxes, remainingFullBoxes);
                                        decimal useQty = useBoxes * boxQty;
                                        var detail = new Dt_DeliveryOrderDetail
                                        {
                                            Goods_no = item.goods_no,
                                            Order_qty = useQty,
                                            Batch_num = inv.BatchNo,
                                            Exp_date = inv.ValidityPeriod,
                                            OotDetailStatus = "新建",
                                            Status = 0, //立库(补整箱)
                                            Reservoirarea = inv.LocationCode
                                        };
                                        entityOrder.Details.Add(detail);
                                        inv.OutboundQuantity += (float)useQty;
                                        BaseDal.Db.Updateable(inv).ExecuteCommand();
                                        remainingFullBoxes -= useBoxes;
                                    }
                                }
                                // â—如果跳过该单,则直接continue,不保存
                                if (skipOrder)
                                {
                                    Console.WriteLine($"跳过入库单 {outorder.order_no},因为存在未定义物料属性的商品。");
                                    continue;
                                }
                                if (remainingFullBoxes > 0)
                                {
                                    decimal unfilledQty = remainingFullBoxes * boxQty;
                                    SendErrorToUpstream(3, "", $"出库单[{outorder.order_no}]物料[{item.goods_no}]整箱库存不足,未分配数量:{unfilledQty}", "");
                                }
                            }
                        }
                        _DeliveryOrders.Add(entityOrder);
                    }
                    // æ’入主表+明细
                    BaseDal.Db.InsertNav(_DeliveryOrders)
                        .Include(x => x.Details)
                        .ExecuteCommand();
                    Db.Ado.CommitTran();
                    return responseContent.OK("同步出库单成功");
                }
                catch (Exception ex)
                {
                    Db.Ado.RollbackTran();
                    SendErrorToUpstream(3, "", ex.Message, "");
                    return responseContent.Error("同步失败: " + ex.Message);
                }
            }
            catch (Exception ex)
            {
                SendErrorToUpstream(3, "", ex.Message, "");
                return responseContent.Error("同步失败: " + ex.Message);
            }
        }
        /// <summary>
        /// å‡ºåº“单推送给 WCS
@@ -559,221 +860,67 @@
        }
        /// <summary>
        /// å‡ºåº“报完成接口
        /// </summary>
        /// <param name="out_no">出库单号</param>
        /// <returns></returns>
        //public WebResponseContent CompleteOutOrder(string out_no)
        //{
        //    var responseContent = new WebResponseContent();
        //    try
        //    {
        //        if (string.IsNullOrWhiteSpace(out_no))
        //        {
        //            return responseContent.Error("入库单号不可以为空");
        //        }
        //        Db.Ado.BeginTran();
        //        //先查头表
        //        var outOerd= BaseDal.Db.Queryable<Dt_DeliveryOrder>()
        //            .Where(o => o.Out_no == out_no)
        //            .First();
        //        if (outOerd == null)
        //        {
        //            return responseContent.Error($"没有找到该出库单号{out_no}");
        //        }
        //        //查找所有明细表是否都已完成
        //        var incompleteDetails = BaseDal.Db.Queryable<Dt_DeliveryOrderDetail>()
        //            .Where(d => d.DeliveryOrderId == outOerd.Id && d.OotDetailStatus == "已完成")
        //            .Count();
        //        if (incompleteDetails>0)
        //        {
        //            // æ›´æ–°å‡ºåº“单状态
        //            BaseDal.Db.Updateable<Dt_DeliveryOrder>()
        //              .SetColumns(o => new Dt_DeliveryOrder { OutStatus = "开始" })
        //              .Where(o => o.Out_no == out_no)
        //              .ExecuteCommand();
        //            var url = " http://127.0.0.1:9090/GYZ2/95fck/outOrderOk";
        //            var reslut = HttpHelper.Post(url, new { out_no }.ToJsonString());
        //            var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(reslut);
        //            if (response.resultCode != "0")
        //            {
        //                SendErrorToUpstream(4, "", "上游接口返回失败", "");
        //                return responseContent.Error(response.resultMsg ?? "上游接口返回失败");
        //            }
        //            Db.Ado.CommitTran();
        //            return responseContent.OK("操作成功,出库单以及明细全部完成");
        //        }
        //        else
        //        {
        //            return responseContent.OK("操作成功,但任有为完成的明细");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Db.Ado.RollbackTran();
        //        SendErrorToUpstream(1, "", ex.Message, "");
        //        return responseContent.Error("同步失败: " + ex.Message);
        //    }
        //}
        /// <summary>
        ///盘点出库单推送给 WCS
        /// </summary>
        /// <param name="externalOrderNo">出库单号</param>
        /// <returns></returns>
        //public WebResponseContent InventoryGood(string externalOrderNo)
        //{
        //    try
        //    {
        //        // æŸ¥è¯¢å‡ºåº“单及明细
        //        var orders = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>()
        //            .Where(x => x.Out_no == externalOrderNo)
        //            .Includes(o => o.Details, d => d.MedicineGoods)
        //            .ToList();
        //        if (orders == null || orders.Count == 0)
        //        {
        //            return new WebResponseContent().Error("没有找到该出库单");
        //        }
        //        var url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
        //        bool allSuccess = true;
        //        foreach (var order in orders)
        //        {
        //            //查找给商品的库存
        //            var Invert = BaseDal.Db.Queryable<Dt_Inventory>()
        //                .Where(i => i.Goods_no == order.Out_no).First();
        //            var ediDto = new TowcsDto.ToediOutInfo
        //            {
        //                customerCode = "905",
        //                materialCode = "YY",
        //                externalOrderNo = order.Out_no,
        //                outOrderType = "20", // ç›˜ç‚¹å‡ºåº“单
        //                priority = 1,
        //                Is_cancel = 0,
        //                details = order.Details.Select(d => new TowcsDto.ToeOutdiInDetail
        //                {
        //                    batchNo = d.Batch_num,
        //                    productCode = d.Goods_no,
        //                    productName = d.MedicineGoods?.Goods_spm,
        //                    productSpecifications = d.MedicineGoods?.Model,
        //                    quantity = (int)d.Order_qty,
        //                    stocktakingDetails = new List<TowcsDto.ToOutediInStock>
        //            {
        //                new TowcsDto.ToOutediInStock
        //                {
        //                    palletCode = Invert.PalletCode,  // å®žé™…从系统取
        //                    quantity = d.Order_qty.ToString()
        //                }
        //            }
        //                }).ToList()
        //            };
        //            var result = HttpHelper.Post(url, ediDto.ToJsonString());
        //            var resp = JsonConvert.DeserializeObject<TowcsDto.TowcsResponse<object>>(result);
        //            if (resp == null || resp.code != "0")
        //            {
        //                allSuccess = false;
        //                break;
        //            }
        //        }
        //        return allSuccess
        //            ? new WebResponseContent { Status = true, Message = "盘点成功" }
        //            : new WebResponseContent { Status = false, Message = "盘点失败" };
        //    }
        //    catch (Exception ex)
        //    {
        //        return new WebResponseContent { Status = false, Message = ex.Message };
        //    }
        //}
        public WebResponseContent InventoryGood(string externalOrderNo)
        //盘点 æ‹¿æ•´ä¸ªæ‰¹æ¬¡ä¿¡æ¯è¡¨çš„商品批号和商品编号来进行盘点
        public WebResponseContent InventoryGood(string batchNo, string goodsNo)
        {
            var response = new WebResponseContent();
            try
            {
                // 1. æŸ¥å‡ºå‡ºåº“单及明细
                var orders = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>()
                    .Where(x => x.Out_no == externalOrderNo)
                    .Includes(o => o.Details, d => d.MedicineGoods)
                    .ToList();
                // 1️⃣ æŸ¥æ‰¾æŒ‡å®šæ‰¹æ¬¡ä¸Žç‰©æ–™çš„库存信息
                var batchInfo = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
                    .Where(x => x.BatchNo == batchNo && x.MaterielCode == goodsNo)
                    .First();
                if (orders == null || orders.Count == 0)
                    return new WebResponseContent().Error("没有找到该出库单");
                if (batchInfo == null)
                    return response.Error($"未找到该物料 [{goodsNo}] æ‰¹æ¬¡ [{batchNo}] çš„库存信息");
                // 2. èŽ·å–æ‰€æœ‰å•†å“ç¼–å·
                var allGoodsNos = orders
                    .SelectMany(o => o.Details.Select(d => d.Goods_no))
                    .Distinct()
                    .ToList();
                // 3. ä¸€æ¬¡æ€§æŸ¥è¯¢åº“存信息
                var inventoryList = BaseDal.Db.Queryable<Dt_Inventory>()
                    .Where(i => allGoodsNos.Contains(i.Goods_no))
                    .ToList();
                var inventoryDict = inventoryList.ToDictionary(i => i.Goods_no, i => i);
                string url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
                bool allSuccess = true;
                // 4. æž„造盘点出库请求
                foreach (var order in orders)
                {
                // 2️⃣ ç»„装请求 DTO(完全符合接口文档结构)
                    var ediDto = new TowcsDto.ToediOutInfo
                    {
                        customerCode = "905",
                        materialCode = "YY",
                        externalOrderNo = order.Out_no,
                    materialCode = "YY",                              // ç‰©æ–™ç±»åž‹CODE
                    externalOrderNo = $"PDCK-{batchInfo.Id}",          // å¤–部出库单号
                        outOrderType = "20", // ç›˜ç‚¹å‡ºåº“单
                        priority = 1,
                        Is_cancel = 0,
                        details = order.Details.Select(d =>
                    details = new List<TowcsDto.ToeOutdiInDetail>
                        {
                            inventoryDict.TryGetValue(d.Goods_no, out var invert);
                            return new TowcsDto.ToeOutdiInDetail
                new TowcsDto.ToeOutdiInDetail
                            {
                                batchNo = d.Batch_num,
                                productCode = d.Goods_no,
                                productName = d.MedicineGoods?.Goods_spm,
                                productSpecifications = d.MedicineGoods?.Model,
                                quantity = (int)d.Order_qty,
                                stocktakingDetails = new List<TowcsDto.ToOutediInStock>
                        {
                            new TowcsDto.ToOutediInStock
                            {
                                palletCode = invert?.PalletCode ?? string.Empty,
                                quantity = d.Order_qty.ToString()
                    batchNo = batchInfo.BatchNo,
                    productCode = batchInfo.MaterielCode,
                    productName = batchInfo.MaterielName,
                    productSpecifications = batchInfo.MaterielSpec,
                    quantity = (int)batchInfo.SupplyQuantity,
                    //stocktakingDetails = new List<TowcsDto.ToOutediInStock>
                    //{
                    //    // ç›˜ç‚¹æ˜Žç»†å¯æ ¹æ®å®žé™…托盘拆分;此处示例仅1条
                    //    new TowcsDto.ToOutediInStock
                    //    {
                    //        palletCode = "FC00001",
                    //        quantity = batchInfo.SupplyQuantity.ToString()
                    //    }
                    //}
                            }
                        }
                            };
                        }).ToList()
                    };
                // 3️⃣ è°ƒç”¨æŽ¥å£
                string url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
                    var result = HttpHelper.Post(url, ediDto.ToJsonString());
                    var resp = JsonConvert.DeserializeObject<TowcsDto.TowcsResponse<object>>(result);
                    if (resp == null || resp.code != "0")
                    {
                        allSuccess = false;
                        break;
                    }
                }
                // 4️⃣ å“åº”处理
                if (resp == null)
                    return response.Error("WCS æ— å“åº”");
                if (resp.code != "0")
                    return response.Error($"WCS返回失败: {resp.msg}");
                return allSuccess
                    ? new WebResponseContent { Status = true, Message = "盘点成功" }
                    : new WebResponseContent { Status = false, Message = "盘点失败" };
                return response.OK("盘点出库下发成功");
            }
            catch (Exception ex)
            {
                return new WebResponseContent { Status = false, Message = ex.Message };
                return response.Error("盘点失败:" + ex.Message);
            }
        }
@@ -918,175 +1065,7 @@
        }
        //public WebResponseContent CompleteAllOutOrders()
        //{
        //    var responseContent = new WebResponseContent();
        //    try
        //    {
        //        var orders = BaseDal.Db.Queryable<Dt_DeliveryOrder>()
        //            .Where(o => o.OutStatus == "开始")
        //            .ToList();
        //        if (orders == null || !orders.Any())
        //        {
        //            return responseContent.OK("暂无需要处理的出库单");
        //        }
        //        int successCount = 0;
        //        int failCount = 0;
        //        int serverErrorCount = 0;
        //        foreach (var order in orders)
        //        {
        //            try
        //            {
        //                Db.Ado.BeginTran();
        //                var details = BaseDal.Db.Queryable<Dt_DeliveryOrderDetail>()
        //                    .Where(d => d.DeliveryOrderId == order.Id)
        //                    .ToList();
        //                var completedCount = details.Count(d => d.OotDetailStatus == "已完成");
        //                var totalCount = details.Count;
        //                if (totalCount > 0 && completedCount == totalCount)
        //                {
        //                    // æ›´æ–°çŠ¶æ€ä¸ºå·²å®Œæˆ
        //                    BaseDal.Db.Updateable<Dt_DeliveryOrder>()
        //                        .SetColumns(o => o.OutStatus == "已完成")
        //                        .Where(o => o.Id == order.Id)
        //                        .ExecuteCommand();
        //                    // è°ƒç”¨ä¸Šæ¸¸æŽ¥å£
        //                    var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
        //                    var requestDate = new
        //                    {
        //                        order_no = order.Out_no
        //                    };
        //                    string result;
        //                    try
        //                    {
        //                        result = HttpHelper.Post(url, requestDate.ToJsonString());
        //                    }
        //                    catch (Exception httpEx)
        //                    {
        //                        // HTTP请求异常(网络问题等)
        //                        Db.Ado.RollbackTran();
        //                        failCount++;
        //                        SendErrorToUpstream(3, "", $"网络请求失败: {httpEx.Message}", order.Out_no);
        //                        continue;
        //                    }
        //                    // âœ… æ£€æŸ¥æ˜¯å¦æ˜¯500错误页面
        //                    if (!string.IsNullOrEmpty(result) && result.Contains("500错误页面"))
        //                    {
        //                        Db.Ado.RollbackTran();
        //                        serverErrorCount++;
        //                        SendErrorToUpstream(5, "", "上游接口服务器内部错误(500),请联系上游系统管理员", order.Out_no);
        //                        continue;
        //                    }
        //                    // âœ… æ£€æŸ¥æ˜¯å¦æ˜¯HTML响应
        //                    if (!string.IsNullOrEmpty(result) && result.Trim().StartsWith("<"))
        //                    {
        //                        Db.Ado.RollbackTran();
        //                        failCount++;
        //                        SendErrorToUpstream(4, "", "上游接口返回非JSON格式响应", order.Out_no);
        //                        continue;
        //                    }
        //                    // âœ… å®‰å…¨è§£æžJSON
        //                    UpstreamOrderResponse response;
        //                    try
        //                    {
        //                        response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
        //                    }
        //                    catch (JsonReaderException jsonEx)
        //                    {
        //                        Db.Ado.RollbackTran();
        //                        failCount++;
        //                        SendErrorToUpstream(4, "", $"上游接口返回数据格式错误: {jsonEx.Message}", order.Out_no);
        //                        continue;
        //                    }
        //                    if (response.resultCode == "0")
        //                    {
        //                        // æˆåŠŸå¤„ç†é€»è¾‘...
        //                        var orderHistory = new Dt_DeliveryOrder_Hty
        //                        {
        //                            Id = order.Id,
        //                            Out_no = order.Out_no,
        //                            Out_type = order.Out_type,
        //                            Client_no = order.Client_no,
        //                            Client_name = order.Client_name,
        //                            Account_time = order.Account_time,
        //                            Warehouse_no = order.Warehouse_no,
        //                            OutStatus = "已完成",
        //                            Details = details.Select(d => new Dt_DeliveryOrderDetail
        //                            {
        //                                Id = d.Id,
        //                                DeliveryOrderId = d.DeliveryOrderId,
        //                                Reservoirarea = d.Reservoirarea,
        //                                Goods_no = d.Goods_no,
        //                                Order_qty = d.Order_qty,
        //                                Batch_num = d.Batch_num,
        //                                Exp_date = d.Exp_date,
        //                                OotDetailStatus = d.OotDetailStatus,
        //                                Status = d.Status
        //                            }).ToList()
        //                        };
        //                        var historyId = BaseDal.Db.Insertable(orderHistory).ExecuteReturnIdentity();
        //                        var detailHistories = details.Select(d => new Dt_DeliveryOrderDetail_Hty
        //                        {
        //                            Id = d.Id,
        //                            DeliveryOrderId = order.Id,
        //                            Reservoirarea = d.Reservoirarea,
        //                            Goods_no = d.Goods_no,
        //                            Order_qty = d.Order_qty,
        //                            Batch_num = d.Batch_num,
        //                            Exp_date = d.Exp_date,
        //                            OotDetailStatus = d.OotDetailStatus,
        //                            Status = d.Status
        //                        }).ToList();
        //                        BaseDal.Db.Insertable(detailHistories).ExecuteCommand();
        //                        BaseDal.Db.Deleteable<Dt_DeliveryOrderDetail>().Where(d => d.DeliveryOrderId == order.Id).ExecuteCommand();
        //                        BaseDal.Db.Deleteable<Dt_DeliveryOrder>().Where(o => o.Id == order.Id).ExecuteCommand();
        //                        Db.Ado.CommitTran();
        //                        successCount++;
        //                    }
        //                    else
        //                    {
        //                        Db.Ado.RollbackTran();
        //                        failCount++;
        //                        SendErrorToUpstream(4, "", $"上游接口返回失败: {response.resultMsg}", order.Out_no);
        //                    }
        //                }
        //                else
        //                {
        //                    Db.Ado.RollbackTran();
        //                }
        //            }
        //            catch (Exception ex)
        //            {
        //                Db.Ado.RollbackTran();
        //                failCount++;
        //                SendErrorToUpstream(1, "", ex.Message, order.Out_no);
        //            }
        //        }
        //        return responseContent.OK($"批量处理完成:成功 {successCount} å•,失败 {failCount} å•,服务器错误 {serverErrorCount} å•。");
        //    }
        //    catch (Exception ex)
        //    {
        //        return responseContent.Error("批量处理失败:" + ex.Message);
        //    }
        //}
        /// <summary>
        /// æŽ¨é€å¼‚常信息给上游系统 1.入库单接口;2.入库单报完成接口;3.出库单接口;4.出库报完成接口;5.药品基础信息同步接口;6.供应商信息接口;7.客户信息接口;8.库存查询接口
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_WMSServer/GoodsJob.cs
@@ -12,7 +12,7 @@
            _medicineGoodsServices = medicineGoodsServices;
        }
        //每隔1秒执行一次
        [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = true, SkipWhileExecuting = true)]
        [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = false, SkipWhileExecuting = true)]
        public void Run()
        {
            _medicineGoodsServices.GetMedicineGoodsInfom();
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs
@@ -15,7 +15,7 @@
        public void Run()
        {
            //获取上游出库单数据
            _deliveryOrderServices.GetUpstreamOutOrder();
            _deliveryOrderServices.GetUpstreamOutOrder2();
            //下发wcs
            _deliveryOrderServices.EdiOut();
            _deliveryOrderServices.CompleteAllOutOrders();
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -16,7 +16,7 @@
  //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_HUAIAN;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=10.30.4.92;Initial Catalog=WMS_TC;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //旧WMS数据库连接
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDBF_Z22;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDBF_Z22;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //跨域
  "Cors": {
    "PolicyName": "CorsIpAccess", //策略名称