dengjunjie
2025-10-26 7bfa3796ce60a29c4fe2244a7b7a553149773483
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs
@@ -97,20 +97,21 @@
                    return responseContent.OK("所有入库单已存在,无需新增");
                }
                _unitOfWorkManage.BeginTran();
                try
                {
                    List<Dt_CabinOrder> _CabinOrders = new List<Dt_CabinOrder>();
                    //存储入库单号
                    List<string> orderNos = new List<string>();
                    foreach (var order in newOrders)
                    {
                    try
                    {
                        _unitOfWorkManage.BeginTran();
                        if (order.order_type == "1") //正常入库
                        {
                            responseContent = _cabinOrderServices.CreateInboundOrder(order);
                            if (!responseContent.Status) throw new Exception(responseContent.Message);
                            List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
                            if (dt_CabinOrders != null) _CabinOrders.AddRange(dt_CabinOrders);
                            if (dt_CabinOrders != null)
                                _cabinOrderServices.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
                        }
                        else if (order.order_type == "3")//入库退料
                        {
@@ -134,21 +135,16 @@
                                };
                                upstramOutOrderInfo.details.Add(detail);
                            }
                            _deliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo);
                            var content = _deliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo);
                            if (!content.Status) throw new Exception(content.Message);
                            #endregion
                        }
                        else if (order.order_type == "5")//报溢入库
                        {
                            _cabinOrderServices.CreateCheckInOrder(order);
                            var content = _cabinOrderServices.CreateCheckInOrder(order);
                            if (!content.Status) throw new Exception(content.Message);
                        }
                    };
                    _cabinOrderServices.Db.InsertNav(_CabinOrders).Include(x => x.Details).ExecuteCommand();
                    //在下发给wcs
                    //EdiIn(); //发给下游
                    //如果这个方法成功了,那么就调用CompleteOrder接口,然后改变
                    _unitOfWorkManage.CommitTran();
                    return responseContent.OK("同步入库单成功");
                }
                catch (Exception ex)
                {
@@ -156,6 +152,13 @@
                    SendErrorToUpstream(1, "", ex.Message, "");
                    return responseContent.Error("同步失败: " + ex.Message);
                }
                };
                //在下发给wcs
                //EdiIn(); //发给下游
                //如果这个方法成功了,那么就调用CompleteOrder接口,然后改变
                return responseContent.OK("同步入库单成功");
            }
            catch (Exception ex)
            {
@@ -225,7 +228,8 @@
                    {
                        if (outorder.order_type == "1") // æ­£å¸¸å‡ºåº“单
                        {
                            _deliveryOrderServices.CreateOutboundOrder(outorder);//创建出库单、处理库存、添加出库任务
                            var content = _deliveryOrderServices.CreateOutboundOrder(outorder);
                            if (!content.Status) throw new Exception(content.Message);
                        }
                        else if (outorder.order_type == "2")//出库退货
                        {
@@ -252,6 +256,7 @@
                                order.details.Add(detail);
                            }
                            responseContent = _cabinOrderServices.CreateInboundOrder(order);
                            if (!responseContent.Status) throw new Exception(responseContent.Message);
                            List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
                            if (dt_CabinOrders != null && dt_CabinOrders.Count > 0)
                                _cabinOrderServices.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
@@ -259,7 +264,8 @@
                        }
                        else if (outorder.order_type == "6")//报损出库
                        {
                            _deliveryOrderServices.CreateCheckOutOrder(outorder);
                            var content = _deliveryOrderServices.CreateCheckOutOrder(outorder);
                            if (!content.Status) throw new Exception(content.Message);
                        }
                    }