From 7d180121d133a3f2400ca2870cfb6cacd605d6cf Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 12 八月 2025 23:12:32 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 100 insertions(+), 3 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 1c3e7d4..7ba7bb8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -213,6 +213,7 @@
PalletType = stockInfo.PalletType,
MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode,
Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity,
+ BatchNo = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo
};
_unitOfWorkManage.BeginTran();
BaseDal.AddData(newTask);
@@ -516,8 +517,12 @@
});
#region todo:涓存椂鏇存柊鎵�鏈夌爺鍙戣浆鎴愬搧
- proStockInfo.ProStockAttribute=ProStockAttributeEnum.鎴愬搧.ObjToInt();
- proStockInfo.WarehouseId = locationInfo.WarehouseId;
+ if (proStockInfo.ProStockAttribute == ProStockAttributeEnum.鐮斿彂.ObjToInt())
+ {
+ proStockInfo.ProStockAttribute = ProStockAttributeEnum.鎴愬搧.ObjToInt();
+ proStockInfo.WarehouseId = locationInfo.WarehouseId;
+ }
+
#endregion
//鏇存柊鍏ュ簱鐘舵��
task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
@@ -820,10 +825,14 @@
switch (task.TaskType)
{
case (int)TaskTypeEnum.OutProduct:
+ case (int)TaskTypeEnum.OutSendProduct:
content = OutProductCompleted(task);
break;
case (int)TaskTypeEnum.OutMesRworkProduct:
content = OutMesRworkCompleted(task);
+ break;
+ case (int)TaskTypeEnum.OutProScrap:
+ content = OutProScrapCompleted(task);
break;
default:
content.Error("鏈煡浠诲姟绫诲瀷");
@@ -928,7 +937,12 @@
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
_unitOfWorkManage.CommitTran();
//MES鎴愬搧鍑哄簱鍚屾
- ShipmentOrderSync(MesOutSync(outProStockInfo, proOutOrderDetail, proStockInfoDetails));
+ if (task.TaskType!= TaskTypeEnum.OutSendProduct.ObjToInt())
+ {
+ MesShipmentOrderSync shipmentOrderSync = MesOutSync(outProStockInfo, proOutOrderDetail, proStockInfoDetails);
+ ShipmentOrderSync(shipmentOrderSync);
+ ShipmentOrderMESSync(shipmentOrderSync);
+ }
content.OK();
}
catch (Exception ex)
@@ -1017,6 +1031,89 @@
}
return content;
}
+ public WebResponseContent OutProScrapCompleted(Dt_Task task)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ //鑾峰彇璐т綅
+ Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ if (locationInfo == null)
+ {
+ return content.Error("鏈壘鍒拌揣浣嶄俊鎭�");
+ }
+ //鏍规嵁浠诲姟鑾峰彇鎴愬搧鍑哄簱璇︽儏浠诲姟鍙婄墿鏂欎俊鎭�
+ Dt_OutProStockInfo outProStockInfo = _outProStockInfoRepository.QueryFirst(x => x.TaskNum == task.TaskNum);
+ if (outProStockInfo == null)
+ {
+ return content.Error("鏈壘鍒版垚鍝佸嚭搴撹鎯�");
+ }
+ //鑾峰彇鎴愬搧鎶ュ簾鍗�
+
+ Dt_ErpProScrapSheet erpProScrapSheet = _outboundRepository.ErpProScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet>().Where(x => x.ProScrapSheetOrderNo == outProStockInfo.OrderNo).Includes(x=>x.Details).First();
+ if (erpProScrapSheet == null)
+ {
+ return content.Error("鏈壘鍒版垚鍝佹姤搴熷崟");
+ }
+ Dt_ErpProScrapSheetDetail erpProScrapSheetDetail = erpProScrapSheet.Details.FirstOrDefault(x => x.Id == outProStockInfo.OrderDetailId);
+ if (erpProScrapSheetDetail == null)
+ {
+ return content.Error("鏈壘鍒版垚鍝佹姤搴熷崟鏄庣粏");
+ }
+ if (erpProScrapSheetDetail.ScrapProDetailStatus == OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+ {
+ return content.Error($"鎴愬搧鎶ュ簾鍗曟槑缁嗚{erpProScrapSheetDetail.Id}宸插畬鎴�");
+ }
+ erpProScrapSheetDetail.ScrapProDetailStatus = OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ //鑾峰彇褰撳墠搴撳瓨
+ Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.proStockInfoDetails).First();
+ if (proStockInfo == null)
+ {
+ return content.Error($"鏈壘鍒皗task.PalletCode}搴撳瓨淇℃伅");
+ }
+ List<Dt_ProStockInfoDetail> proStockInfoDetails = proStockInfo.proStockInfoDetails;
+ if (proStockInfoDetails.Count <= 0)
+ {
+ return content.Error("鎴愬搧搴撳瓨鏄庣粏涓虹┖");
+ }
+ proStockInfoDetails.ForEach(x =>
+ {
+ x.ProOutDetailStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
+ });
+ proStockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
+ //鑾峰彇鎴愬搧骞冲簱
+ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString());
+ proStockInfo.WarehouseId = warehouse.WarehouseId;
+ proStockInfo.LocationCode = "鎴愬搧鍖呰鎷h揣鍖�";
+ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+ outProStockInfo.Status = OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ _unitOfWorkManage.BeginTran();
+ //璐т綅鍙樺姩璁板綍
+ int beforeStatus = locationInfo.LocationStatus;
+ locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _outboundRepository.ErpProScrapDetailRepository.UpdateData(erpProScrapSheetDetail);
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, proStockInfo.PalletType, LocationStatusEnum.Free, locationInfo.WarehouseId);
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, erpProScrapSheet?.ProScrapSheetOrderNo ?? "", task.TaskNum);
+ _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo);
+ _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfoDetails);
+ _outProStockInfoRepository.UpdateData(outProStockInfo);
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ //MES鎴愬搧搴撳瓨鏉垮嚭搴撳悓姝�
+ //WebResponseContent responseContent = ProductOutBoundSync(MesProOutBound(mesRworkOutboundOrder, proStockInfoDetails));
+ //if (!responseContent.Status)
+ //{
+ // throw new Exception("鍚屾MES搴撳瓨鏉垮嚭搴撳け璐�,閿欒:"+ responseContent.Message);
+ //}
+ _unitOfWorkManage.CommitTran();
+ content.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
/// <summary>
/// 鐩樼偣鍑哄簱瀹屾垚
/// </summary>
--
Gitblit v1.9.3