From f947d43adfe6a204b6afe920ce88a30d78015f1d Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期五, 28 二月 2025 10:44:44 +0800 Subject: [PATCH] 板料优化,成品流程,测试架... --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 65 ++++++++++++++++++++------------ 1 files changed, 40 insertions(+), 25 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" index a608990..e74b420 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" @@ -258,7 +258,7 @@ WebResponseContent content = new WebResponseContent(); try { - Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_TestToolSync.ToString()); + Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_MaterialLotaAcept.ToString()); MESRoot<MesMaterialLotaAceptModel> root = new MESRoot<MesMaterialLotaAceptModel>() { From = "WMS", @@ -333,7 +333,16 @@ { try { - Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA57.ToString()); + string line = string.Empty; + if (!model.Line.Contains("SCUTL")) + { + line = WarehouseEnum.HA58.ToString(); + } + else + { + line = WarehouseEnum.HA57.ToString(); + } + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == line); if (warehouse == null) { return MesResponseContent.Instance.Error($"浠撳簱鍩虹淇℃伅鏈厤缃�"); @@ -385,6 +394,10 @@ throw new Exception("鏃犲簱瀛�"); } } + tasks.ForEach(x => + { + x.TargetAddress = model.Line; + }); _unitOfWorkManage.BeginTran(); int id = BaseDal.AddData(tasks); @@ -431,17 +444,11 @@ return MesResponseContent.Instance.Error($"鏈瘑鍒鎵樼洏绫诲瀷锛岃纭鎵樼洏鍙�"); } - Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode == WarehouseEnum.HA57.ToString()); + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == palletTypeInfo.WarehouseId); - Dt_StockInfo stockInfo = new Dt_StockInfo() - { - PalletCode = model.CarrierCode, - PalletType = palletTypeInfo.PalletType, - WarehouseId = warehouse.WarehouseId, - StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() - }; - Dt_StockInfoDetail_Hty stockInfoDetail_Hty = _stockRepository.StockInfoDetail_HtyRepository.QueryFirst(x => x.BatchNo == model.MaterialLot && x.MaterielCode == model.MaterialCode); + Dt_StockInfo_Hty stockInfo_Hty = _stockRepository.StockInfo_HtyRepository.QueryData(x => x.PalletCode == model.CarrierCode).OrderByDescending(x => x.SourceId).First(); + Dt_StockInfoDetail_Hty stockInfoDetail_Hty = _stockRepository.StockInfoDetail_HtyRepository.QueryFirst(x => x.StockId == stockInfo_Hty.SourceId); Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() { @@ -455,27 +462,35 @@ OutboundQuantity = 0, SerialNumber = stockInfoDetail_Hty?.SerialNumber ?? "0", StockQuantity = model.Quantity, - Status = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), + Status = model.Quantity <= 0.0 ? StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt() : StockStatusEmun.MES閫�搴�.ObjToInt(), Unit = model.Unit }; - - Dt_Task task = new Dt_Task() + Dt_StockInfo stockInfo = new Dt_StockInfo() { - PalletCode = stockInfo.PalletCode, - CurrentAddress = "", - NextAddress = "", - PalletType = stockInfo.PalletType, - Roadway = "RGV01_BC", - SourceAddress = "RGV01_BC", - TargetAddress = "", - TaskStatus = TaskStatusEnum.New.ObjToInt(), - TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(), - WarehouseId = warehouse.WarehouseId + PalletCode = model.CarrierCode, + PalletType = palletTypeInfo.PalletType, + WarehouseId = warehouse.WarehouseId, + StockStatus = stockInfoDetail.StockQuantity<=0.0? StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt():StockStatusEmun.MES閫�搴�.ObjToInt(), + Details = new List<Dt_StockInfoDetail> { stockInfoDetail }, + Remark= stockInfoDetail.StockQuantity <= 0.0 ? StockStatusEmun.MES绌烘墭閫�搴�.ToString() : StockStatusEmun.MES閫�搴�.ToString() }; + //Dt_Task task = new Dt_Task() + //{ + // PalletCode = stockInfo.PalletCode, + // CurrentAddress = "", + // NextAddress = "", + // PalletType = stockInfo.PalletType, + // Roadway = "RGV01_BC", + // SourceAddress = "RGV01_BC", + // TargetAddress = "", + // TaskStatus = TaskStatusEnum.New.ObjToInt(), + // TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(), + // WarehouseId = warehouse.WarehouseId + //}; _unitOfWorkManage.BeginTran(); Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); - BaseDal.AddData(task); + //BaseDal.AddData(task); _unitOfWorkManage.CommitTran(); return MesResponseContent.Instance.OK(); -- Gitblit v1.9.3