dengjunjie
2025-10-24 101a25491c535c5fd4173e7f002aea57986512f6
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs
@@ -110,35 +110,60 @@
                    foreach (var outorder in newOutOrders)
                    {
                        bool skipOrder = false; // æ ‡è®°æ˜¯å¦è·³è¿‡è¯¥å‡ºåº“单
                        // å¦‚果这个出库单类型不等于1,属于出库退货(要入货上游传过来的数量为负数)
                        if (outorder.order_type != "1")
                        if (outorder.order_type == "1") // æ­£å¸¸å‡ºåº“单
                        {
                            CreateOutboundOrder(outorder);//创建出库单、处理库存、添加出库任务
                        }
                        else if (outorder.order_type == "2")//出库退货
                        {
                            // åˆ›å»ºå‡ºåº“退货单 - è¿™é‡Œéœ€è¦æ ¹æ®ä¸šåŠ¡é€»è¾‘å®žçŽ°
                            // æš‚时跳过或实现退货逻辑
                            continue;
                            //continue;
                            #region è½¬æ¢æˆå…¥åº“单
                            UpstreamOrderInfo order = new UpstreamOrderInfo()
                            {
                                order_no = outorder.order_no,
                                order_type = outorder.order_type,
                                warehouse_no = outorder.warehouse_no,
                                details = new List<UpstreamOrderDetail>()
                            };
                            foreach (var item in outorder.details)
                            {
                                UpstreamOrderDetail detail = new UpstreamOrderDetail()
                                {
                                    batch_num = item.batch_num,
                                    goods_no = item.goods_no,
                                    order_qty = item.order_qty,
                                    exp_date = item.exp_date,
                                };
                                order.details.Add(detail);
                            }
                            responseContent = _cabinOrderServices.CreateInboundOrder(order);
                            List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
                            if (dt_CabinOrders != null && dt_CabinOrders.Count > 0)
                                BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
                            #endregion
                        }
                        else if (outorder.order_type == "1") // æ­£å¸¸å‡ºåº“单
                        else if (outorder.order_type == "3")//报损出库
                        {
                            CreateOutboundOrder(outorder);//创建出库单、处理库存、添加出库任务
                        }
                    }
                    // æ‰¹é‡æ’入出库单和明细
                    if (_DeliveryOrders.Any())
                    {
                        BaseDal.Db.InsertNav(_DeliveryOrders).Include(x => x.Details).ExecuteCommand();
                    }
                    //if (_DeliveryOrders.Any())
                    //{
                    //    BaseDal.Db.InsertNav(_DeliveryOrders).Include(x => x.Details).ExecuteCommand();
                    //}
                    //下发出库单任务给wcs
                    Db.Ado.CommitTran();
                    var tex = CreateSupplyTask(order_no);
                    if (!tex)
                    {
                        return responseContent.Error("创建供应任务失败");
                    }
                    //var tex = CreateSupplyTask(order_no);
                    //if (!tex)
                    //{
                    //    return responseContent.Error("创建供应任务失败");
                    //}
                    return responseContent.OK($"同步出库单成功,共{_DeliveryOrders.Count}条");
                }
                catch (Exception ex)
@@ -1045,7 +1070,12 @@
                }
                #endregion
                if (supplyTask.WarehouseCode == WarehouseEnum.立库.ObjToInt().ToString("000"))
                    CreateAllocatInOut(materielInfo);//创建调拨任务
                {
                    materielInfo.Business_qty -= supplyTask.StockQuantity;
                    _basicService.MaterielInfoService.Repository.UpdateData(materielInfo);
                    if (materielInfo.Business_qty < materielInfo.MinQty)
                        CreateAllocatInOut(materielInfo);//创建调拨任务
                }
                _unitOfWorkManage.CommitTran();
                #endregion
                content.OK();