| | |
| | | using Microsoft.Extensions.Logging; |
| | | using SqlSugar; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.AllocateEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | |
| | | public IRepository<Dt_AllocateOrder> Repository => BaseDal; |
| | | |
| | | |
| | | public WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType) |
| | | public async Task<WebResponseContent> ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType) |
| | | { |
| | | try |
| | | { |
| | | return operateType switch |
| | | { |
| | | 1 => AddAllocateOrder(allocateOrder), |
| | | 2 => UpdateAllocateOrder(allocateOrder), |
| | | 1 => await AddAllocateOrder(allocateOrder), |
| | | 2 => await UpdateAllocateOrder(allocateOrder), |
| | | 3 => DeleteAllocateOrder(allocateOrder), |
| | | |
| | | _ => WebResponseContent.Instance.OK(), |
| | |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent AddAllocateOrder(Dt_AllocateOrder allocateOrder) |
| | | public async Task<WebResponseContent> AddAllocateOrder(Dt_AllocateOrder allocateOrder) |
| | | { |
| | | try |
| | | { |
| | |
| | | Db.InsertNav(allocateOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType)) |
| | | { |
| | | if (businessType == BusinessTypeEnum.å¤é¨ä»åºè°æºä») |
| | | if (businessType == BusinessTypeEnum.æºä»è°å¤é¨ä»åº) |
| | | { |
| | | var inboundOrders = ConvertToInboundOrders(allocateOrder); |
| | | _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1); |
| | | await _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1); |
| | | } |
| | | else if (businessType == BusinessTypeEnum.æºä»è°å¤é¨ä»åº) |
| | | else if (businessType == BusinessTypeEnum.å¤é¨ä»åºè°æºä») |
| | | { |
| | | var outboundOrders = ConvertToOutboundOrders(allocateOrder); |
| | | _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1); |
| | | await _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1); |
| | | } |
| | | else |
| | | { |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public WebResponseContent UpdateAllocateOrder(Dt_AllocateOrder model) |
| | | public async Task<WebResponseContent> UpdateAllocateOrder(Dt_AllocateOrder model) |
| | | { |
| | | try |
| | | { |
| | |
| | | InboundOrderNo=allocateOrder.OrderNo, |
| | | UpperOrderNo=allocateOrder.UpperOrderNo, |
| | | SupplierId=allocateOrder.SupplierId, |
| | | OrderType=allocateOrder.OrderType, |
| | | OrderType=InOrderTypeEnum.Allocat.ObjToInt(), |
| | | OrderStatus=allocateOrder.OrderStatus, |
| | | CreateType=allocateOrder.CreateType, |
| | | BusinessType=allocateOrder.BusinessType, |
| | |
| | | OrderDetailStatus=detail.OrderDetailStatus, |
| | | Unit=detail.Unit, |
| | | RowNo=0, |
| | | SupplyCode="", |
| | | SupplyCode=detail.SupplyCode, |
| | | WarehouseCode=detail.WarehouseCode, |
| | | Barcode=detail.Barcode, |
| | | OutBoxbarcodes="", |
| | |
| | | WarehouseId = allocateOrder.WarehouseId, |
| | | OrderNo = allocateOrder.OrderNo, |
| | | UpperOrderNo = allocateOrder.UpperOrderNo, |
| | | OrderType = allocateOrder.OrderType, |
| | | OrderType = OutOrderTypeEnum.Allocate.ObjToInt(), |
| | | OrderStatus = allocateOrder.OrderStatus, |
| | | CreateType = allocateOrder.CreateType, |
| | | BusinessType = allocateOrder.BusinessType, |
| | |
| | | OrderDetailStatus = detail.OrderDetailStatus, |
| | | Unit = detail.Unit, |
| | | RowNo = 0, |
| | | SupplyCode = "", |
| | | SupplyCode = detail.SupplyCode, |
| | | WarehouseCode = detail.WarehouseCode, |
| | | |
| | | }).ToList() |