| | |
| | | { |
| | | orderdetailshtys.Add(item.Adapt<Dt_OrderOutDetails_Hty>()); |
| | | }); |
| | | //çç¹åºåº |
| | | |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound || task.TaskType == (int)TaskOutboundTypeEnum.OutAllocate) |
| | | |
| | | var allocateOrderdetail = orderDetails.Where(x => x.OrderType == (int)OrderTypeEmun.è°æ¨åºåºå).ToList(); |
| | | |
| | | await ERPAllocateOut(stock); |
| | | |
| | | //è°æ¨åºåº |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.OutAllocate) |
| | | { |
| | | if (orderDetails.Count > 0) |
| | | await ERPAllocate(orderDetails.Where(x => x.OrderType == (int)OrderTypeEmun.çç¹åºåºå || x.OrderType == (int)OrderTypeEmun.è°æ¨åºåºå).ToList()); |
| | | await ERPAllocate(orderDetails.Where(x => x.OrderType == (int)OrderTypeEmun.è°æ¨åºåºå).ToList()); |
| | | } |
| | | //å
¶ä»åºåº |
| | | else if (task.TaskType == (int)TaskOutboundTypeEnum.OutOther) |
| | |
| | | if (orderDetails.Count > 0) |
| | | { |
| | | await ERPMixedSend(orderDetails.Where(x => x.OrderType == (int)OrderTypeEmun.å
¶ä»åºåºå).ToList()); |
| | | await ERPAllocate(orderDetails.Where(x => x.OrderType == (int)OrderTypeEmun.è°æ¨åºåºå).ToList()); |
| | | } |
| | | } |
| | | //çäº§é¢æåºåº |
| | |
| | | if (orderDetails.Count > 0) |
| | | { |
| | | content = await ERPProduction(orderDetails.Where(x => x.OrderType == (int)OrderTypeEmun.çäº§é¢æå).ToList()); |
| | | await ERPAllocate(orderDetails.Where(x => x.OrderType == (int)OrderTypeEmun.è°æ¨åºåºå).ToList()); |
| | | } |
| | | } |
| | | List<DtBoxingInfo> boxingInfos = new List<DtBoxingInfo>(); |
| | | foreach (var item in allocateOrderdetail) |
| | | { |
| | | var boxingInfo = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == item.PalletCode); |
| | | if (boxingInfo == null) |
| | | { |
| | | continue; |
| | | } |
| | | var boxingdetail = boxingInfo.BoxingInfoDetails.Where(x => x.MaterielCode == item.MaterielCode); |
| | | if (boxingdetail.Count() > 0) |
| | | { |
| | | foreach (var detail in boxingdetail) |
| | | { |
| | | detail.Quantity = detail.Quantity - item.OutboundQuantity; |
| | | detail.Warehouse = "WMSåºåºç¼ååº"; |
| | | detail.WareHouseId = "205"; |
| | | } |
| | | } |
| | | boxingInfos.Add(boxingInfo); |
| | | } |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteStockInfoAsync(stock.Id); |
| | | _boxingInfoRepository.UpdateDataNav(boxingInfos); |
| | | await DeleteStockInfoDetailsAsync(stock.StockInfoDetails); |
| | | await AddStockInfoHtyAsync(stockInfo_Hty); |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result1.Item1); |
| | |
| | | return content.Error("该æçåºåå·²å¨åºåºç¼ååº"); |
| | | } |
| | | |
| | | Dt_Task taskNew = await RequestOutboundTaskAsync(new RequestTaskDto { PalletCode = palletCode, AreaId = 2, Position = stcok.LocationCode, TaskType = (int)TaskOutboundTypeEnum.Outbound }); |
| | | List<Dt_OrderOutDetails> outDetails = new List<Dt_OrderOutDetails>(); |
| | | stcok.StockInfoDetails.ForEach(x => |
| | | { |
| | | outDetails.Add(new Dt_OrderOutDetails() |
| | | { |
| | | OrderNo = "", |
| | | PalletCode = stcok.PalletCode, |
| | | OrderType = (int)OrderTypeEmun.çç¹åºåºå, |
| | | ERPOrderId = "", |
| | | MaterielCode = x.MaterielCode, |
| | | MaterielName = x.MaterielName, |
| | | AllocateWarehouse = "WMSåºåºç¼ååº", |
| | | Warehouse = "æºè½ç«åº", |
| | | WareHouseId = "107", |
| | | AllocateWarehouseId = "205", |
| | | OutboundQuantity = x.Quantity, |
| | | }); |
| | | }); |
| | | Dt_Task taskNew = await RequestOutboundTaskAsync(new RequestTaskDto { PalletCode = palletCode, AreaId = 2, Position = stcok.LocationCode, TaskType = (int)TaskOutboundTypeEnum.Outbound }); |
| | | |
| | | var taskDto = CreateListTaskDTO(taskNew); |
| | | var result = GetlcoationState(taskNew, (int)StatusChangeTypeEnum.AutomaticOutbound); |
| | |
| | | _stockInfoRepository.UpdateData(stcok); |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result.Item1); |
| | | await _locationRepository.UpdateDataAsync(result.Item2); |
| | | _orderOutDetailsRepository.AddData(outDetails); |
| | | }); |
| | | return content = await SendWCSTask(taskDto); |
| | | } |
| | |
| | | WareHouseId = "107", |
| | | AllocateWarehouseId = "", |
| | | OutboundQuantity = x.OutboundQuantity, |
| | | }); |
| | | }); |
| | | details.Where(x => x.OutboundQuantity == 0 || (x.Quantity - x.OutboundQuantity) > 0).ForEach(x => |
| | | { |
| | | outDetails.Add(new Dt_OrderOutDetails() |
| | | { |
| | | OrderNo = "", |
| | | PalletCode = stock.PalletCode, |
| | | OrderType = (int)OrderTypeEmun.è°æ¨åºåºå, |
| | | ERPOrderId = "", |
| | | MaterielCode = x.MaterielCode, |
| | | MaterielName = x.MaterielName, |
| | | AllocateWarehouse = "WMSåºåºç¼ååº", |
| | | Warehouse = "æºè½ç«åº", |
| | | WareHouseId = "107", |
| | | AllocateWarehouseId = "205", |
| | | OutboundQuantity = x.Quantity - x.OutboundQuantity, |
| | | }); |
| | | }); |
| | | stock.StockInfoDetails = details; |
| | |
| | | OutboundQuantity = x.OutboundQuantity, |
| | | }); |
| | | }); |
| | | details.Where(x => x.OutboundQuantity == 0 || (x.Quantity - x.OutboundQuantity) > 0).ForEach(x => |
| | | { |
| | | outDetails.Add(new Dt_OrderOutDetails() |
| | | { |
| | | OrderNo = "", |
| | | PalletCode = stock.PalletCode, |
| | | OrderType = (int)OrderTypeEmun.è°æ¨åºåºå, |
| | | ERPOrderId = "", |
| | | MaterielCode = x.MaterielCode, |
| | | MaterielName = x.MaterielName, |
| | | AllocateWarehouse = "WMSåºåºç¼ååº", |
| | | Warehouse = "æºè½ç«åº", |
| | | WareHouseId = "107", |
| | | AllocateWarehouseId = "205", |
| | | OutboundQuantity = x.Quantity - x.OutboundQuantity, |
| | | }); |
| | | }); |
| | | |
| | | stock.StockInfoDetails = details; |
| | | |
| | | var taskDto = CreateListTaskDTO(taskNew); |
| | |
| | | } |
| | | return wcsBasez + address; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> SendWCSTask(List<WMSTaskDTO> taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | OrgCode = "102", |
| | | UserCode = "MH0551" |
| | | }, |
| | | documentTypeCode = "TransIn002", |
| | | documentTypeCode = "LL20", |
| | | businessDate = DateTime.Now.ToString("yyyy-MM-dd"), |
| | | isApproved = true, |
| | | issueList = orderOutDetails.Select(item => new issueList |
| | | { |
| | | PickListID = item.MaterielID, |
| | | PickListID = item.ERPOrderId, |
| | | //åå¨å°ç¹ |
| | | WhCode = item.WareHouseId, |
| | | //颿æ°é |
| | |
| | | } |
| | | } |
| | | |
| | | public async Task ERPAllocateOut(DtStockInfo stock) |
| | | { |
| | | try |
| | | { |
| | | if (stock == null) |
| | | { |
| | | throw new Exception("æªæ¾å°åºåä¿¡æ¯"); |
| | | } |
| | | Allocate allocate = new Allocate |
| | | { |
| | | context = new Context |
| | | { |
| | | CultureName = "zh-CN", |
| | | EntCode = "001", |
| | | OrgCode = "102", |
| | | UserCode = "MH0551" |
| | | }, |
| | | documentTypeCode = "TransIn002", |
| | | businessDate = DateTime.Now.ToString("yyyy-MM-dd"), |
| | | isApproved = true, |
| | | |
| | | transferInList = stock.StockInfoDetails.Select(item => new transferInList |
| | | { |
| | | //ç©æç¼ç |
| | | ItemCode = item.MaterielCode, |
| | | //è°å
¥ä»åºå°å |
| | | TransInWHCode = "107", |
| | | //è°å
¥æ°é |
| | | TransInQty = item.Quantity, |
| | | // è°åºä»åºç¼ç |
| | | TransOutWHCode = "205", |
| | | }).ToList() |
| | | }; |
| | | var Allocate = GetERPIPAddress(SysConfigConst.ERPIPAddress, SysConfigConst.Allocate); |
| | | // åé请æ±å¹¶çå¾
ååº |
| | | var result = await HttpsClient.PostAsync(Allocate, allocate.ToJsonString()); |
| | | |
| | | var respone = JsonConvert.DeserializeObject<ResponeData>(result.ToString()); |
| | | if (!respone.d.ResultStatus) |
| | | { |
| | | throw new Exception(respone.d.ResultMsg); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | public async Task ERPAllocate(List<Dt_OrderOutDetails> orderOutDetails) |
| | | { |