| | |
| | | } |
| | | } |
| | | //䏿¥åºåºå®æ |
| | | public WebResponseContent TestOutUpload(int id,Dt_StockInfo stockInfo) |
| | | public WebResponseContent TestOutUpload(int id,List<Dt_OutStockLockInfo>? outStockLockInfos) |
| | | { |
| | | try |
| | | { |
| | | Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x=>x.Id==id).Includes(x=>x.Details).First(); |
| | | Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseId == outboundOrder.WarehouseId); |
| | | //æµè¯æ¶åºç»ERP䏿¥åºåºå®æ |
| | | ERPIssueModel issueModel = new ERPIssueModel(); |
| | | List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); |
| | | if (stockInfo==null) |
| | | List<Dt_OutStockLockInfo> _OutStockLockInfos=new List<Dt_OutStockLockInfo>(); |
| | | //æµè¯æ¶åºç»ERP䏿¥åºåºå®æ |
| | | if (outStockLockInfos.Count<=0 || outStockLockInfos==null) |
| | | { |
| | | stockInfos = TestOutStocksUpdate(warehouse).Data as List<Dt_StockInfo> ?? new List<Dt_StockInfo>(); |
| | | List<ERPPickItemModel> eRPOutPick =new List<ERPPickItemModel>(); |
| | |
| | | } |
| | | else |
| | | { |
| | | Dt_OutboundOrderDetail orderDetail = outboundOrder.Details.FirstOrDefault(x => x.MaterielCode == stockInfo.Details[0].MaterielCode); |
| | | List<ERPPickModel> eRPPickModels= new List<ERPPickModel>(); |
| | | |
| | | ERPPickItemModel pickItemModel = new ERPPickItemModel() |
| | | //è·ååºåºè¯¦æ
å |
| | | foreach (var item in outStockLockInfos) |
| | | { |
| | | Lotno = stockInfo.Details[0].BatchNo, |
| | | Qty = stockInfo.Details[0].StockQuantity.ObjToInt().ToString(), |
| | | Location = stockInfo.LocationCode |
| | | }; |
| | | ERPPickModel pickModel = new ERPPickModel() |
| | | { |
| | | Rowindex = outboundOrder.Details[0].RowNo, |
| | | Material = outboundOrder.Details[0].MaterielCode, |
| | | Qty = (outboundOrder.Details[0].OrderQuantity.ObjToInt()).ToString(), |
| | | Dataitem = new List<ERPPickItemModel> { pickItemModel } |
| | | }; |
| | | ERPPickItemModel pickItemModel = new ERPPickItemModel() |
| | | { |
| | | Lotno = item.BatchNo, |
| | | Qty = item.AssignQuantity.ObjToInt().ToString(), |
| | | Location = item.LocationCode |
| | | }; |
| | | //è·ååºåºåæç» |
| | | Dt_OutboundOrderDetail outboundOrderDetail = outboundOrder.Details.FirstOrDefault(x => x.Id == item.OrderDetailId); |
| | | ERPPickModel pickModel = new ERPPickModel() |
| | | { |
| | | Rowindex = outboundOrderDetail.RowNo, |
| | | Material = outboundOrderDetail.MaterielCode, |
| | | Qty = pickItemModel.Qty, |
| | | Dataitem = new List<ERPPickItemModel> { pickItemModel } |
| | | }; |
| | | item.Status= OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | eRPPickModels.Add(pickModel); |
| | | _OutStockLockInfos.Add(item); |
| | | } |
| | | ERPIssueItemModel issueItemModel = new ERPIssueItemModel() |
| | | { |
| | | Pickcode = outboundOrder.UpperOrderNo, |
| | | PickList = new List<ERPPickModel>() { pickModel } |
| | | PickList = eRPPickModels |
| | | }; |
| | | issueModel = new ERPIssueModel() |
| | | { |
| | |
| | | }; |
| | | } |
| | | |
| | | string response = _invokeERPService.InvokeOutStandardsApi(issueModel); |
| | | ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>(); |
| | | if (requestContent.res == 1) |
| | | if (stockInfos.Count > 0) |
| | | { |
| | | if (stockInfos.Count>0) |
| | | { |
| | | _stockInfoRepository.UpdateData(stockInfos); |
| | | } |
| | | return WebResponseContent.Instance.OK(requestContent.Data); |
| | | _stockInfoRepository.UpdateData(stockInfos); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error(requestContent.Data); |
| | | _outStockLockInfoService.Repository.UpdateData(_OutStockLockInfos); |
| | | } |
| | | //åºåºå®æä¸æ¥ERP æµè¯æ³¨é |
| | | _invokeERPService.InvokeOutStandardsApi(issueModel); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |