| | |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model.MES.Yada; |
| | | using Tiger.Model.Entitys.MES.U9C; |
| | | using System.Security.Policy; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput() { Command = Command }); |
| | | try |
| | | { |
| | | if (CurInvItem.IsNullOrEmpty()) |
| | | //解析条码 |
| | | Barcode barcode = new Barcode(input.SN); |
| | | if (barcode.IsException) |
| | | { |
| | | //解析条码 |
| | | Barcode barcode = new Barcode(input.SN); |
| | | if (barcode.IsException) |
| | | { |
| | | throw barcode.AnalyseException; |
| | | } |
| | | //非法条码 |
| | | else if (!barcode.IsRegular) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("条码为非法条码"); |
| | | action.LocaleMsg = Biz.L("WMS.WmsItem.Barcode.IllegalFailure", input.SN); |
| | | return action; |
| | | } |
| | | throw barcode.AnalyseException; |
| | | } |
| | | //非法条码 |
| | | else if (!barcode.IsRegular) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("条码为非法条码"); |
| | | action.LocaleMsg = Biz.L("WMS.WmsItem.Barcode.IllegalFailure", input.SN); |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | |
| | | if (barcode.Type == Barcode.Types.OuterPackage) |
| | | if (barcode.Type == Barcode.Types.OuterPackage) |
| | | { |
| | | CurSn = MainDB.Queryable<BIZ_U9_ASN_SN>().Where(q => q.CARTON_NO == barcode.SN).ToList(); |
| | | } |
| | | else |
| | | { |
| | | CurSn = MainDB.Queryable<BIZ_U9_ASN_SN>().Where(q => q.SN == barcode.SN).ToList(); |
| | | foreach (var sn in CurSn) |
| | | { |
| | | CurSn = MainDB.Queryable<BIZ_U9_ASN_SN>().Where(q => q.CARTON_NO == barcode.SN).ToList(); |
| | | } |
| | | else |
| | | { |
| | | CurSn = MainDB.Queryable<BIZ_U9_ASN_SN>().Where(q => q.SN == barcode.SN).ToList(); |
| | | foreach (var sn in CurSn) |
| | | { |
| | | sn.META_SN = input.SN; |
| | | } |
| | | } |
| | | |
| | | if (CurSn.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("ASN单中不存在条码[{0}]"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.SnNotExists", input.SN); |
| | | return action; |
| | | } |
| | | if (CurSn.First().AUTH_ORG != input.AuthOption.CurOrg) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"条码所属组织[{0}]与当前登录组织[{1}]不一致,请重新选择组织"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.OrgNotCorrect", CurSn.First().AUTH_ORG, input.AuthOption.CurOrg); |
| | | return action; |
| | | } |
| | | //验证条码是否正确 |
| | | if (CurSn.First().STATUS > WMS_ITEM.STATUSs.Incoming.GetValue()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("状态[{0}]异常,请重新扫描"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", CurSn.First().STATUS.GetEnumDesc<WMS_ITEM.STATUSs>()); |
| | | return action; |
| | | } |
| | | |
| | | |
| | | Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(barcode.SN, input.AuthOption, true); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | } |
| | | var inv = result.Data as Inventory; |
| | | |
| | | //物料验证 |
| | | if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N") |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("物料编码[{0}]不存在或者该物料未启用"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", (inv.ItemInfo?.ITEM_CODE).IsNullOrEmpty(inv.Barcode.ItemCode)); |
| | | return action; |
| | | } |
| | | |
| | | if (inv.Items.Count == 0) |
| | | { |
| | | WMS_ITEM Item; |
| | | WMS_ITEM_PKG ItemPkgs; |
| | | |
| | | Item = new() |
| | | { |
| | | SN = inv.Barcode.SN, |
| | | ITEM_CODE = inv.Barcode.ItemCode, |
| | | AUTH_ORG = input.AuthOption.CurOrg, |
| | | STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(), |
| | | QTY = inv.Barcode.Qty.ToDouble(), |
| | | PROD_DATE = (inv.Barcode.DateCode?? DateTime.Now.ToString("yyyy-MM-dd")).ToDateTime(), |
| | | UNIT = inv.Barcode.Unit, |
| | | }; |
| | | |
| | | ItemPkgs = new() |
| | | { |
| | | SN = inv.Barcode.SN, |
| | | AUTH_ORG = input.AuthOption.CurOrg, |
| | | ITEM_CODE = inv.Barcode.ItemCode, |
| | | QTY = inv.Barcode.Qty.ToDouble(), |
| | | UNIT = inv.Barcode.Unit, |
| | | }; |
| | | |
| | | var noExt = inv.Items.Where(q => !inv.ItemsExt.Any(s => s.SN == q.SN)).ToList(); |
| | | //扩展表不存在时新建 |
| | | foreach (var item in noExt) |
| | | { |
| | | inv.ItemsExt.Add(new() |
| | | { |
| | | SN = item.SN, |
| | | META_SN = inv.Barcode.MetaSn, |
| | | QR_CODE = inv.Barcode.MetaSn |
| | | }); |
| | | } |
| | | |
| | | inv.Items.Add(Item); |
| | | inv.Packages.Add(ItemPkgs); |
| | | } |
| | | //雅达不从条码上更新数量 |
| | | //else if (inv.Items.Count == 1) |
| | | //{ |
| | | // inv.Items.First().QTY = inv.Barcode.Qty.ToDouble(); |
| | | // inv.Items.First().ERP_WH = CurScanShelf.WarehouseCode; |
| | | // inv.Items.First().AUTH_ORG = input.AuthOption.CurOrg; |
| | | |
| | | // inv.Packages.First().QTY = inv.Barcode.Qty.ToDouble(); |
| | | // inv.Packages.First().ERP_WH = CurScanShelf.WarehouseCode; |
| | | // inv.Packages.First().AUTH_ORG = input.AuthOption.CurOrg; |
| | | //} |
| | | //如果扫描外箱的不能更新数量 |
| | | else |
| | | { |
| | | foreach (var item in inv.Items) |
| | | { |
| | | item.ERP_WH = ""; |
| | | item.AUTH_ORG = input.AuthOption.CurOrg; |
| | | } |
| | | foreach (var item in inv.Packages) |
| | | { |
| | | item.ERP_WH = ""; |
| | | item.AUTH_ORG = input.AuthOption.CurOrg; |
| | | } |
| | | } |
| | | CurInvItem = inv; |
| | | |
| | | //检查物料数量,如果没有则查询雅达条码主档,把数量返回前端确认 |
| | | if (CurInvItem.Items.Any(q => q.QTY <= 0)) |
| | | { |
| | | var qtyList = Biz.DataSource["YadaU9C"].Client.Queryable<mes_MaterialBarCode>().Where(q => CurInvItem.Items.Select(q => q.SN).Contains(q.Code)).ToList(); |
| | | foreach (var qty in qtyList) |
| | | { |
| | | var item = CurInvItem.Items.First(q => q.SN == qty.Code); |
| | | item.QTY = qty.WhQty; |
| | | item.SUPP_LOTNO = qty.Segment7; //供应商批次号 |
| | | } |
| | | action.Data.Data = CurInvItem.Items.Select(q => new { q.SN, q.QTY }); |
| | | action.Data.Command = Command = "ComfirmQty"; |
| | | //action.LocaleMsg = Biz.L("请确认条码[{0}]的数量是否正确"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ComfirmQty", input.SN); |
| | | return action; |
| | | sn.META_SN = input.SN; |
| | | } |
| | | } |
| | | |
| | | //更新已确认物料数量 |
| | | if (Command == "ComfirmQty") |
| | | if (CurSn.IsNullOrEmpty()) |
| | | { |
| | | var qtyList = (input.Data ?? "").JsonToObject<List<WMS_ITEM>>() ?? new List<WMS_ITEM>(); |
| | | if (!qtyList.Any() || qtyList.Any(q => q.QTY <= 0)) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.Data.Data = CurInvItem.Items.Select(q => new { q.SN, q.QTY }); |
| | | action.Data.Command = Command = "ComfirmQty"; |
| | | //action.LocaleMsg = Biz.L("数量不能小于等于零,请重新确认条码[{0}]的数量"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ReComfirmQty", input.SN); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | foreach (var qty in qtyList) |
| | | { |
| | | var item = CurInvItem.Items.First(q => q.SN == qty.SN); |
| | | item.QTY = qty.QTY; |
| | | var pkg = CurInvItem.Packages.First(q => q.SN == qty.SN); |
| | | pkg.QTY = qty.QTY; |
| | | } |
| | | CurInvItem.UpdatePkgQty(); |
| | | |
| | | Command = "Normal"; |
| | | } |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("ASN单中不存在条码[{0}]"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.SnNotExists", input.SN); |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | if (CurSn.First().AUTH_ORG != input.AuthOption.CurOrg) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"条码所属组织[{0}]与当前登录组织[{1}]不一致,请重新选择组织"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.OrgNotCorrect", CurSn.First().AUTH_ORG, input.AuthOption.CurOrg); |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | //验证条码是否正确 |
| | | if (CurSn.First().STATUS > WMS_ITEM.STATUSs.Incoming.GetValue()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("状态[{0}]异常,请重新扫描"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", CurSn.First().STATUS.GetEnumDesc<WMS_ITEM.STATUSs>()); |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | |
| | | //执行清点数据处理 |
| | | foreach (var sn in CurSn) |
| | | { |
| | | sn.STATUS = WMS_ITEM.STATUSs.Counted.GetValue(); |
| | | sn.QTY = CurInvItem.Items.Where(q => q.SN == sn.SN).Sum(q => q.QTY); |
| | | sn.RECEIVER = UserCode; |
| | | sn.RECEIVE_DATE = DateTime.Now; |
| | | } |
| | | foreach (var item in CurInvItem.Items) |
| | | { |
| | | var sn = CurSn.First(q => q.SN == item.SN); |
| | | item.AUTH_ORG = sn.AUTH_ORG; |
| | | item.STATUS = WMS_ITEM.STATUSs.Counted.GetValue(); |
| | | item.SOURCE_CODE = item.TRANS_CODE; |
| | | item.SOURCE_ORDER = item.TRANS_NO; |
| | | item.SOURCE_LINE = item.TRANS_LINE; |
| | | item.TRANS_CODE = nameof(BIZ_U9_ASN); |
| | | item.TRANS_NO = sn.ORDER_NO; |
| | | item.TRANS_LINE = sn.LINE_NO; |
| | | CurInvItem.History.Add(new WMS_ITEM_HIS(item, $"条码[{CurInvItem.SN}]清点完成,操作单据[{item.TRANS_NO}]")); |
| | | } |
| | | |
| | | //创建变量克隆对象用于传入DBSubmitAction中保存当前需要暂存的数据值 |
| | | var _CurSn = CurSn.Clone(); |
| | | var _Items = CurInvItem.Items.Clone(); |
| | | var _Packages = CurInvItem.Packages.Clone(); |
| | | var _History = CurInvItem.History.Clone(); |
| | | var _ItemsExt = CurInvItem.ItemsExt.Clone(); |
| | | //创建变量克隆对象用于传入DBSubmitAction中保存当前需要暂存的数据值 |
| | | var _CurSn = CurSn.Clone(); |
| | | AddCommitAction("Counted", () => |
| | | { |
| | | //使用统一的事务DB对象 |
| | | var db = GetCommitDB(); |
| | | //数据保存逻辑 |
| | | var t = db.Storageable(_Items, UserCode).ToStorage(); |
| | | t.AsInsertable.ExecuteCommand(); |
| | | t.AsUpdateable.UpdateColumns(q => new { q.QTY, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); |
| | | var p = db.Storageable(_Packages, UserCode).ToStorage(); |
| | | p.AsInsertable.ExecuteCommand(); |
| | | p.AsUpdateable.UpdateColumns(q => new { q.QTY, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); |
| | | db.Storageable(_Packages, UserCode).ToStorage().AsInsertable.ExecuteCommand(); |
| | | db.Insertable(_History, UserCode).ExecuteCommand(); |
| | | var e = db.Storageable(_ItemsExt, UserCode).ToStorage().AsInsertable.ExecuteCommand();//不存在插入 |
| | | db.Updateable<BIZ_U9_ASN>(UserCode).SetColumns(q => q.STATUS == BIZ_U9_ASN.STATUSs.Counting.GetValue()).Where(q => q.ORDER_NO == _CurSn.First().ORDER_NO).ExecuteCommand(); |
| | | db.Storageable(_CurSn, UserCode).ExecuteCommand(); |
| | | }); |
| | |
| | | //action.CatchExceptionWithLog(ex, $"扫描条码[{0}]复核异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); |
| | | } |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | action.Data.Data = ScanList; |
| | | |
| | | //action.LocaleMsg = Biz.L($"条码[{0}]清点成功!"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.CountSuccess", CurInvItem.SN); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.CountSuccess", CurSn.First().SN); |
| | | |
| | | //重置工序 |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, locale); ; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | sn.RECEIVE_DATE = DateTime.MinValue; |
| | | } |
| | | |
| | | var historys = new List<WMS_ITEM_HIS>(); |
| | | var items = await Biz.Db.Queryable<WMS_ITEM>().Where(q => ScanList.Select(s => s.SN).Contains(q.SN)).ToListAsync(); |
| | | foreach (var item in items) |
| | | { |
| | | var order = item.TRANS_CODE; |
| | | item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue(); |
| | | item.SOURCE_CODE = ""; |
| | | item.SOURCE_ORDER = ""; |
| | | item.SOURCE_LINE = ""; |
| | | item.TRANS_CODE = item.SOURCE_CODE; |
| | | item.TRANS_NO = item.SOURCE_ORDER; |
| | | item.TRANS_LINE = item.SOURCE_LINE; |
| | | historys.Add(new WMS_ITEM_HIS(item, $"条码[{item.SN}]取消清点,操作单据[{order}]")); |
| | | } |
| | | //var historys = new List<WMS_ITEM_HIS>(); |
| | | //var items = await Biz.Db.Queryable<WMS_ITEM>().Where(q => ScanList.Select(s => s.SN).Contains(q.SN)).ToListAsync(); |
| | | //foreach (var item in items) |
| | | //{ |
| | | // var order = item.TRANS_CODE; |
| | | // item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue(); |
| | | // item.SOURCE_CODE = ""; |
| | | // item.SOURCE_ORDER = ""; |
| | | // item.SOURCE_LINE = ""; |
| | | // item.TRANS_CODE = item.SOURCE_CODE; |
| | | // item.TRANS_NO = item.SOURCE_ORDER; |
| | | // item.TRANS_LINE = item.SOURCE_LINE; |
| | | // historys.Add(new WMS_ITEM_HIS(item, $"条码[{item.SN}]取消清点,操作单据[{order}]")); |
| | | //} |
| | | |
| | | //使用统一的事务DB对象 |
| | | var db = GetCommitDB(); |
| | | var dbTran = db.UseTran(() => |
| | | { |
| | | db.Updateable(ScanList, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.STATUS }).ExecuteCommandAsync(); |
| | | db.Updateable(items, UserCode).ExecuteCommand(); |
| | | db.Insertable(historys, UserCode).ExecuteCommand(); |
| | | //db.Updateable(items, UserCode).ExecuteCommand(); |
| | | //db.Insertable(historys, UserCode).ExecuteCommand(); |
| | | }); |
| | | if (dbTran.IsSuccess) |
| | | { |
| | |
| | | var action = new ApiAction(); |
| | | try |
| | | { |
| | | var item = await Biz.Db.Queryable<WMS_ITEM>().Where(q => q.SN == input.SN).FirstAsync(); |
| | | var order = item.TRANS_CODE; |
| | | item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue(); |
| | | item.SOURCE_CODE = ""; |
| | | item.SOURCE_ORDER = ""; |
| | | item.SOURCE_LINE = ""; |
| | | item.TRANS_CODE = item.SOURCE_CODE; |
| | | item.TRANS_NO = item.SOURCE_ORDER; |
| | | item.TRANS_LINE = item.SOURCE_LINE; |
| | | //var item = await Biz.Db.Queryable<WMS_ITEM>().Where(q => q.SN == input.SN).FirstAsync(); |
| | | //var order = item.TRANS_CODE; |
| | | //item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue(); |
| | | //item.SOURCE_CODE = ""; |
| | | //item.SOURCE_ORDER = ""; |
| | | //item.SOURCE_LINE = ""; |
| | | //item.TRANS_CODE = item.SOURCE_CODE; |
| | | //item.TRANS_NO = item.SOURCE_ORDER; |
| | | //item.TRANS_LINE = item.SOURCE_LINE; |
| | | |
| | | //使用统一的事务DB对象 |
| | | var db = GetCommitDB(); |
| | |
| | | .SetColumns(q => q.RECEIVER == null) |
| | | .SetColumns(q => q.RECEIVE_DATE == DateTime.MinValue) |
| | | .Where(q => q.SN == input.SN).ExecuteCommand(); |
| | | db.Updateable(item, UserCode).ExecuteCommand(); |
| | | db.Insertable(new WMS_ITEM_HIS(item, $"条码[{item.SN}]取消清点,操作单据[{order}]"), UserCode).ExecuteCommand(); |
| | | //db.Updateable(item, UserCode).ExecuteCommand(); |
| | | //db.Insertable(new WMS_ITEM_HIS(item, $"条码[{item.SN}]取消清点,操作单据[{order}]"), UserCode).ExecuteCommand(); |
| | | }); |
| | | if (dbTran.IsSuccess) |
| | | { |
| | |
| | | { |
| | | foreach (var dtl in order.Details) |
| | | { |
| | | dtl.SnList = order.SnList.Where(q => q.LINE_NO == dtl.LINE_NO).ToList(); |
| | | dtl.QTY_COUNTED = dtl.SnList.Where(q => q.STATUS == WMS_ITEM.STATUSs.Counted.GetValue()).Sum(q => q.QTY); |
| | | dtl.SnList = order.SnList.Where(q => q.LINE_NO == dtl.LINE_NO).OrderByDescending(q => q.STATUS).ToList(); |
| | | dtl.QTY_COUNTED = dtl.SnList.Where(q => q.STATUS == WMS_ITEM.STATUSs.Counted.GetValue() || q.STATUS == WMS_ITEM.STATUSs.Rejected.GetValue()).Sum(q => q.QTY); |
| | | } |
| | | } |
| | | order.IsFinished = !order.Details.Where(q => q.QTY != q.QTY_COUNTED).Any(); |
| | | } |
| | | } |
| | | return action; |
| | | } |
| | |
| | | var orderNo = input.Data; |
| | | try |
| | | { |
| | | var order = await MainDB.Queryable<BIZ_U9_ASN>().Where(q => q.ORDER_NO == orderNo).IncludesAllFirstLayer().FirstAsync(); |
| | | var order = await MainDB.Queryable<BIZ_U9_ASN>().Where(q => q.ORDER_NO == orderNo).Includes(q => q.Details, d => d._ItemInfos).IncludesAllFirstLayer().FirstAsync(); |
| | | if (order.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | |
| | | } |
| | | |
| | | //查询是否清点完成 |
| | | var noFinish = order.Details.Where(q => q.QTY != order.SnList.Sum(s => s.QTY)); |
| | | var noFinish = order.Details.Where(q => q.QTY != order.SnList.Where(s => s.LINE_NO == q.LINE_NO && (s.STATUS == WMS_ITEM.STATUSs.Counted.GetValue() || q.STATUS == WMS_ITEM.STATUSs.Rejected.GetValue())).Sum(s => s.QTY)); |
| | | if (noFinish.Any()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("清点数量不对");// Biz.L("WMS.InReceipt.ScanItem.CheckingDataToSubmit"); //$"清点数量不对"; |
| | | action.LocaleMsg = Biz.L($"送货单[{0}]未清点完成,请先清点完成"); |
| | | //action.LocaleMsg = Biz.L("送货单[{0}]未清点完成,请先清点完成,未完成清点的行号如下:{1}"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.GenerateReceipt.NoFinishCounting", orderNo, string.Join(",", noFinish.Select(q => q.LINE_NO))); |
| | | return action; |
| | | } |
| | | |
| | |
| | | IsLogin = true, |
| | | CreateRcvBySrcASNParam = new () |
| | | { |
| | | aSNToRcvTransDTOs = order.Details.Select(q => new ASNToRcvTransDTO { ASNLineKey = q.ID, TransQty = new() { m_amount1 = q.QTY + q.QTY_GIFT } }).ToList(), |
| | | aSNToRcvTransDTOs = order.Details.Select(q => new ASNToRcvTransDTO |
| | | { |
| | | ASNLineKey = q.ID, |
| | | TransQty = new() { m_amount1 = q.QTY }, |
| | | BinInfoList = new() { new() { Bin = new () { m_code = q.ItemInfo.DEFAULT_LOCATION }, LocationQtySU = q.QTY, LocationQtyTU = q.QTY } }, |
| | | }).ToList(), |
| | | } |
| | | }; |
| | | var result = await DI.Resolve<IWMS_U9C>().CreateRcvBySrcASN(iInput); |
| | |
| | | var receipt = new BIZ_U9_RECEIPT(); |
| | | receipt.Details = new(); |
| | | receipt.SnList = new(); |
| | | DbClient U9Cdb = Biz.DataSource["YadaU9C"].Client; |
| | | var list = U9Cdb.Queryable<mes_ReturnedDocInfo>().Where(x => x.RcvId == result.Data[0].ID.ToDouble() && x.DocNo == result.Data[0].Code).ToList(); |
| | | var list = Biz.DataSource["YadaU9C"].Client.Queryable<mes_ReturnedDocInfo>().Where(x => x.RcvId == result.Data[0].ID.ToDouble() && x.DocNo == result.Data[0].Code).ToList(); |
| | | |
| | | if (list != null && list.Count > 0) |
| | | { |
| | |
| | | ORDER_NO = item.DocNo, |
| | | LINE_NO = item.DocLineNo.ToString(), |
| | | ITEM_CODE = item.ItemCode, |
| | | QTY = item.RtnFillQtyTU.ToDouble(), // mes单据数量 --U9退补数量 |
| | | QTY = item.EyeballingQtyTU.ToDouble(), // mes单据数量 --U9退补数量 |
| | | QTY_GIFT = asnDtl.QTY_GIFT, |
| | | ASN_ID = item.SrcASNDocId.ToString(), |
| | | ASN_NO =asnDtl.ORDER_NO, |
| | |
| | | |
| | | //更新库存表信息 |
| | | var items = MainDB.Queryable<WMS_ITEM>().Where(q => SqlFunc.Subqueryable<BIZ_U9_ASN_SN>().Where(s => s.SN == q.SN && s.ORDER_NO == order.ORDER_NO).Any()).ToList(); |
| | | var historys = new List<WMS_ITEM_HIS>(); |
| | | var historys = new List<WMS_ITEM_HIS>(); |
| | | foreach (var item in items) |
| | | { |
| | | item.STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(); |
| | | item.AUTH_ORG = receipt.AUTH_ORG; |
| | | item.STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(); |
| | | item.SOURCE_CODE = item.TRANS_CODE; |
| | | item.SOURCE_ORDER = item.TRANS_NO; |
| | | item.SOURCE_LINE = item.TRANS_LINE; |
| | |
| | | item.TRANS_LINE = receipt.SnList.First(q => q.SN == item.SN).LINE_NO; |
| | | historys.Add(new WMS_ITEM_HIS(item, $"送货单[{order.ORDER_NO}]的条码[{item.SN}]生成收货单[{receipt.ORDER_NO}],待检验完成后可入库")); |
| | | } |
| | | var pkgs = MainDB.Queryable<WMS_ITEM_PKG>().Where(q => SqlFunc.Subqueryable<BIZ_U9_ASN_SN>().Where(s => s.SN == q.SN && s.ORDER_NO == order.ORDER_NO).Any()).ToList(); |
| | | foreach (var item in pkgs) |
| | | { |
| | | item.AUTH_ORG = receipt.AUTH_ORG; |
| | | 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 = receipt.SnList.First(q => q.SN == item.SN).LINE_NO; |
| | | } |
| | | order.STATUS = BIZ_U9_ASN.STATUSs.Finished.GetValue(); |
| | | order.RECEIVER_ID = receipt.ID; |
| | | order.RECEIVER_NO = receipt.ORDER_NO; |
| | |
| | | var db = GetCommitDB(); |
| | | var dbTran = db.UseTran(() => |
| | | { |
| | | db.Updateable(items, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.STATUS, q.TRANS_CODE, q.TRANS_NO, q.TRANS_LINE, q.SOURCE_CODE, q.SOURCE_ORDER, q.SOURCE_LINE }).ExecuteCommand(); |
| | | db.Insertable(historys, UserCode).ExecuteCommand(); |
| | | db.Updateable(items, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.AUTH_ORG, q.STATUS, q.TRANS_CODE, q.TRANS_NO, q.TRANS_LINE, q.SOURCE_CODE, q.SOURCE_ORDER, q.SOURCE_LINE }).ExecuteCommand(); |
| | | db.Updateable(pkgs, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.AUTH_ORG, q.TRANS_CODE, q.TRANS_NO, q.TRANS_LINE, q.SOURCE_CODE, q.SOURCE_ORDER, q.SOURCE_LINE }).ExecuteCommand(); |
| | | db.Insertable(historys, UserCode).ExecuteCommand(); |
| | | db.Updateable(order, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.STATUS, q.RECEIVER, q.RECEIVE_DATE, q.RECEIVER_ID, q.RECEIVER_NO }).ExecuteCommand(); |
| | | db.Insertable(receipt, UserCode).ExecuteCommand(); |
| | | db.Insertable(receipt.Details, UserCode).ExecuteCommand(); |