yanjinhui
2025-10-24 c7f255af77f13a52e6f01c8ec81482dc9ae07f68
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs
@@ -120,7 +120,31 @@
                        {
                            // åˆ›å»ºå‡ºåº“退货单 - è¿™é‡Œéœ€è¦æ ¹æ®ä¸šåŠ¡é€»è¾‘å®žçŽ°
                            // æš‚时跳过或实现退货逻辑
                            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") // æ­£å¸¸å‡ºåº“单
                        {
@@ -129,19 +153,19 @@
                    }
                    // æ‰¹é‡æ’入出库单和明细
                    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)
@@ -1048,7 +1072,12 @@
                }
                #endregion
                if (supplyTask.WarehouseCode == WarehouseEnum.立库.ObjToInt().ToString("000"))
                {
                    materielInfo.Business_qty -= supplyTask.StockQuantity;
                    _basicService.MaterielInfoService.Repository.UpdateData(materielInfo);
                    if (materielInfo.Business_qty < materielInfo.MinQty)
                    CreateAllocatInOut(materielInfo);//创建调拨任务
                }
                _unitOfWorkManage.CommitTran();
                #endregion
                content.OK();