From a8a2f887f24681b0bee6edd2acdcccab3b12b73c Mon Sep 17 00:00:00 2001 From: wufan Date: Mon, 13 Jan 2025 10:34:58 +0800 Subject: [PATCH] :ambulance: --- .../OuterService/ShageService.ashx.cs | 28 +++++++++++-------- .../Models/DT_OrderUsedSalePlatform.cs | 5 ++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/TradeManageNew/OuterService/ShageService.ashx.cs b/TradeManageNew/OuterService/ShageService.ashx.cs index 8d7c618..2170dc7 100644 --- a/TradeManageNew/OuterService/ShageService.ashx.cs +++ b/TradeManageNew/OuterService/ShageService.ashx.cs @@ -1452,25 +1452,20 @@ namespace TradeManageNew.OuterService } var warehouseLocation = WarehouseLocation.East; - var storePositionQueryable = db.CK_StorePostion.AsQueryable(); - if (user.WorkDesc == "东仓") + if (user.WorkDesc == "西仓") { - storePositionQueryable = storePositionQueryable.Where(x => x.StoreId == 11); - } - else - { - storePositionQueryable = storePositionQueryable.Where(x => x.StoreId == 6); warehouseLocation = WarehouseLocation.West; } - var storePosition = storePositionQueryable.FirstOrDefault(x => x.PostionCode == input.WarehousePositionCode.Trim()); + var storePosition = db.CK_StorePostion.FirstOrDefault(x => + x.PostionCode == input.WarehousePositionCode.Trim()); if (storePosition is null) { throw new Exception( $"There is no storage location encoded as {input.WarehousePositionCode}"); } - var sku = db.HW_GoodsDetail.FirstOrDefault(x => x.DetailId==input.SkuId); + var sku = db.HW_GoodsDetail.FirstOrDefault(x => x.DetailId == input.SkuId); if (sku is null) { @@ -1479,6 +1474,10 @@ namespace TradeManageNew.OuterService var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == sku.GoodsId); + if (product is null) + { + throw new Exception($"There is no product with ID {sku.GoodsId}"); + } var newOrderUsedSalePlatform = new TradeUsedSale.Repositories.Models.DT_OrderUsedSalePlatform { @@ -1486,7 +1485,8 @@ namespace TradeManageNew.OuterService ProductCode = product.GoodsCode, SkuId = sku.DetailId, SkuCode = sku.SKU1, - BarCode = null, + BarCode =string.Empty, + IsPrinted = false, IsPublished = false, WarehouseLocation = warehouseLocation, WarehousePositionId = storePosition.PostionId, @@ -1497,7 +1497,13 @@ namespace TradeManageNew.OuterService }; var newOrderUsedSalePlatformId = db.InsertWithInt32Identity(newOrderUsedSalePlatform); - + var barCode = + $"{(warehouseLocation == WarehouseLocation.East ? "E" : "W")}{newOrderUsedSalePlatformId.ToString().PadLeft(7, '0')}"; + + db.DT_OrderUsedSalePlatform.Where(x => x.Id == newOrderUsedSalePlatformId) + .Set(x => x.BarCode, barCode) + .Update(); + md.Code = "100"; md.Result = "Success"; md.Data = JsonConvert.SerializeObject(newOrderUsedSalePlatform); diff --git a/TradeUsedSale/Repositories/Models/DT_OrderUsedSalePlatform.cs b/TradeUsedSale/Repositories/Models/DT_OrderUsedSalePlatform.cs index 9af608f..17d0ca3 100644 --- a/TradeUsedSale/Repositories/Models/DT_OrderUsedSalePlatform.cs +++ b/TradeUsedSale/Repositories/Models/DT_OrderUsedSalePlatform.cs @@ -33,6 +33,11 @@ namespace TradeUsedSale.Repositories.Models /// public string BarCode { get; set; } + /// + /// 是否已打印 + /// + public bool IsPrinted { get; set; } + /// /// 是否已推送 ///