From a4333018fea664d61608b314f2a571905077aef3 Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期二, 05 八月 2025 15:31:00 +0800
Subject: [PATCH] 同步
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs | 240 ------------------------------------------------------------
1 files changed, 0 insertions(+), 240 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs"
index f9c547c..718c44a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs"
@@ -43,79 +43,6 @@
throw new Exception("褰撳墠搴撲綅宸插瓨鍦ㄤ换鍔�");
}
- switch (result.MoveType)
- {
- case 1:
- CreateMoveTask(location);
- break;
- case 5:
- CreateFireTask(location);
- break;
- default:
- throw new Exception("鏃犳晥鐨勭Щ搴撶敵璇风被鍨�");
- }
-
- #region 鐏鍑哄簱
- //if (result.MoveType == 5)
- //{
- // Console.WriteLine($"鍒嗗妫�娴嬫煖鐏瑙﹀彂:搴撲綅{result.LocationID}");
-
- // //鏌ユ壘娑堥槻绔欏彴
- // var station = _stationManagerRepository.QueryFirst(t => t.Roadway == location.RoadwayNo
- // && t.stationType == (int)StationManager.FireStation
- // /*&& t. == "Enable"*/);
- // if (station == null)
- // {
- // throw new Exception("娑堥槻绔欏彴鏈厤缃�!");
- // }
- // //鏌ユ壘搴撳瓨淇℃伅
- // var barcodeData = _stockInfoRepository.QueryFirst(t => t.LocationCode == location.LocationCode);
- // //鎵樼洏鐮�
- // string barcode = string.Empty;
- // if (barcodeData != null)
- // {
- // barcode = barcodeData.PalletCode;
- // }
- // else
- // {
- // //鏃犲簱瀛樹俊鎭紝鐢熸垚闅忔満鎵樼洏鐮�
- // barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000);
- // }
- // int taskNum = _taskRepository.GetTaskNo().Result;
- // Dt_Task task = new Dt_Task
- // {
- // CreateDate = DateTime.Now,
- // Creater = "HK",
- // CurrentAddress = result.LocationID,
- // Grade = 1,
- // Dispatchertime = DateTime.Now,
- // PalletCode = barcode,
- // Roadway = location.RoadwayNo,
- // SourceAddress = result.LocationID,
- // TaskState = (int)TaskOutStatusEnum.OutNew,
- // TaskType = 500,
- // TargetAddress = station.stationLocation,
- // NextAddress = station.stationChildCode,
- // TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
- // TaskId = 0,
- // };
-
- // // 灏濊瘯娣诲姞鏂颁换鍔�
- // WMSTaskDTO taskDTO = new WMSTaskDTO()
- // {
- // TaskNum = task.TaskNum.Value,
- // Grade = 1,
- // PalletCode = task.PalletCode,
- // RoadWay = task.Roadway,
- // SourceAddress = task.SourceAddress,
- // TargetAddress = task.TargetAddress,
- // TaskState = task.TaskState.Value,
- // Id = 0,
- // TaskType = 500,
- // };
- //}
- #endregion
-
LogFactory.GetLog("鍒嗗绉诲簱鐢宠").Info(true, $"\r\r--------------------------------------");
LogFactory.GetLog("鍒嗗绉诲簱鐢宠").Info(true, result.ToJsonString());
return content.OK();
@@ -128,172 +55,5 @@
}
}
- private void CreateMoveTask(DtLocationInfo location)
- {
- Console.WriteLine($"鍒嗗鐢宠绉诲簱:搴撲綅{location.LocationCode}");
-
- //鏌ユ壘鍙敤搴撲綅
- DtLocationInfo CanRelocation = _locationRepository.QueryFirst(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == location.RoadwayNo && x.EnalbeStatus == 1 && x.LocationType == 2 && x.Remark == "1");
-
- if (CanRelocation == null) throw new Exception("鐢宠绉诲簱澶辫触锛氭棤鍙敤搴撲綅");
-
- //鏌ユ壘搴撳瓨淇℃伅
- var stockInfo = _stockInfoRepository.QueryFirst(x => x.LocationCode == location.LocationCode && x.LocationInfo.RoadwayNo == location.RoadwayNo);
-
- if (stockInfo == null) throw new Exception("鐢宠绉诲簱澶辫触锛氭棤搴撳瓨璁板綍");
-
- //淇敼绉诲簱鐩爣搴撲綅鐘舵��
- CanRelocation.LocationStatus = (int)LocationEnum.FreeDisable;
-
- int taskNum = _taskRepository.GetTaskNo().Result;
- Dt_Task task = new Dt_Task
- {
- CreateDate = DateTime.Now,
- Creater = "HK",
- CurrentAddress = location.LocationCode,
- Grade = 1,
- Dispatchertime = DateTime.Now,
- PalletCode = stockInfo.PalletCode,
- Roadway = location.RoadwayNo,
- SourceAddress = location.LocationCode,
- TaskState = (int)TaskStatus.Created,
- TaskType = (int)TaskRelocationTypeEnum.Relocation,
- TargetAddress = CanRelocation.LocationCode,
- NextAddress = CanRelocation.LocationCode,
- TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
- TaskId = 0,
- };
-
- // 灏濊瘯娣诲姞鏂颁换鍔�
- WMSTaskDTO taskDTO = new WMSTaskDTO()
- {
- TaskNum = task.TaskNum.Value,
- Grade = 1,
- PalletCode = task.PalletCode,
- RoadWay = task.Roadway,
- SourceAddress = task.SourceAddress,
- TargetAddress = task.TargetAddress,
- TaskState = task.TaskState.Value,
- Id = 0,
- TaskType = task.TaskType,
- };
-
- var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
- var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
- var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveByWMSTask)?.ConfigValue;
- if (ReceiveByWMSTask == null || ipAddress == null)
- {
- throw new Exception("WMS IP 鏈厤缃�");
- }
- var wmsIpAddrss = ipAddress + ReceiveByWMSTask;
-
- var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(taskDTO)); //http://localhost:9291/api/Task/ReceiveTask,
- if (respon != null)
- {
- WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString());
- if (respone.Status)
- {
- //娣诲姞WMS浠诲姟 骞朵慨鏀瑰簱浣嶇姸鎬�
- var taskId = _taskRepository.AddData(task);
- _locationRepository.UpdateData(CanRelocation);
- }
- else
- {
- throw new Exception("WCS澶勭悊澶辫触:" + respone.Message);
- }
- }
- else
- {
- throw new Exception("WCS澶勭悊澶辫触");
- }
- }
-
-
- private void CreateFireTask(DtLocationInfo location)
- {
- Console.WriteLine($"鍒嗗妫�娴嬫煖鐏瑙﹀彂:搴撲綅{location.LocationCode}");
-
- //鏌ユ壘娑堥槻绔欏彴
- var station = _stationManagerRepository.QueryFirst(t => t.Roadway == location.RoadwayNo
- && t.stationType == (int)StationManager.FireStation
- /*&& t. == "Enable"*/);
- if (station == null)
- {
- throw new Exception("娑堥槻绔欏彴鏈厤缃�!");
- }
- //鏌ユ壘搴撳瓨淇℃伅
- var barcodeData = _stockInfoRepository.QueryFirst(t => t.LocationCode == location.LocationCode);
- //鎵樼洏鐮�
- string barcode = string.Empty;
- if (barcodeData != null)
- {
- barcode = barcodeData.PalletCode;
- }
- else
- {
- //鏃犲簱瀛樹俊鎭紝鐢熸垚闅忔満鎵樼洏鐮�
- barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000);
- }
- int taskNum = _taskRepository.GetTaskNo().Result;
- Dt_Task task = new Dt_Task
- {
- CreateDate = DateTime.Now,
- Creater = "HK",
- CurrentAddress = location.LocationCode,
- Grade = 1,
- Dispatchertime = DateTime.Now,
- PalletCode = barcode,
- Roadway = location.RoadwayNo,
- SourceAddress = location.LocationCode,
- TaskState = (int)TaskOutStatusEnum.OutNew,
- TaskType = 500,
- TargetAddress = station.stationLocation,
- NextAddress = station.stationChildCode,
- TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
- TaskId = 0,
- };
-
- // 灏濊瘯娣诲姞鏂颁换鍔�
- WMSTaskDTO taskDTO = new WMSTaskDTO()
- {
- TaskNum = task.TaskNum.Value,
- Grade = 1,
- PalletCode = task.PalletCode,
- RoadWay = task.Roadway,
- SourceAddress = task.SourceAddress,
- TargetAddress = task.TargetAddress,
- TaskState = task.TaskState.Value,
- Id = 0,
- TaskType = 500,
- };
-
- var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
- var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
- var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveByWMSTask)?.ConfigValue;
- if (ReceiveByWMSTask == null || ipAddress == null)
- {
- throw new Exception("WMS IP 鏈厤缃�");
- }
- var wmsIpAddrss = ipAddress + ReceiveByWMSTask;
-
- var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(taskDTO)); //http://localhost:9291/api/Task/ReceiveTask,
- if (respon != null)
- {
- WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString());
- if (respone.Status)
- {
- var taskId = _taskRepository.AddData(task);
- }
-
- else
- {
- throw new Exception("WCS澶勭悊澶辫触:" + respone.Message);
- }
- }
- else
- {
- throw new Exception("WCS澶勭悊澶辫触");
- }
- }
}
}
\ No newline at end of file
--
Gitblit v1.9.3