| | |
| | | if (CurInvItem.IsNullOrEmpty()) |
| | | { |
| | | //解析条码 |
| | | Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true); |
| | | Result<IInventory> result = GetInventory(input.SN, input.AuthOption, true); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = false; |
| | |
| | | item.PROD_DATE = item.PROD_DATE < new DateTime(2000, 1, 1) ? DateTime.Now : item.PROD_DATE; |
| | | item.FIRST_IN_DATE = item.FIRST_IN_DATE < new DateTime(2000, 1, 1) ? DateTime.Now : item.FIRST_IN_DATE; |
| | | } |
| | | foreach (var item in CurInvItem.Packages) |
| | | { |
| | | item.SOURCE_CODE = item.TRANS_CODE; |
| | | item.SOURCE_ORDER = item.TRANS_NO; |
| | | item.SOURCE_LINE = item.TRANS_LINE; |
| | | item.TRANS_CODE = nameof(BIZ_U9_RECEIPT); |
| | | item.TRANS_NO = receipt.ORDER_NO; |
| | | item.TRANS_LINE = receiptDtl.LINE_NO; |
| | | } |
| | | Result putonResult = PutOn(input.AuthOption, nLocation.LOCATION_CODE); |
| | | if (!putonResult.IsSuccessed) |
| | | { |
| | |
| | | sn.IS_IN = "Y"; |
| | | } |
| | | //如果当前行上架完成标记为待审核 |
| | | Action approveAction = null; |
| | | receiptDtl.QTY_IN = receipt.SnList.Where(q => q.LINE_NO == receiptDtl.LINE_NO && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()).Sum(q => q.QTY); |
| | | if (receiptDtl.QTY_IN == receiptDtl.QTY_OK) |
| | | { |
| | | receiptDtl.STATUS = BIZ_U9_RECEIPT.STATUSs.Review.GetValue(); |
| | | //当前单据明细已经全部上架完成,可以调用U9行审接口 |
| | | approveAction = () => |
| | | //当前单据明细行已经全部上架完成,可以调用U9行审接口,如果行审失败则报错,最后一个上架失败 |
| | | var iInput = new SubmitLineInput |
| | | { |
| | | var iInput = new SubmitLineInput |
| | | userId = UserCode, |
| | | IsLogin = true, |
| | | param = new() |
| | | { |
| | | userId = UserCode, |
| | | IsLogin = true, |
| | | param = new() |
| | | { |
| | | RcvLineID = receiptDtl.ID, |
| | | RcvDocNo = receiptDtl.ORDER_NO, |
| | | DocLineNo = receiptDtl.LINE_NO, |
| | | OrgCode = receiptDtl.AUTH_ORG, |
| | | } |
| | | }; |
| | | var result = DI.Resolve<IWMS_U9C>().ReceivementApproveLine(iInput).Result; |
| | | if (!result.IsSuccessed) |
| | | { |
| | | throw new Exception(Biz.T(result.LocaleMsg, input.Locale)); |
| | | } |
| | | else |
| | | { |
| | | //更新单据信息 |
| | | MainDB.Updateable<BIZ_U9_RECEIPT_DTL>().SetColumns(q => q.STATUS == BIZ_U9_RECEIPT.STATUSs.Finished.GetValue()).Where(q => q.ID == receiptDtl.ID).ExecuteCommand(); |
| | | if (!MainDB.Queryable<BIZ_U9_RECEIPT_DTL>().Any(q => q.STATUS < BIZ_U9_RECEIPT.STATUSs.Finished.GetValue() && q.ORDER_NO == receipt.ORDER_NO)) |
| | | { |
| | | MainDB.Updateable<BIZ_U9_RECEIPT>().SetColumns(q => q.STATUS == BIZ_U9_RECEIPT.STATUSs.Finished.GetValue()).Where(q => q.ID == receipt.ID).ExecuteCommand(); |
| | | } |
| | | RcvLineID = receiptDtl.ID, |
| | | RcvDocNo = receiptDtl.ORDER_NO, |
| | | DocLineNo = receiptDtl.LINE_NO, |
| | | OrgCode = receiptDtl.AUTH_ORG, |
| | | } |
| | | }; |
| | | var result = await DI.Resolve<IWMS_U9C>().ReceivementApproveLine(iInput); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | else |
| | | { |
| | | receiptDtl.STATUS = BIZ_U9_RECEIPT.STATUSs.Finished.GetValue(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | receiptDtl.STATUS = BIZ_U9_RECEIPT.STATUSs.Storing.GetValue(); |
| | | } |
| | | //更新单据状态 |
| | | if (receipt.Details.Any(q => q.STATUS < BIZ_U9_RECEIPT.STATUSs.Review.GetValue())) |
| | | { |
| | | receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Storing.GetValue(); |
| | | } |
| | | else |
| | | else if (receipt.Details.Any(q => q.STATUS < BIZ_U9_RECEIPT.STATUSs.Finished.GetValue())) |
| | | { |
| | | receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Review.GetValue(); |
| | | } |
| | | else |
| | | { |
| | | receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Finished.GetValue(); |
| | | } |
| | | |
| | | //创建变量克隆对象用于传入DBSubmitAction中保存当前需要暂存的数据值 |
| | |
| | | }); |
| | | |
| | | //完成所有处理后使用事务保存数据 |
| | | action = DoIfFinish(action, input.Locale, approveAction); |
| | | action = DoIfFinish(action, input.Locale); |
| | | } |
| | | catch (Exception ex) |
| | | { |