´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/RworkTaskModel.cs
@@ -39,14 +39,26 @@ [PropertyValidate("卿", NotNullAndEmpty = true)] public string DateCode { get; set; } /// <summary> /// éæ±æ°é /// éæ±PCSæ°é /// </summary> [PropertyValidate("éæ±æ°é", NotNullAndEmpty = true)] public float RequiredQuantity { get; set; } /// <summary> /// éæ±SETæ°é /// </summary> public float RequiredSetCount { get; set; } /// <summary> /// ä»åº /// </summary> public string WarehouseCode { get; set; } /// <summary> /// å·¥å /// </summary> public string FactoryCode { get; set; } public string FactoryCode { get; set; } = "HA02"; /// <summary> /// æ¥æ¶ /// </summary> public int ReceiveDown { get; set; } /// <summary> /// éå®è®¢å /// </summary> ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_MesRworkOutboundOrder.cs
@@ -93,11 +93,16 @@ [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "卿")] public string DateCode { get; set; } /// <summary> /// éæ±æ°é /// éæ±PCSæ°é /// </summary> [SugarColumn(IsNullable = false, ColumnDescription = "éæ±æ°é", DefaultValue = "0")] public float RequiredQuantity { get; set; } /// <summary> /// éæ±SETæ°é /// </summary> [SugarColumn(IsNullable = false, ColumnDescription = "éæ±æ°é", DefaultValue = "0")] public float RequiredSetCount { get; set; } /// <summary> /// å·¥å /// </summary> [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å·¥å")] ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs
@@ -77,8 +77,7 @@ proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode)) .Includes(x => x.proStockInfoDetails) .Where(x => x.proStockInfoDetails .Any(v => v.SaleOrder == mesRworkOutboundOrder.SaleOrder && v.ProductCode == mesRworkOutboundOrder.ProductCode .Any(v => v.ProductCode == mesRworkOutboundOrder.ProductCode && v.ProductVersion == mesRworkOutboundOrder.ProductVersion && (isCanDate ? isCanDate : v.DateCode == mesRworkOutboundOrder.DateCode) )) ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs
@@ -109,7 +109,7 @@ public List<Dt_ProStockInfo> GetUseableStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder) { //è½¬æ¢æ æåä»ä»åºä¿¡æ¯è·åå°¾æ°å±æ§çè´§ä½ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==WarehouseEnum.HA71.ToString()); Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseId== mesRworkOutboundOrder.WarehouseId); List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehouse.WarehouseId); return BaseDal.GetProStocks(mesRworkOutboundOrder, locationCodes); } @@ -125,10 +125,14 @@ public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ProOutOrderDetail outOrderDetail, float needQuantity, out float residueQuantity) { List<Dt_ProStockInfo> assignOutStocks =new List<Dt_ProStockInfo>(); float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); bool isCanLot = string.IsNullOrEmpty(outOrderDetail.PLot); bool isCanDate = string.IsNullOrEmpty(outOrderDetail.DateCode); float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) .Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); if (stockTotalQuantity >= needQuantity)//åºåå¤ { int index = 0; @@ -233,7 +237,10 @@ public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ErpProScrapSheetDetail outOrderDetail, float needQuantity, out float residueQuantity) { List<Dt_ProStockInfo> assignOutStocks = new List<Dt_ProStockInfo>(); float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.ScrapProCode && x.ProductVersion == outOrderDetail.ScrapProVersion && x.LotNumber == outOrderDetail.ScrapProLotNo).Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); if (stockTotalQuantity >= needQuantity)//åºåå¤ { @@ -293,9 +300,12 @@ public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity) { List<Dt_ProStockInfo> assignOutStocks = new List<Dt_ProStockInfo>(); float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); bool isCanDate = string.IsNullOrEmpty(mesRworkOutboundOrder.DateCode); float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == mesRworkOutboundOrder.ProductCode && x.ProductVersion == mesRworkOutboundOrder.ProductVersion && (isCanDate ? isCanDate : x.DateCode == mesRworkOutboundOrder.DateCode)) .Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); if (stockTotalQuantity >= needQuantity)//åºåå¤ { int index = 0; @@ -303,8 +313,7 @@ { Dt_ProStockInfo stockInfo = stockInfos[index]; float useableStockQuantity = stockInfo.proStockInfoDetails .Where(x => x.SaleOrder == mesRworkOutboundOrder.SaleOrder && x.ProductCode == mesRworkOutboundOrder.ProductCode .Where(x => x.ProductCode == mesRworkOutboundOrder.ProductCode && x.ProductVersion == mesRworkOutboundOrder.ProductVersion && (isCanDate? isCanDate: x.DateCode == mesRworkOutboundOrder.DateCode)) .Sum(x => x.StockPcsQty - x.OutboundQuantity); @@ -317,7 +326,7 @@ { stockInfo.proStockInfoDetails.ForEach(x => { if ((x.StockPcsQty > x.OutboundQuantity) && x.SaleOrder == mesRworkOutboundOrder.SaleOrder if ((x.StockPcsQty > x.OutboundQuantity) && x.ProductCode == mesRworkOutboundOrder.ProductCode && x.ProductVersion == mesRworkOutboundOrder.ProductVersion && (isCanDate ? isCanDate : x.DateCode == mesRworkOutboundOrder.DateCode)) ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs
@@ -531,7 +531,7 @@ MesResponseContent content = new MesResponseContent(); try { Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString()); Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == model.WarehouseCode); if (warehouse == null) { return content.Error($"å°¾æ°ä»ä¿¡æ¯æªé ç½®"); @@ -546,17 +546,58 @@ { WarehouseId = warehouse.WarehouseId, TaskNo = model.TaskNo, OrderStatus = OutOrderStatusEnum.æªå¼å§.ObjToInt(), OrderStatus = OutOrderStatusEnum.åºåºä¸.ObjToInt(), CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), ProductCode = model.ProductCode, ProductName = model.ProductName, ProductName = model.ProductCode, ProductVersion = model.ProductVersion, DateCode = model.DateCode, RequiredQuantity = model.RequiredQuantity, RequiredSetCount=model.RequiredSetCount, FactoryCode = model.FactoryCode, SaleOrder = model.SaleOrder, SaleOrder = model.SaleOrder ?? "", OrderType = model.InventoryType }; if (model.DateCode.IndexOf("å¹³åº")>0 || warehouse.WarehouseCode==WarehouseEnum.HA101.ToString()) { Dt_Warehouse warehousePing = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); mesRworkOutboundOrder.WarehouseId = warehousePing.WarehouseId; mesRworkOutboundOrder.OrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); _unitOfWorkManage.BeginTran(); _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder); MesInventoryInfo mesInventoryInfo = new MesInventoryInfo() { Warhouseno = warehousePing.WarehouseCode, InternalPackageNumber = model.ProductCode, SetCount = (int)model.RequiredSetCount, EligiblePcsCount = (int)model.RequiredQuantity }; MesProductOutBound mesProductOutBound = new MesProductOutBound() { TaskNo = mesRworkOutboundOrder.TaskNo, ProductCode = mesRworkOutboundOrder.ProductCode, ProductVersion = mesRworkOutboundOrder.ProductVersion, DateCode = mesRworkOutboundOrder.DateCode, SaleOrder = mesRworkOutboundOrder.SaleOrder, InventoryInfo = new List<MesInventoryInfo> { mesInventoryInfo } }; if (model.ReceiveDown==EnableEnum.Enable.ObjToInt()) { _unitOfWorkManage.RollbackTran(); } else { //MESæååºåæ¿åºåºåæ¥ WebResponseContent responseContentPing = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(mesProductOutBound); if (!responseContentPing.Status) { throw new Exception("忥MESåºåæ¿åºåºå¤±è´¥,é误:" + responseContentPing.Message); } _unitOfWorkManage.CommitTran(); } return content.OK($"æä¾è¿åºåæ¥æ¶æå,ReceiveDown:{model.ReceiveDown}"); } List<Dt_Task> tasks = new List<Dt_Task>(); List<Dt_ProStockInfo>? proStockInfos = null; List<Dt_OutProStockInfo>? outProStockInfos = null; @@ -605,11 +646,16 @@ if (!updateContent.Status) { _unitOfWorkManage.RollbackTran(); return content.Error(updateContent.Message); throw new Exception(updateContent.Message); } } _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder); if (model.ReceiveDown == EnableEnum.Enable.ObjToInt()) { _unitOfWorkManage.RollbackTran(); } else { //MESæååºåæ¿åºåºåæ¥ WebResponseContent responseContent = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(_outboundService.RworkOutboundOrderService.MesProOutBound(mesRworkOutboundOrder, proStockInfoDetails)); if (!responseContent.Status) @@ -617,7 +663,8 @@ throw new Exception("忥MESåºåæ¿åºåºå¤±è´¥,é误:" + responseContent.Message); } _unitOfWorkManage.CommitTran(); return content.OK("æä¾è¿åºåæ¥æ¶æå"); } return content.OK($"æä¾è¿åºåæ¥æ¶æå,ReceiveDown:{model.ReceiveDown}"); } catch (Exception ex) {