| | |
| | | private readonly IMaterielInfoService _materielInfoService; |
| | | private readonly IStockInfoService _stockService; |
| | | private readonly IStockInfoDetailService _stockDetailService; |
| | | private readonly IOutboundOrder_HtyService _outboundOrder_HtyService; |
| | | private readonly IOutboundOrderDetail_HtyService _outboundOrderDetail_HtyService; |
| | | private readonly IOutboundOrderDetailService _outboundOrderDetailService; |
| | | //private readonly ITaskService _taskService; |
| | | |
| | | public IOutboundOrderRepository Repository => BaseDal; |
| | | |
| | | public OutboundOrderService(IOutboundOrderRepository BaseDal, IMapper mapper, IMaterielInfoService materielInfoService, IStockInfoDetailService stockDetailService, IStockInfoService stockInfoService) : base(BaseDal) |
| | | public OutboundOrderService(IOutboundOrderRepository BaseDal, IMapper mapper, IMaterielInfoService materielInfoService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrder_HtyService outboundOrder_HtyService, IOutboundOrderDetail_HtyService outboundOrderDetail_HtyService, IStockInfoDetailService stockDetailService, IStockInfoService stockInfoService) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _materielInfoService = materielInfoService; |
| | | _stockDetailService = stockDetailService; |
| | | _stockService = stockInfoService; |
| | | _outboundOrder_HtyService = outboundOrder_HtyService; |
| | | _outboundOrderDetail_HtyService = outboundOrderDetail_HtyService; |
| | | _outboundOrderDetailService = outboundOrderDetailService; |
| | | //_taskService = taskService; |
| | | } |
| | | |
| | |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent AddOutboundOrders(Houseounbound orderAddDTO) |
| | | { |
| | | WebResponseContent content = new(); |
| | | try |
| | | { |
| | | OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO(); |
| | | orderAddDTO1.OrderNo = orderAddDTO.No; |
| | | orderAddDTO1.UpperOrderNo = orderAddDTO.No; |
| | | orderAddDTO1.OutWareHouse = orderAddDTO.OutWareHouse; |
| | | orderAddDTO1.TransactionCode = orderAddDTO.TransactionCode; |
| | | orderAddDTO1.OrderType = orderAddDTO.InoutType.ObjToInt(); |
| | | orderAddDTO1.Details = orderAddDTO.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>(); |
| | | #region 验证数据 |
| | | (bool, string, object?) result = CheckOutboundOrderAddData(orderAddDTO1); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | #endregion |
| | | //public WebResponseContent AddOutboundOrders(Houseounbound orderAddDTO) |
| | | //{ |
| | | // WebResponseContent content = new(); |
| | | // try |
| | | // { |
| | | // OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO(); |
| | | // orderAddDTO1.OrderNo = orderAddDTO.No; |
| | | // orderAddDTO1.UpperOrderNo = orderAddDTO.No; |
| | | // orderAddDTO1.OutWareHouse = orderAddDTO.OutWareHouse; |
| | | // orderAddDTO1.TransactionCode = orderAddDTO.TransactionCode; |
| | | // orderAddDTO1.OrderType = orderAddDTO.InoutType.ObjToInt(); |
| | | // orderAddDTO1.Details = orderAddDTO.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>(); |
| | | // #region 验证数据 |
| | | // (bool, string, object?) result = CheckOutboundOrderAddData(orderAddDTO1); |
| | | // if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | // #endregion |
| | | |
| | | Dt_OutboundOrder inboundOrder = _mapper.Map<Dt_OutboundOrder>(orderAddDTO1); |
| | | inboundOrder.OrderStatus = InboundStatusEnum.未开始.ObjToInt(); |
| | | inboundOrder.Creater = "WMS"; |
| | | inboundOrder.CreateDate = DateTime.Now; |
| | | bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | // Dt_OutboundOrder inboundOrder = _mapper.Map<Dt_OutboundOrder>(orderAddDTO1); |
| | | // inboundOrder.OrderStatus = InboundStatusEnum.未开始.ObjToInt(); |
| | | // inboundOrder.Creater = "WMS"; |
| | | // inboundOrder.CreateDate = DateTime.Now; |
| | | // bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | // content = WebResponseContent.Instance.OK(); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content = WebResponseContent.Instance.Error(ex.Message); |
| | | // } |
| | | // finally |
| | | // { |
| | | |
| | | } |
| | | return content; |
| | | } |
| | | // } |
| | | // return content; |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 单据取消 |
| | | /// 出库单据取消 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent CancelOut(HouseCancelOut houseCancelOut) |
| | |
| | | OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO(); |
| | | orderAddDTO1.OrderNo = houseCancelOut.No; |
| | | orderAddDTO1.Details = houseCancelOut.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>(); |
| | | #region 验证数据 |
| | | (bool, string, object?) result = CheckOutboundOrderAddData(orderAddDTO1); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | #endregion |
| | | Dt_OutboundOrder oldOutboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First(); |
| | | Dt_OutboundOrderDetail OutboundOrderDetail = BaseDal.Db.Queryable<Dt_OutboundOrderDetail>().Where(x => x.OrderId == oldOutboundOrder.Id).First(); |
| | | if (oldOutboundOrder == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("未找到此出库单据"); |
| | | } |
| | | if (oldOutboundOrder.OrderStatus != InboundStatusEnum.未开始.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error("该入库单任务已开始执行,不可取消"); |
| | | } |
| | | oldOutboundOrder.OrderStatus = InboundStatusEnum.取消.ObjToInt(); |
| | | BaseDal.UpdateData(oldOutboundOrder); |
| | | |
| | | Dt_OutboundOrder inboundOrder = _mapper.Map<Dt_OutboundOrder>(orderAddDTO1); |
| | | inboundOrder.OrderStatus = InboundStatusEnum.未开始.ObjToInt(); |
| | | inboundOrder.OrderType = OutOrderTypeEnum.OutInventory.ObjToInt(); |
| | | inboundOrder.Creater = "WMS"; |
| | | inboundOrder.CreateDate = DateTime.Now; |
| | | bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | Dt_OutboundOrder_Hty inboundOrder_Hty = new Dt_OutboundOrder_Hty |
| | | { |
| | | OrderStatus = oldOutboundOrder.OrderStatus, |
| | | CreateType = oldOutboundOrder.CreateType, |
| | | //SourceId = oldOutboundOrder.SourceId, |
| | | UpperOrderNo = oldOutboundOrder.UpperOrderNo, |
| | | OrderNo = oldOutboundOrder.OrderNo, |
| | | OutWareHouse = oldOutboundOrder.OutWareHouse, |
| | | TransactionCode = oldOutboundOrder.TransactionCode, |
| | | InoutType = oldOutboundOrder.InoutType, |
| | | OrderType = oldOutboundOrder.OrderType, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | _outboundOrder_HtyService.AddData(inboundOrder_Hty); |
| | | |
| | | foreach (var item in oldOutboundOrder.Details) |
| | | { |
| | | Dt_OutboundOrderDetail_Hty dt_InboundOrderDetail_Hty = new Dt_OutboundOrderDetail_Hty |
| | | { |
| | | OrderId = OutboundOrderDetail.OrderId, |
| | | MaterielCode = OutboundOrderDetail.MaterielCode, |
| | | MaterielName = OutboundOrderDetail.MaterielName, |
| | | BatchNo = OutboundOrderDetail.BatchNo, |
| | | OrderQuantity = OutboundOrderDetail.OrderQuantity, |
| | | OrderDetailStatus = OutboundOrderDetail.OrderDetailStatus, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | _outboundOrderDetail_HtyService.AddData(dt_InboundOrderDetail_Hty); |
| | | _outboundOrderDetailService.DeleteData(item); |
| | | } |
| | | BaseDal.DeleteData(oldOutboundOrder); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |