服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2025-04-02 a8fcfbb5e5ed9a07b1a30ef2d7ef9d407e9b04dd
Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs
@@ -63,7 +63,7 @@
            catch (Exception ex)
            {
                //取消当前操作
                ResetScan();
                ResetTrans();
                //action.CatchExceptionWithLog(ex, $"扫描[{input.SN}]异常");
                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN));
            }
@@ -81,7 +81,7 @@
                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;
@@ -192,7 +192,7 @@
                    action.IsSuccessed = false;
                    //action.LocaleMsg = Biz.L("储位[{0}]只能存放一个物料");
                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationSingleFailure", nLocation.LOCATION_CODE);
                    ResetScan();
                    ResetTrans();
                    return SetOutPutMqttMsg(action, input.Locale);
                }
@@ -209,12 +209,21 @@
                    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)
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = putonResult.LocaleMsg;
                    ResetScan();
                    ResetTrans();
                    return SetOutPutMqttMsg(action, input.Locale);
                }
@@ -225,53 +234,51 @@
                    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中保存当前需要暂存的数据值
@@ -287,12 +294,12 @@
                });
                //完成所有处理后使用事务保存数据
                action = DoIfFinish(action, input.Locale, approveAction);
                action = DoIfFinish(action, input.Locale);
            }
            catch (Exception ex)
            {
                //取消当前操作
                ResetScan();
                ResetTrans();
                //action.CatchExceptionWithLog(ex, $"扫描条码[{input.SN}]复核异常");
                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN));
            }
@@ -383,7 +390,7 @@
            catch (Exception ex)
            {
                //取消当前操作
                ResetScan();
                ResetTrans();
                //action.CatchExceptionWithLog(ex, $"扫描货架/储位[{0}]异常");
                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanShelf.ScanException", Code));
            }
@@ -424,29 +431,30 @@
            action.LocaleMsg = Biz.L("WMS.Default.ScanItem.PutOnSucceeded", CurInvItem.SN, CurInvItem.Location.LOCATION_CODE);
            //重置工序
            ResetScanInfo();
            ResetScan();
            return SetOutPutMqttMsg(action, locale);
        }
        #endregion
        /// <summary>
        /// 重置当前操作,有需要则重写此方法
        /// 重置事务数据,有需要则重写此方法
        /// </summary>
        public override void ResetScan()
        public override void ResetTrans()
        {
            base.ResetScan();
            ResetScanInfo();
            ResetScan();
            CurScanShelf = null;
            base.ResetTrans();
        }
        /// <summary>
        /// 重置扫码信息
        /// 重置本次扫码信息
        /// </summary>
        public void ResetScanInfo()
        public override void ResetScan()
        {
            Command = null;
            Command = "Normal";
            CurInvItem = null;
            base.ResetScan();
        }
        public override bool Close(bool needSaveHistoryLog = false)