From 5f0b4758bed03060fd70b282d7fe56fa02d2f6d0 Mon Sep 17 00:00:00 2001 From: Zhang-Hong-Lin <a3219986988@163.com> Date: 星期三, 16 四月 2025 15:51:43 +0800 Subject: [PATCH] 1 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 196 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 196 insertions(+), 0 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index b793c5f..d66e4a6 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -51,6 +51,11 @@ private readonly Idt_ErrormsginfoService _ErrormsginfoService; private readonly IMapper _mapper; private readonly IRepository<dt_stationInfo> _dt_stationInfoRepository; + private readonly IRepository<Dt_Task> _dt_taskRepositiry; + private readonly IRepository<Dt_LocationInfo> _LocationInfoRepository; + private readonly IRepository<Dt_StockInfo> _StockInfoRepository; + private readonly IRepository<dt_batchInfo> _batchInfoRepository; + private readonly IRepository<dt_outstockinfo> _outStockRepository; private Dictionary<string, OrderByType> _taskOrderBy = new() { @@ -80,8 +85,13 @@ IRepository<Dt_Task_hty> taskhtyRepository, IRepository<dt_errormsgInfo> errorinfoRepository, IRepository<dt_stationInfo> dt_stationInfoRepository, + IRepository<Dt_Task> dt_taskRepositiry, Idt_ErrormsginfoService errormsginfoService, IUnitOfWorkManage unitOfWorkManage, + IRepository<Dt_StockInfo> StockInfoRepository, + IRepository<dt_batchInfo> batchInfoRepository, + IRepository<Dt_LocationInfo> LocationInfoRepository, + IRepository<dt_outstockinfo> outStockRepository, IMapper mapper) : base(BaseDal) { _routerService = routerService; @@ -96,6 +106,11 @@ _ErrormsginfoService = errormsginfoService; _mapper = mapper; _dt_stationInfoRepository = dt_stationInfoRepository; + _dt_taskRepositiry = dt_taskRepositiry; + _StockInfoRepository = StockInfoRepository; + _LocationInfoRepository = LocationInfoRepository; + _batchInfoRepository = batchInfoRepository; + _outStockRepository = outStockRepository; } /// <summary> @@ -1180,5 +1195,186 @@ } return content.OK("瀹屾垚"); } + + public WebResponseContent speciadelete(Dt_Task task) + { + WebResponseContent content = new WebResponseContent(); + if (task.TaskState == (int)TaskMoveStatusEnum.OutNewMove) + { + BaseDal.DeleteData(task); + } + else if (task.TaskState == (int)TaskInStatusEnum.InNew) + { + //鍓旈櫎鍏ュ簱 + var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "鍓旈櫎鏋�"); + string sourceAddress = station.Row + "-" + station.Column + "-1"; + if (task.SourceAddress.Equals(sourceAddress)) + { + Dt_LocationInfo locationinfo = _locationRepository.QueryFirst(v => v.LocationCode == task.TargetAddress); + locationinfo.LocationStatus = 0; + _unitOfWorkManage.BeginTran(); + _locationRepository.UpdateData(locationinfo); + BaseDal.DeleteData(task); + _unitOfWorkManage.CommitTran(); + return content.OK("2"); + } + else + { + //淇敼璐т綅淇℃伅 + var location = _locationRepository.QueryFirst(v => v.LocationCode == task.TargetAddress); + location.LocationStatus = (int)LocationStatusEnum.Free; + //淇敼璐т綅淇℃伅 + var locationtow = _locationRepository.QueryFirst(v => v.LocationCode == task.NextAddress); + locationtow.LocationStatus = (int)LocationStatusEnum.Free; + _unitOfWorkManage.BeginTran(); + _locationRepository.UpdateData(location); + _locationRepository.UpdateData(locationtow); + BaseDal.DeleteData(task); + _unitOfWorkManage.CommitTran(); + return content.OK("3"); + } + } + else if (task.TaskState == (int)TaskOutStatusEnum.OutNew) + { + //鍓旈櫎鍑哄簱 + var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "瑗胯法鏋跺瓙"); + string targetAddress = station.Row + "-" + station.Column + "-1"; + if (task.TargetAddress.Equals(targetAddress)) + { + //淇敼璐т綅淇℃伅 + var location = _locationRepository.QueryFirst(v => v.LocationCode == task.SourceAddress); + location.LocationStatus = (int)LocationStatusEnum.InStock; + Dt_StockInfo stockInfo = _stockRepository.QueryFirst(v => v.LocationCode == task.SourceAddress); + stockInfo.StockStatus = (int)stockEnum.Free; + _unitOfWorkManage.BeginTran(); + _locationRepository.UpdateData(location); + _stockRepository.UpdateData(stockInfo); + BaseDal.DeleteData(task); + _unitOfWorkManage.CommitTran(); + return content.OK("4"); + } + else + { + //淇敼璐т綅淇℃伅 + var location = _locationRepository.QueryFirst(v => v.LocationCode == task.SourceAddress); + location.LocationStatus = (int)LocationStatusEnum.InStock; + //淇敼璐т綅淇℃伅 + var locationtow = _locationRepository.QueryFirst(v => v.LocationCode == task.NextAddress); + locationtow.LocationStatus = (int)LocationStatusEnum.InStock; + + Dt_StockInfo stockInfo = _stockRepository.QueryFirst(v => v.LocationCode == task.SourceAddress); + stockInfo.StockStatus = (int)stockEnum.Free; + Dt_StockInfo stockInfos = _stockRepository.QueryFirst(v => v.LocationCode == task.NextAddress); + stockInfos.StockStatus = (int)stockEnum.Free; + _unitOfWorkManage.BeginTran(); + _locationRepository.UpdateData(location); + _locationRepository.UpdateData(locationtow); + _stockRepository.UpdateData(stockInfo); + _stockRepository.UpdateData(stockInfos); + BaseDal.DeleteData(task); + _unitOfWorkManage.CommitTran(); + return content.OK("5"); + } + } + return content.OK("1"); + } + + public WebResponseContent speciaupdate(Dt_Task task) + { + WebResponseContent content = new WebResponseContent(); + if (task.TaskState == (int)TaskInStatusEnum.InNew) + { + task.TaskState = (int)TaskInStatusEnum.Line_Ingrab; + BaseDal.UpdateData(task); + } + else if (task.TaskState == (int)TaskInStatusEnum.Line_Ingrab) + { + task.TaskState = (int)TaskInStatusEnum.InNew; + BaseDal.UpdateData(task); + } + else if (task.TaskState == (int)TaskOutStatusEnum.OutNew) + { + task.TaskState = (int)TaskOutStatusEnum.SC_OutExecuting; + BaseDal.UpdateData(task); + } + else if (task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) + { + task.TaskState = (int)TaskOutStatusEnum.OutNew; + BaseDal.UpdateData(task); + } + else + { + return content.OK("鐘舵�佷笉鍏佽"); + } + return content.OK("1"); + } + + public WebResponseContent banzidong(string wei,string weis) + { + WebResponseContent content = new WebResponseContent(); + //if (!OHTJob.oHTReadData.R_ZXJ_isWork) + //{ + // throw new Exception($"鏁村舰鏈烘姇鍏ヤ娇鐢ㄤ俊鍙蜂负false"); + //} + var isout = _outStockRepository.QueryFirst(v => v.Id == 1); + if (isout.isout == 0) + { + //if (!OHTJob.oHTReadData.R_ZXJ_TCMode) + //{ + // throw new Exception($"鏁村舰鏈轰笉灞炰簬澶╄溅涓婃枡妯″紡鎴栧ぉ杞︽斁鏉夸俊鍙蜂负false"); + //} + //if (!OHTJob.oHTReadData.R_HC_isReadyWork) + //{ + // throw new Exception($"鏁村舰鏈哄ぉ杞︽斁鏉夸俊鍙蜂负false"); + //} + //鏌ヨ褰撳墠浠诲姟姹犱腑鏄惁瀛樺湪鍑哄簱浠诲姟锛屽嚭搴撲换鍔″彧鑳藉瓨鍦ㄤ竴鏉� + var oldtask = _dt_taskRepositiry.QueryFirst(v => v.TaskType == (int)TaskOutboundTypeEnum.Outbound); + if (oldtask != null) + { + throw new Exception($"褰撳墠浠诲姟姹犱腑宸插瓨鍦ㄤ竴鏉″嚭搴撲换鍔�"); + } + + //鏌ヨ搴撳瓨 + Dt_StockInfo ku = _stockRepository.QueryFirst(v => v.LocationCode == wei); + if (ku == null) + { + return content.OK("3"); + } + //鏌ヨ鐩搁偦搴撳瓨 + Dt_StockInfo kus = _stockRepository.QueryFirst(v => v.LocationCode == weis); + ku.StockStatus = (int)stockEnum.Lock; + kus.StockStatus = (int)stockEnum.Lock; + //鏌ヨ璐т綅 + Dt_LocationInfo huo = _LocationInfoRepository.QueryFirst(v => v.LocationCode == wei); + //鏌ヨ鐩搁偦璐т綅 + Dt_LocationInfo huos = _LocationInfoRepository.QueryFirst(v => v.LocationCode == weis); + huo.LocationStatus = (int)LocationStatusEnum.Lock; + huos.LocationStatus = (int)LocationStatusEnum.Lock; + //鏌ヨ缁堢偣绔欏彴淇℃伅 + var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "鏁村舰鏈烘斁鏂欎綅"); + //寮�濮嬪垱寤轰换鍔� + Dt_Task outtask = new Dt_Task(); + outtask.Roadway = "TC01"; + outtask.TaskType = (int)TaskOutboundTypeEnum.Outbound; + outtask.TaskState = (int)TaskOutStatusEnum.OutNew; + outtask.SourceAddress = ku.LocationCode; + outtask.TargetAddress = station.Row + "-" + station.Column + "-1"; + outtask.NextAddress = huos.LocationCode; + outtask.Grade = 2; + outtask.WMSId = 3; + outtask.Remark = kus.Remark; + outtask.PalletCode = "text"; + outtask.CurrentAddress = "text"; + _unitOfWorkManage.BeginTran(); + _LocationInfoRepository.UpdateData(huo); + _LocationInfoRepository.UpdateData(huos); + _StockInfoRepository.UpdateData(ku); + _dt_taskRepositiry.AddData(outtask); + _StockInfoRepository.UpdateData(kus); + _unitOfWorkManage.CommitTran(); + return content.OK("2"); + } + return content.OK("1"); + } } } -- Gitblit v1.9.3