| | |
| | | } |
| | | else |
| | | { |
| | | if (Biz.Db.Queryable<WMS_ITEM>().Any(q=>q.SUPP_LOTNO == rePrints.BatchNo) && (Biz.Db.Queryable<WMS_ITEM>().Where(q=>q.SUPP_LOTNO == rePrints.BatchNo).Sum(x=>x.QTY)>= rePrints.BatchQty)) { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L($"此库位[{LocationCode}]上的批次[{rePrints.BatchNo}]数量已经够数,不能再上架生成标签"); |
| | | return action; |
| | | } |
| | | //if (Biz.Db.Queryable<WMS_ITEM>().Any(q=>q.SUPP_LOTNO == rePrints.BatchNo) && (Biz.Db.Queryable<WMS_ITEM>().Where(q=>q.SUPP_LOTNO == rePrints.BatchNo && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()).Sum(x=>x.QTY)>= rePrints.BatchQty)) { |
| | | // action.IsSuccessed = false; |
| | | // action.LocaleMsg = Biz.L($"此库位[{LocationCode}]上的批次[{rePrints.BatchNo}]数量已经够数,不能再上架生成标签"); |
| | | // return action; |
| | | //} |
| | | foreach (var ent in rePrints.SnList) |
| | | { |
| | | string CurSN = DI.Resolve<ICodeRuleCache>()["InitialBarcode"]?.Generate($"{ent.SN}").Data.ToString() ?? ""; |
| | |
| | | //} |
| | | |
| | | //执行上架 |
| | | foreach (var item in inv.Items) |
| | | { |
| | | item.TRANS_CODE = "ReprintLabel"; |
| | | item.TRANS_NO = $"ReprintLabel{DateTime.Now:yyyyMMdd}"; |
| | | } |
| | | Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE); |
| | | if (!putonResult.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = putonResult.LocaleMsg; |
| | | inv = null; |
| | | CurSN = ""; |
| | | return action; |
| | | } |
| | | PutOnInfo putOnInfo = putonResult.Data; |
| | | items.AddRange(putOnInfo.Items); |
| | | itemhiss.AddRange(putOnInfo.History); |
| | | itemPkgs.AddRange(putOnInfo.Packages); |
| | | itemExts.AddRange(putOnInfo.ItemsExt); |
| | | //foreach (var item in inv.Items) |
| | | //{ |
| | | // item.TRANS_CODE = "ReprintLabel"; |
| | | // item.TRANS_NO = $"ReprintLabel{DateTime.Now:yyyyMMdd}"; |
| | | //} |
| | | //Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE); |
| | | //if (!putonResult.IsSuccessed) |
| | | //{ |
| | | // action.IsSuccessed = false; |
| | | // action.LocaleMsg = putonResult.LocaleMsg; |
| | | // inv = null; |
| | | // CurSN = ""; |
| | | // return action; |
| | | //} |
| | | //PutOnInfo putOnInfo = putonResult.Data; |
| | | //items.AddRange(putOnInfo.Items); |
| | | //itemhiss.AddRange(putOnInfo.History); |
| | | //itemPkgs.AddRange(putOnInfo.Packages); |
| | | //itemExts.AddRange(putOnInfo.ItemsExt); |
| | | } |
| | | //保存到数据库 |
| | | var db = Business.Biz.Db; |
| | | var dbTran = db.UseTran(() => |
| | | { |
| | | //入库 |
| | | db.Storageable(items, UserCode).ExecuteCommand(); |
| | | db.Storageable(itemPkgs, UserCode).ExecuteCommand(); |
| | | db.Insertable(itemhiss, UserCode).ExecuteCommand(); |
| | | var x = db.Storageable(itemExts, UserCode).ToStorage(); |
| | | x.AsInsertable.ExecuteCommand();//不存在插入 |
| | | x.AsUpdateable.ExecuteCommand();//存在更新 |
| | | }); |
| | | if (!dbTran.IsSuccess) |
| | | { |
| | | Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception"); |
| | | throw dbTran.ErrorException; |
| | | } |
| | | //var db = Business.Biz.Db; |
| | | //var dbTran = db.UseTran(() => |
| | | //{ |
| | | // //入库 |
| | | // db.Storageable(items, UserCode).ExecuteCommand(); |
| | | // db.Storageable(itemPkgs, UserCode).ExecuteCommand(); |
| | | // db.Insertable(itemhiss, UserCode).ExecuteCommand(); |
| | | // var x = db.Storageable(itemExts, UserCode).ToStorage(); |
| | | // x.AsInsertable.ExecuteCommand();//不存在插入 |
| | | // x.AsUpdateable.ExecuteCommand();//存在更新 |
| | | //}); |
| | | //if (!dbTran.IsSuccess) |
| | | //{ |
| | | // Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception"); |
| | | // throw dbTran.ErrorException; |
| | | //} |
| | | |
| | | action.Data.Data = rePrints; |
| | | action.LocaleMsg = Biz.L("库位批次条码上架成功"); |