| | |
| | | using Tiger.Model.Entitys.MES.U9C; |
| | | using System.Security.Policy; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | using MailKit.Search; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | { |
| | | base.Init(id, userCode, apiHost, orgCode); |
| | | //加载已经清点数据 |
| | | LoadData(); |
| | | //LoadData(); |
| | | Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]"); |
| | | return this; |
| | | } |
| | |
| | | #region Propertys & Variables |
| | | //private List<WmsOrder<BIZ_U9_ASN>> _OrderList { get; set; } = new(); |
| | | private List<string> OrderList = new(); |
| | | private BIZ_U9_ASN order = new(); |
| | | private List<BIZ_U9_ASN_SN> CurSn = new(); |
| | | private List<BIZ_U9_ASN_SN> ScanList = new(); |
| | | #endregion |
| | |
| | | //如果是随单赠品或者样品 |
| | | else if (input.Data == "1") |
| | | { |
| | | action = await Submit(input); |
| | | } |
| | | else if (input.Data == "Submit") |
| | | { |
| | | |
| | | } |
| | | else |
| | |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<ScanOutput>> GetAsnInfoForPrint(BaseInput input) |
| | | { |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput() ); |
| | | var action = new ApiAction<ScanOutput>($"成功获取ASN单[{input.SN}]信息", new ScanOutput()); |
| | | try |
| | | { |
| | | order = await MainDB.Queryable<BIZ_U9_ASN>().Where(q => q.ORDER_NO == input.SN).Includes(q => q.Details, d => d._ItemInfos).IncludesAllFirstLayer().FirstAsync(); |
| | | if (order==null) { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L($"查不到ASN单[{input.SN}]的数据"); |
| | | return action; |
| | | } |
| | | action.Data.Data = order; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //取消当前操作 |
| | | ResetScan(); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN)); |
| | | } |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 提交数据 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<ScanOutput>> Submit(BaseInput input) |
| | | { |
| | | var action = new ApiAction<ScanOutput>($"成功提交ASN单[{input.SN}]行数据,并完成清点,请点击打印按钮打印标签", new ScanOutput()); |
| | | try |
| | | { |
| | | var snlist = input.Options["Snlist"].ToString().JsonToObject<List<string>>(); |
| | | List<string> SnList = new(); |
| | | foreach (var sn in snlist) |
| | | { |
| | | SnList.Add(DI.Resolve<ICodeRuleCache>()["InitialBarcode"]?.Generate($"{sn}").Data.ToString() ?? ""); |
| | | } |
| | | action.Data.Data = SnList; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("ASN单中不存在条码[{0}]"); |
| | | action.LocaleMsg = Biz.L("WMS.Print_BIZ_U9_ASN.SnNotExists", input.SN); |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | if (CurSn.First().AUTH_ORG != input.AuthOption.CurOrg) |
| | | { |
| | |
| | | }); |
| | | |
| | | //完成所有处理后使用事务保存数据 |
| | | action = DoIfFinish(action, input.Locale); |
| | | action = DoIfFinish(action, input.Locale, () => |
| | | { |
| | | if (!OrderList.Contains(CurSn.First().ORDER_NO)) |
| | | { |
| | | OrderList.Add(CurSn.First().ORDER_NO); |
| | | } |
| | | ScanList.AddRange(CurSn); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// 完成所有处理后使用事务保存数据 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <param name="locale"></param> |
| | | /// <param name="doAfterSave"></param> |
| | | /// <returns></returns> |
| | | public ApiAction<ScanOutput> DoIfFinish(ApiAction<ScanOutput> action, string locale) |
| | | public ApiAction<ScanOutput> DoIfFinish(ApiAction<ScanOutput> action, string locale, Action doAfterSave = null) |
| | | { |
| | | //保存数据库 |
| | | SaveCommitListToDB(); |
| | | |
| | | if (!OrderList.Contains(CurSn.First().ORDER_NO)) |
| | | { |
| | | OrderList.Add(CurSn.First().ORDER_NO); |
| | | } |
| | | ScanList.AddRange(CurSn); |
| | | //保存数据成功后执行 |
| | | doAfterSave?.Invoke(); |
| | | |
| | | // 返回数据 |
| | | action.Data.Data = ScanList; |