| | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | #region åºåºå®æä¸æ¥ERP |
| | | ERPPickItemModel pickItemModel = new ERPPickItemModel() |
| | | { |
| | | Lotno = model.LotNo, |
| | | Qty = model.Quantity.ToString(), |
| | | Location = warehouse.WarehouseCode |
| | | }; |
| | | ERPPickModel pickModel = new ERPPickModel() |
| | | { |
| | | Rowindex = outboundOrderDetail.RowNo, |
| | | Material = outboundOrderDetail.MaterielCode, |
| | | Qty = pickItemModel.Qty, |
| | | Dataitem = new List<ERPPickItemModel> { pickItemModel } |
| | | }; |
| | | List<ERPPickModel> eRPPickModels = new List<ERPPickModel>() { pickModel }; |
| | | ERPIssueItemModel issueItemModel = new ERPIssueItemModel() |
| | | { |
| | | Pickcode = outboundOrder.UpperOrderNo, |
| | | PickList = eRPPickModels |
| | | }; |
| | | ERPIssueModel issueModel = new ERPIssueModel() |
| | | { |
| | | UniqueTag = outboundOrderDetail.OrderId.ToString(), |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)), |
| | | WarehouseCode = warehouse.WarehouseCode, |
| | | Docremark = "", |
| | | Deptno = outboundOrder.DepartmentCode, |
| | | Deptname = outboundOrder.DepartmentName, |
| | | Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Createuser = App.User.UserName, |
| | | Issitem = new List<ERPIssueItemModel>() { issueItemModel }, |
| | | }; |
| | | _invokeERPService.InvokeOutStandardsApi(issueModel); |
| | | if (outboundOrder.OrderStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | _invokeERPService.InvokeOutStandardsApi(GetERPIssueModel(outboundOrder, warehouse.WarehouseCode)); |
| | | #endregion |
| | | content.OK(); |
| | | } |
| | |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public ERPIssueModel GetERPIssueModel(Dt_OutboundOrder outboundOrder, string WarehouseCode) |
| | | { |
| | | ERPIssueModel issueModel = new ERPIssueModel(); |
| | | try |
| | | { |
| | | List<Dt_OutStockLockInfo> stockLockInfos = _outStockLockInfoService.OutStockLockInfos(outboundOrder.OrderNo); |
| | | List<ERPPickModel> eRPPickModels = new List<ERPPickModel>(); |
| | | foreach (var item in stockLockInfos) |
| | | { |
| | | ERPPickItemModel pickItemModel = new ERPPickItemModel() |
| | | { |
| | | Lotno = item.BatchNo, |
| | | Qty = item.AssignQuantity.ObjToInt().ToString(), |
| | | Location = WarehouseCode |
| | | }; |
| | | //è·ååºåºåæç» |
| | | 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 } |
| | | }; |
| | | eRPPickModels.Add(pickModel); |
| | | } |
| | | ERPIssueItemModel issueItemModel = new ERPIssueItemModel() |
| | | { |
| | | Pickcode = outboundOrder.UpperOrderNo, |
| | | PickList = eRPPickModels |
| | | }; |
| | | issueModel = new ERPIssueModel() |
| | | { |
| | | UniqueTag = outboundOrder.Id.ToString(), |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)), |
| | | WarehouseCode = WarehouseCode, |
| | | Docremark = "", |
| | | Deptno = outboundOrder.DepartmentCode, |
| | | Deptname = outboundOrder.DepartmentName, |
| | | Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Createuser = App.User.UserName ?? stockLockInfos.FirstOrDefault().Creater, |
| | | Issitem = new List<ERPIssueItemModel>() { issueItemModel }, |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | return issueModel; |
| | | } |
| | | public WebResponseContent ReceiveOutOrder(ErpOutOrderDTO model) |
| | | { |
| | |
| | | DepartmentCode = model.DepartmentCode, |
| | | DepartmentName = model.DepartmentName, |
| | | Details = new List<Dt_OutboundOrderDetail> { outboundOrderDetail }, |
| | | Remark= model.Node |
| | | Remark = model.Node |
| | | |
| | | }; |
| | | Db.InsertNav(outboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | |
| | | MaterielName = materielInfo.MaterielName, |
| | | OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(), |
| | | OrderQuantity = model.Qty, |
| | | Unit=model.Unit, |
| | | Unit = model.Unit, |
| | | }; |
| | | |
| | | _outboundOrderDetailRepository.UpdateData(outboundOrderDetail); |
| | |
| | | Createuser = outboundOrder.Creater, |
| | | Issitem = new List<ERPIssueItemModel>() { issueItemModel }, |
| | | }; |
| | | _invokeERPService.InvokeOutStandardsApi(issueModel); |
| | | } |
| | | else |
| | | { |
| | | List<ERPPickModel> eRPPickModels = new List<ERPPickModel>(); |
| | | |
| | | //è·ååºåºè¯¦æ
å |
| | | #region MyRegion |
| | | foreach (var item in outStockLockInfos) |
| | | { |
| | | ERPPickItemModel pickItemModel = new ERPPickItemModel() |
| | | { |
| | | Lotno = item.BatchNo, |
| | | Qty = item.AssignQuantity.ObjToInt().ToString(), |
| | | Location = warehouse.WarehouseCode |
| | | }; |
| | | //è·ååºåºåæç» |
| | | 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 } |
| | | }; |
| | | if (item.OrderQuantity == item.AssignQuantity) |
| | | { |
| | | item.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | eRPPickModels.Add(pickModel); |
| | | _OutStockLockInfos.Add(item); |
| | | } |
| | | ERPIssueItemModel issueItemModel = new ERPIssueItemModel() |
| | | { |
| | | Pickcode = outboundOrder.UpperOrderNo, |
| | | PickList = eRPPickModels |
| | | }; |
| | | issueModel = new ERPIssueModel() |
| | | { |
| | | UniqueTag = id.ToString(), |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)), |
| | | WarehouseCode = warehouse.WarehouseCode, |
| | | Docremark = "", |
| | | Deptno = outboundOrder.DepartmentCode, |
| | | Deptname = outboundOrder.DepartmentName, |
| | | Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Createuser = outStockLockInfos.FirstOrDefault().Creater, |
| | | Issitem = new List<ERPIssueItemModel>() { issueItemModel }, |
| | | }; |
| | | #endregion |
| | | |
| | | #region MyRegion |
| | | //List<ERPPickModel> eRPPickModels = new List<ERPPickModel>(); |
| | | |
| | | ////è·ååºåºè¯¦æ
å |
| | | //foreach (var item in outStockLockInfos) |
| | | //{ |
| | | // ERPPickItemModel pickItemModel = new ERPPickItemModel() |
| | | // { |
| | | // Lotno = item.BatchNo, |
| | | // Qty = item.AssignQuantity.ObjToInt().ToString(), |
| | | // Location = warehouse.WarehouseCode |
| | | // }; |
| | | // //è·ååºåºåæç» |
| | | // 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 } |
| | | // }; |
| | | // if (item.OrderQuantity == item.AssignQuantity) |
| | | // { |
| | | // item.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | // } |
| | | // eRPPickModels.Add(pickModel); |
| | | // _OutStockLockInfos.Add(item); |
| | | //} |
| | | //ERPIssueItemModel issueItemModel = new ERPIssueItemModel() |
| | | //{ |
| | | // Pickcode = outboundOrder.UpperOrderNo, |
| | | // PickList = eRPPickModels |
| | | //}; |
| | | //issueModel = new ERPIssueModel() |
| | | //{ |
| | | // UniqueTag = id.ToString(), |
| | | // Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)), |
| | | // WarehouseCode = warehouse.WarehouseCode, |
| | | // Docremark = "", |
| | | // Deptno = outboundOrder.DepartmentCode, |
| | | // Deptname = outboundOrder.DepartmentName, |
| | | // Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | // Createuser = outStockLockInfos.FirstOrDefault().Creater, |
| | | // Issitem = new List<ERPIssueItemModel>() { issueItemModel }, |
| | | //}; |
| | | #endregion |
| | | } |
| | | |
| | | if (stockInfos.Count > 0) |
| | |
| | | _outStockLockInfoService.Repository.UpdateData(_OutStockLockInfos); |
| | | } |
| | | //åºåºå®æä¸æ¥ERP æµè¯æ³¨é |
| | | _invokeERPService.InvokeOutStandardsApi(issueModel); |
| | | if (outboundOrder.OrderStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | { |
| | | issueModel = GetERPIssueModel(outboundOrder, warehouse.WarehouseCode); |
| | | _invokeERPService.InvokeOutStandardsApi(issueModel); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | lock (lock_code) |
| | | { |
| | | |
| | | |
| | | string code = string.Empty; |
| | | DateTime dateTime = DateTime.Now; |
| | | DateTime now = DateTime.Now; |