ÎļþÃû´Ó Tiger.Business.WMS/Transaction/OtherInLocation.cs ÐÞ¸Ä |
| | |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model.Sharetronic.Shelf; |
| | | using Tiger.Business.WMS.Sharetronic.Shelf; |
| | | using static Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | //å½input.ReqType为0æ¶ï¼æ å·¥åå
¥åº |
| | | if (input.ReqType == 0) |
| | | { |
| | | Result<Inventory> res = new(); |
| | | Result<IInventory> res = new(); |
| | | if (WarehouseName.Contains("客ä¾")) |
| | | { |
| | | res = WMS_ITEM_Biz.WmsItem.GetK(input.SN, new() { UserId = "admin" }, true); |
| | |
| | | { |
| | | res = WMS_ITEM_Biz.WmsItem.Get(input.SN, new() { UserId = "admin" }, true); |
| | | } |
| | | var inv = res.Data as Inventory; |
| | | //夿æ¯å¦ä¸ç»´ç |
| | | if (!res.Data.IsQRCode) |
| | | if (!inv.IsQRCode) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", res.Data.Barcode.MetaSn); |
| | | action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", inv.Barcode.MetaSn); |
| | | return action; |
| | | } |
| | | if (!res.IsSuccessed) |
| | |
| | | action.LocaleMsg = res.LocaleMsg; |
| | | return action; |
| | | } |
| | | if (res.Data.Status.GetValue() != WMS_ITEM.STATUSs.NotExists.GetValue() && res.Data.Status.GetValue() <= WMS_ITEM.STATUSs.InStore.GetValue()) |
| | | if (inv.Status.GetValue() != WMS_ITEM.STATUSs.NotExists.GetValue() && inv.Status.GetValue() <= WMS_ITEM.STATUSs.InStore.GetValue()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L("ç¶æå¼å¸¸{0}", string.Join(',', res.Data.StatusList.Select(x => x.GetDesc()))); //Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', res.Data.StatusList.Select(x => x.GetDesc()))); |
| | | action.LocaleMsg = Biz.L("ç¶æå¼å¸¸{0}", string.Join(',', inv.StatusList.Select(x => x.GetDesc()))); //Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(x => x.GetDesc()))); |
| | | return action; |
| | | } |
| | | //éªè¯æ¡ç æ¯å¦æ£ç¡® |
| | | //if (!res.Data.isNormalStatus || !new[] { WMS_ITEM.STATUSs.WaitIn }.Contains(res.Data.Status)) |
| | | //if (!inv.isNormalStatus || !new[] { WMS_ITEM.STATUSs.WaitIn }.Contains(inv.Status)) |
| | | //{ |
| | | // action.IsSuccessed = false; |
| | | // action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', res.Data.StatusList)); |
| | | // action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', inv.StatusList)); |
| | | // return action; |
| | | //} |
| | | //ç©æéªè¯ |
| | | if (res.Data.ItemInfo.IsNullOrEmpty() || res.Data.ItemInfo.IS_ACTIVE == "N") |
| | | if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N") |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", res.Data.ItemInfo.ITEM_CODE.IsNullOrEmpty(res.Data.Barcode.ItemCode)); |
| | | action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode)); |
| | | return action; |
| | | } |
| | | List<WMS_ITEM_HIS> ItemHistorys = new List<WMS_ITEM_HIS>(); |
| | | WMS_ITEM Item; |
| | | WMS_ITEM_PKG ItemPkgs; |
| | | var IsNull = false; |
| | | if (!res.Data.IsNullOrEmpty()) |
| | | if (!inv.IsNullOrEmpty()) |
| | | { |
| | | if (res.Data.Items.Count == 0) |
| | | if (inv.Items.Count == 0) |
| | | { |
| | | IsNull = true; |
| | | Item = new() |
| | | { |
| | | SN = res.Data.Barcode.SN, |
| | | ITEM_CODE = WarehouseName.Contains("客ä¾") && !res.Data.Barcode.ItemCode.StartsWith("K") ? ("K" + res.Data.Barcode.ItemCode) : (res.Data.Barcode.ItemCode), |
| | | SN = inv.Barcode.SN, |
| | | ITEM_CODE = WarehouseName.Contains("客ä¾") && !inv.Barcode.ItemCode.StartsWith("K") ? ("K" + inv.Barcode.ItemCode) : (inv.Barcode.ItemCode), |
| | | AUTH_ORG = input.AuthOption.CurOrg, |
| | | STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(), |
| | | QTY = res.Data.Barcode.Qty.ToDecimal(), |
| | | PROD_DATE = res.Data.Barcode.DateCode.ToDateTime(), |
| | | QTY = inv.Barcode.Qty.ToDecimal(), |
| | | PROD_DATE = inv.Barcode.DateCode.ToDateTime(), |
| | | ERP_WH = WarehouseCode, |
| | | UNIT = res.Data.Barcode.Unit, |
| | | UNIT = inv.Barcode.Unit, |
| | | }; |
| | | |
| | | WMS_ITEM_HIS his = new WMS_ITEM_HIS(Item, $"æ åæ®å
¥åº"); |
| | | ItemHistorys.Add(his); |
| | | ItemPkgs = new() |
| | | { |
| | | SN = res.Data.Barcode.SN, |
| | | SN = inv.Barcode.SN, |
| | | AUTH_ORG = input.AuthOption.CurOrg, |
| | | ITEM_CODE = WarehouseName.Contains("客ä¾") && !res.Data.Barcode.ItemCode.StartsWith("K") ? ("K" + res.Data.Barcode.ItemCode) : (res.Data.Barcode.ItemCode), |
| | | QTY = res.Data.Barcode.Qty.ToDecimal(), |
| | | ITEM_CODE = WarehouseName.Contains("客ä¾") && !inv.Barcode.ItemCode.StartsWith("K") ? ("K" + inv.Barcode.ItemCode) : (inv.Barcode.ItemCode), |
| | | QTY = inv.Barcode.Qty.ToDecimal(), |
| | | ERP_WH = WarehouseCode, |
| | | UNIT = res.Data.Barcode.Unit, |
| | | UNIT = inv.Barcode.Unit, |
| | | }; |
| | | |
| | | res.Data.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => res.Data.Items.Any(s => s.SN == q.SN)).ToList();//æ©å±è¡¨ |
| | | //var data = result.Data.Items.Select(i => i.SN).ToList().Except(result.Data.ItemsExt.Select(i => i.SN).ToList()); |
| | | var data = res.Data.Items.Where(q => !res.Data.ItemsExt.Any(s => s.SN == q.SN)).ToList(); |
| | | inv.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => inv.Items.Any(s => s.SN == q.SN)).ToList();//æ©å±è¡¨ |
| | | //var data = inv.Items.Select(i => i.SN).ToList().Except(inv.ItemsExt.Select(i => i.SN).ToList()); |
| | | var data = inv.Items.Where(q => !inv.ItemsExt.Any(s => s.SN == q.SN)).ToList(); |
| | | //æ©å±è¡¨ä¸å卿¶æ°å»º |
| | | if (data.Count > 0) |
| | | { |
| | | foreach (var item in data) |
| | | { |
| | | res.Data.ItemsExt.Add(new() |
| | | inv.ItemsExt.Add(new() |
| | | { |
| | | SN = item.SN, |
| | | SUPP_ITEM_CODE = res.Data.Barcode.OEMItemCode, |
| | | META_SN = res.Data.Barcode.MetaSn, |
| | | QR_CODE = res.Data.Barcode.MetaSn |
| | | SUPP_ITEM_CODE = inv.Barcode.OEMItemCode, |
| | | META_SN = inv.Barcode.MetaSn, |
| | | QR_CODE = inv.Barcode.MetaSn |
| | | }); |
| | | } |
| | | } |
| | | |
| | | res.Data.Items.Add(Item); |
| | | res.Data.History.Add(his); |
| | | res.Data.Packages.Add(ItemPkgs); |
| | | inv.Items.Add(Item); |
| | | inv.History.Add(his); |
| | | inv.Packages.Add(ItemPkgs); |
| | | } |
| | | else if (res.Data.Items.Count == 1) |
| | | else if (inv.Items.Count == 1) |
| | | { |
| | | res.Data.Items.First().QTY = res.Data.Barcode.Qty.ToDecimal(); |
| | | res.Data.Items.First().ERP_WH = WarehouseCode; |
| | | res.Data.Items.First().AUTH_ORG = input.AuthOption.CurOrg; |
| | | inv.Items.First().QTY = inv.Barcode.Qty.ToDecimal(); |
| | | inv.Items.First().ERP_WH = WarehouseCode; |
| | | inv.Items.First().AUTH_ORG = input.AuthOption.CurOrg; |
| | | |
| | | res.Data.Packages.First().QTY = res.Data.Barcode.Qty.ToDecimal(); |
| | | res.Data.Packages.First().ERP_WH = WarehouseCode; |
| | | res.Data.Packages.First().AUTH_ORG = input.AuthOption.CurOrg; |
| | | inv.Packages.First().QTY = inv.Barcode.Qty.ToDecimal(); |
| | | inv.Packages.First().ERP_WH = WarehouseCode; |
| | | inv.Packages.First().AUTH_ORG = input.AuthOption.CurOrg; |
| | | } |
| | | //å¦ææ«æå¤ç®±çä¸è½æ´æ°æ°é 2024-09-23 Ben Lin |
| | | else |
| | | { |
| | | foreach (var item in res.Data.Items) |
| | | foreach (var item in inv.Items) |
| | | { |
| | | //item.QTY = res.Data.Barcode.Qty.ToDecimal(); |
| | | //item.QTY = inv.Barcode.Qty.ToDecimal(); |
| | | item.ERP_WH = WarehouseCode; |
| | | item.AUTH_ORG = input.AuthOption.CurOrg; |
| | | } |
| | | foreach (var item in res.Data.Packages) |
| | | foreach (var item in inv.Packages) |
| | | { |
| | | //item.QTY = res.Data.Barcode.Qty.ToDecimal(); |
| | | //item.QTY = inv.Barcode.Qty.ToDecimal(); |
| | | item.ERP_WH = WarehouseCode; |
| | | item.AUTH_ORG = input.AuthOption.CurOrg; |
| | | } |
| | | } |
| | | //CustomerSupplyPuton.LocationCode = nLocation.LOCATION_CODE; |
| | | } |
| | | foreach (var item in res.Data.Items) |
| | | foreach (var item in inv.Items) |
| | | { |
| | | item.SOURCE_CODE = item.TRANS_CODE; |
| | | item.SOURCE_LINE = item.TRANS_LINE; |
| | |
| | | // 夿æ¯å¦æºè½è´§æ¶ |
| | | if (CustomerSupplyPuton.IsSmartRack) |
| | | { |
| | | ShelfApiResult shelfApiResult = await Share.Shelf.PutOn(TransID, Shelf, res.Data.Items[0]); |
| | | ShelfApiResult shelfApiResult = await Share.Shelf.PutOn(TransID, Shelf, inv.Items[0]); |
| | | if (!shelfApiResult.IsSuccess) |
| | | { |
| | | action.IsSuccessed = false; |
| | |
| | | } |
| | | |
| | | //夿å¨ä½æ¯å¦åæ¾ |
| | | if (nLocation.IS_SINGLE == "Y" && res.Data.Items.Count > 1) |
| | | if (nLocation.IS_SINGLE == "Y" && inv.Items.Count > 1) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.LocationSingleFailure"); //$"å¨ä½åªè½åæ¾ä¸ä¸ªç©æ"; |
| | |
| | | } |
| | | |
| | | //æ§è¡å
¥åº |
| | | Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(res.Data, input.AuthOption, nLocation.LOCATION_CODE); |
| | | Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE); |
| | | if (!putonResult.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = false; |
| | |
| | | // è¿åå
¶ä»å
¥åºå¯¹è±¡ |
| | | action.Data = new Model.Minsun.OtherInstockBarcodeOutput |
| | | { |
| | | Barcode = res.Data.SN, |
| | | MaterialCode = res.Data.Items[0].ITEM_CODE, |
| | | //MaterialName = res.Data.Items[0].ITEM_NAME, |
| | | //MaterialStandard = res.Data.ItemInfo.SPEC, |
| | | InitialQty = res.Data.Barcode.Qty ?? 0, |
| | | CurrentQty = res.Data.Barcode.Qty ?? 0, |
| | | Unit = res.Data.Items[0].UNIT, |
| | | DateCode = res.Data.Barcode.ProdDate ?? DateTime.MinValue, |
| | | LotNo = res.Data.SN, //æ¹æ¬¡å·é»è®¤ä¸ºå¤å
è£
æ¡ç |
| | | Barcode = inv.SN, |
| | | MaterialCode = inv.Items[0].ITEM_CODE, |
| | | //MaterialName = inv.Items[0].ITEM_NAME, |
| | | //MaterialStandard = inv.ItemInfo.SPEC, |
| | | InitialQty = inv.Barcode.Qty ?? 0, |
| | | CurrentQty = inv.Barcode.Qty ?? 0, |
| | | Unit = inv.Items[0].UNIT, |
| | | DateCode = inv.Barcode.ProdDate ?? DateTime.MinValue, |
| | | LotNo = inv.SN, //æ¹æ¬¡å·é»è®¤ä¸ºå¤å
è£
æ¡ç |
| | | //SourceBillCode = billCode, |
| | | LocationCode = nLocation.LOCATION_CODE, |
| | | //ReceiptCode = barcodeScanned?.BUSINESSCODE, |
| | | //IncompleteTips = isCompleted ? "æ°éï¼0 (0ç)" : iWMS.GetIncompleteTipsNew(barcodeScanned?.BUSINESSCODE, barcodeScanned?.ITEM_CODE), |
| | | IsScanShelf = false |
| | | }; |
| | | action.LocaleMsg = Biz.L("å
¥åºæå{0}", res.Data.SN); |
| | | action.LocaleMsg = Biz.L("å
¥åºæå{0}", inv.SN); |
| | | |
| | | } |
| | | //å
¶ä»å
¥åº |
| | | if (input.ReqType == 1) |
| | | { |
| | | Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true); |
| | | Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | } |
| | | var inv = result.Data; |
| | | var inv = result.Data as Inventory; |
| | | |
| | | //éªè¯æ¡ç æ¯å¦æ£ç¡® |
| | | if (!inv.isNormalStatus || !new[] { WMS_ITEM.STATUSs.WaitIn }.Contains(inv.Status)) |