From ceb8c334e8ca10d569b4c7f72b74126ce1877e48 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期二, 07 一月 2025 21:51:51 +0800 Subject: [PATCH] 添加辅料仓功能,优化测试架仓代码 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs | 16 代码管理/淮安PDA/pages/stash/InPinku.vue | 522 +++++++++++++++++++++++++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/辅料仓/AGV_FLExtend.cs | 106 +++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs | 272 ++++++++++++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/辅料仓/AGV_FLJob.cs | 8 代码管理/淮安PDA/common/config.js | 6 代码管理/淮安PDA/pages/stash/boxing.vue | 11 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 5 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 71 ++- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs | 6 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs | 14 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs | 18 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs | 4 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 19 16 files changed, 1,010 insertions(+), 72 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs" index 6f9e592..87f2e46 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs" @@ -10,16 +10,22 @@ public enum APIEnum { /// <summary> - /// AGV鍙戦�佷换鍔℃帴鍙� + /// 娴嬭瘯鏋禔GV鍙戦�佷换鍔℃帴鍙� /// </summary> - [Description("AGV鍙戦�佷换鍔℃帴鍙�")] - AgvSendTask, + [Description("娴嬭瘯鏋禔GV鍙戦�佷换鍔℃帴鍙�")] + Agv_CSJSendTask, /// <summary> - /// AGV瀹夊叏淇″彿鍥炲 + /// 娴嬭瘯鏋禔GV瀹夊叏淇″彿鍥炲 /// </summary> - [Description("AGV瀹夊叏淇″彿鍥炲")] - AgvSecureReply, + [Description("娴嬭瘯鏋禔GV瀹夊叏淇″彿鍥炲")] + Agv_CSJSecureReply, + + /// <summary> + /// 杈呮枡AGV浠诲姟鍙戦�� + /// </summary> + [Description("杈呮枡AGV浠诲姟鍙戦��")] + Agv_FLSendTask, /// <summary> /// 鍥炶皟WMS浠诲姟瀹屾垚 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" index 59634bc..5938d89 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" @@ -28,6 +28,10 @@ /// </summary> public List<CodePath> PositionCodePath { get; set; } /// <summary> + /// 鎵樼洏鍙� + /// </summary> + public string ctnrCode { get; set; } + /// <summary> /// 杞藉叿缂栧彿 /// </summary> public string PodCode { get; set; } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" index fee17b8..4fc6f04 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" @@ -23,6 +23,7 @@ using System.Text; using System.Threading.Tasks; using WIDESEA_DTO.Agv; +using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseServices; @@ -138,7 +139,7 @@ /// </summary> /// <param name="taskModel"></param> /// <returns></returns> - WebResponseContent AgvSendTask(AgvTaskDTO taskModel); + WebResponseContent AgvSendTask(AgvTaskDTO taskModel, APIEnum SendTask = APIEnum.Agv_CSJSendTask); /// <summary> /// 瀹夊叏淇″彿鐢宠 /// </summary> @@ -150,7 +151,7 @@ /// </summary> /// <param name="secureModel"></param> /// <returns></returns> - WebResponseContent AgvSecureReply(AgvSecureReplyDTO secureReplyModel); + WebResponseContent AgvSecureReply(AgvSecureReplyDTO secureReplyModel, APIEnum SecureReply = APIEnum.Agv_CSJSecureReply); /// <summary> /// AGV浠诲姟鐘舵�佸埛鏂� /// </summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" similarity index 100% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs" new file mode 100644 index 0000000..f7a2020 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs" @@ -0,0 +1,272 @@ +锘縰sing Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using WIDESEA_DTO.Agv; +using WIDESEAWCS_Common.TaskEnum; +using WIDESEAWCS_Core; +using WIDESEAWCS_Core.Enums; +using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_IBasicInfoRepository; +using WIDESEAWCS_ITaskInfoRepository; +using WIDESEAWCS_ITaskInfoService; +using WIDESEAWCS_Model.Models; +using WIDESEAWCS_QuartzJob; +using WIDESEAWCS_Tasks; + +namespace WIDESEAWCS_Server.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class CTU_AGVController : ControllerBase + { + private readonly IStationMangerRepository _stationMangerRepository; + private readonly ITaskService _taskService; + private readonly ITaskRepository _taskRepository; + + public CTU_AGVController(IStationMangerRepository stationMangerRepository, ITaskService taskService, ITaskRepository taskRepository) + { + _stationMangerRepository = stationMangerRepository; + _taskService = taskService; + _taskRepository = taskRepository; + } + + #region 瀹夊叏淇″彿鐢宠 + /// <summary> + /// 瀹夊叏淇″彿鐢宠 AGV-WCS + /// </summary> + /// <param name="secureApplyModel"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("AgvSecureApply"), AllowAnonymous] + public AgvResponseContent AgvSecureApply([FromBody] AgvSecureApplyDTO secureApplyModel) + { + AgvResponseContent agvResponseContent = new AgvResponseContent(); + agvResponseContent.ReqCode = secureApplyModel.ReqCode; + try + { + var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum); + if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); + if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + { + var content = PutRequest(task.NextAddress, task.PalletType); + } + else + { + var content = TakeRequest(task.CurrentAddress); + } + task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); + var up = _taskRepository.UpdateData(task); + agvResponseContent.Code = up ? "0" : "1"; + agvResponseContent.Message = up ? "鎴愬姛" : "澶辫触"; + } + catch (Exception ex) + { + agvResponseContent.Code = "1"; + agvResponseContent.Message = ex.Message; + } + return agvResponseContent; + //return _taskService.AgvSecureApply(secureApplyModel); + } + #endregion + + /// <summary> + /// CtuAGV浠诲姟鏇存柊/瀹屾垚 + /// </summary> + /// <param name="agvUpdateModel"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("CtuCallback"), AllowAnonymous] + public AgvResponseContent CtuCallback([FromBody] AgvUpdateDTO agvUpdateModel) + { + AgvResponseContent agvResponseContent = new AgvResponseContent(); + try + { + if (agvUpdateModel == null) throw new Exception("鏈幏鍙栧埌璇锋眰鍙傛暟"); + agvResponseContent.ReqCode = agvUpdateModel.ReqCode; + var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum); + if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟鍙枫�恵agvUpdateModel.TaskCode}銆�"); + + if (agvUpdateModel.Method == "end") + { + if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) PutFinish(task.NextAddress); + _taskService.TaskCompleted(task.TaskNum); + } + agvResponseContent.Code = "0"; + agvResponseContent.Message = "鎴愬姛"; + } + catch (Exception ex) + { + agvResponseContent.Code = "1"; + agvResponseContent.Message = ex.Message; + } + return agvResponseContent; + } + + /// <summary> + /// 鏀捐揣璇锋眰 + /// </summary> + /// <param name="code"></param> + /// <param name="palletType"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("PutRequest"), AllowAnonymous] + public WebResponseContent PutRequest(string code, int palletType) + { + try + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); + if (stationManger == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃�"); + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�"); + } + + OtherDevice otherDevice = (OtherDevice)device; + + bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); + if (canPut) + { + otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); + return WebResponseContent.Instance.OK(); + } + else + { + otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); + Thread.Sleep(1000); + canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); + if (canPut) + { + return WebResponseContent.Instance.OK(); + } + else + { + return WebResponseContent.Instance.Error($"鏀捐揣鐢宠涓�"); + } + } + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + //[HttpPost, HttpGet, Route("PutFinish"), AllowAnonymous] + /// <summary> + /// 鏀捐揣瀹屾垚 + /// </summary> + /// <param name="code"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("PutFinish"), AllowAnonymous] + public WebResponseContent PutFinish(string code) + { + try + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); + if (stationManger == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃�"); + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�"); + } + + OtherDevice otherDevice = (OtherDevice)device; + otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode); + + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + //[HttpPost, HttpGet, Route("TakeRequest"), AllowAnonymous] + /// <summary> + /// 鍙栬揣璇锋眰 + /// </summary> + /// <param name="code"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("TakeRequest"), AllowAnonymous] + public WebResponseContent TakeRequest(string code) + { + try + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); + if (stationManger == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃�"); + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�"); + } + + OtherDevice otherDevice = (OtherDevice)device; + + bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); + if (canPut) + { + otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); + return WebResponseContent.Instance.OK(); + } + else + { + otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); + Thread.Sleep(1000); + canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); + if (canPut) + { + return WebResponseContent.Instance.OK(); + } + else + { + return WebResponseContent.Instance.Error($"鍙栬揣鐢宠涓�"); + } + } + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + //[HttpPost, HttpGet, Route("TakeFinish"), AllowAnonymous] + /// <summary> + /// 鍙栬揣瀹屾垚 + /// </summary> + /// <param name="code"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("TakeFinish"), AllowAnonymous] + public WebResponseContent TakeFinish(string code) + { + try + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); + if (stationManger == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃�"); + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�"); + } + + OtherDevice otherDevice = (OtherDevice)device; + otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); + Thread.Sleep(1000); + otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" index f36a589..5fa9778 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" @@ -19,14 +19,14 @@ /// </summary> /// <param name="taskModel"></param> /// <returns></returns> - public WebResponseContent AgvSendTask(AgvTaskDTO taskModel) + public WebResponseContent AgvSendTask(AgvTaskDTO taskModel, APIEnum SendTask = APIEnum.Agv_CSJSendTask) { WebResponseContent content = new WebResponseContent(); try { - string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.AgvSendTask.ToString())?.ApiAddress; - if (string.IsNullOrEmpty(apiAddress)) - return WebResponseContent.Instance.Error($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�"); // AppSettings.Get(APIEnum.AgvSendTask.ToString()); + string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == SendTask.ToString())?.ApiAddress; + if (string.IsNullOrEmpty(apiAddress)) + return WebResponseContent.Instance.Error($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�"); string response = HttpHelper.Post(apiAddress, taskModel.Serialize()); AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); if (agvContent.Code == "0") @@ -56,14 +56,14 @@ /// </summary> /// <param name="secureModel"></param> /// <returns></returns> - public WebResponseContent AgvSecureReply(AgvSecureReplyDTO secureReplyModel) + public WebResponseContent AgvSecureReply(AgvSecureReplyDTO secureReplyModel, APIEnum SecureReply = APIEnum.Agv_CSJSecureReply) { WebResponseContent content = new WebResponseContent(); try { - string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.AgvSecureReply.ToString())?.ApiAddress; + string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == SecureReply.ToString())?.ApiAddress; if (string.IsNullOrEmpty(apiAddress)) - return WebResponseContent.Instance.Error($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�"); // AppSettings.Get(APIEnum.AgvSendTask.ToString());// AppSettings.Get(APIEnum.AgvSecureReply.ToString()); + return WebResponseContent.Instance.Error($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�"); string response = HttpHelper.Post(apiAddress, secureReplyModel.Serialize()); AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); if (agvContent.Code == "0") diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index 248436a..833dff5 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -116,7 +116,8 @@ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); if (task != null) { - BaseDal.DeleteAndMoveIntoHty(task, App.User == null ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚); + task.TaskState = TaskStatusEnum.Finish.ObjToInt(); + BaseDal.DeleteAndMoveIntoHty(task, App.User?.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚); } string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) @@ -189,7 +190,7 @@ if (routers.Count == 1) { - if(taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode) + if (taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode) { task.NextAddress = router.NextPosi; task.DeviceCode = stationManger.StationDeviceCode; @@ -197,7 +198,15 @@ else { task.NextAddress = item.TargetAddress; - task.DeviceCode = stationManger.StationDeviceCode; + if (item.RoadWay.Contains("AGV")) + { + task.DeviceCode = item.RoadWay; + task.AgvTaskNum = task.DeviceCode + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; + } + else + { + task.DeviceCode = stationManger.StationDeviceCode; + } } } else @@ -210,7 +219,7 @@ { if (taskTypeGroup == TaskTypeGroup.OutbondGroup) { - task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; + task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi); if (routers.FirstOrDefault() == null) { @@ -224,7 +233,7 @@ } else { - task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; + task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi); if (routers.FirstOrDefault() == null) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" similarity index 92% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" index 0afac43..788399b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" @@ -14,7 +14,7 @@ namespace WIDESEAWCS_Tasks { - public partial class AGVJob + public partial class AGV_CSJJob { /// <summary> /// 涓嬪彂AGV浠诲姟 @@ -23,7 +23,7 @@ { try { - var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); + var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); foreach (var agvTask in newTasks) { try @@ -66,14 +66,14 @@ agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); //agvTask.Remark = content.Data.ObjToString(); agvTask.ExceptionMessage = ex.Message; - WriteError(nameof(AGVJob), ex.Message, ex); + WriteError(nameof(AGV_CSJJob), ex.Message, ex); } } _taskService.UpdateData(newTasks); } catch (Exception ex) { - WriteError(nameof(AGVJob), ex.Message, ex); + WriteError(nameof(AGV_CSJJob), ex.Message, ex); } } /// <summary> @@ -83,10 +83,10 @@ { try { - var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); + var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); foreach (var WaitToTask in WaitToTasks) { - if(WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) + if (WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) { Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.NextAddress); if (stationManger == null) @@ -101,7 +101,7 @@ OtherDevice otherDevice = (OtherDevice)device; bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); bool requestPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_PutRequest, stationManger.StationCode); - if(!requestPut) + if (!requestPut) { otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); continue; @@ -157,7 +157,7 @@ } catch (Exception ex) { - Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); + Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs" similarity index 81% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs" index 3371042..fa01a83 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs" @@ -21,7 +21,7 @@ namespace WIDESEAWCS_Tasks { [DisallowConcurrentExecution] - public partial class AGVJob : JobBase, IJob + public partial class AGV_CSJJob : JobBase, IJob { public readonly ITaskService _taskService; private readonly ITaskExecuteDetailService _taskExecuteDetailService; @@ -29,7 +29,7 @@ private readonly IStationMangerRepository _stationMangerRepository; private readonly IMapper _mapper; - public AGVJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) + public AGV_CSJJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; @@ -47,7 +47,7 @@ } catch (Exception ex) { - Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); + Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message); } return Task.CompletedTask; } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\350\276\205\346\226\231\344\273\223/AGV_FLExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\350\276\205\346\226\231\344\273\223/AGV_FLExtend.cs" new file mode 100644 index 0000000..cbbc35f --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\350\276\205\346\226\231\344\273\223/AGV_FLExtend.cs" @@ -0,0 +1,106 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_DTO.Agv; +using WIDESEAWCS_Common.APIEnum; +using WIDESEAWCS_Common.TaskEnum; +using WIDESEAWCS_Core; +using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_Model.Models; +using WIDESEAWCS_Tasks.StackerCraneJob; + +namespace WIDESEAWCS_Tasks +{ + public partial class AGV_FLJob + { + /// <summary> + /// 涓嬪彂AGV浠诲姟 + /// </summary> + public void SendAGVTask() + { + try + { + var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && nameof(AGV_FLJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); + foreach (var task in newTasks) + { + try + { + if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + task.CurrentAddress = GetAGVAddress(task.CurrentAddress); + else + task.NextAddress = GetAGVAddress(task.NextAddress); + AgvTaskDTO taskDTO = new AgvTaskDTO() + { + TaskCode = task.AgvTaskNum, + ReqCode = DateTime.Now.ToString("yyyyMMddHHmmss"), + TaskTyp = task.TaskType == TaskTypeEnum.Outbound.ObjToInt() ? "FLC" : "FLR", + ctnrCode = task.PalletCode, + PositionCodePath = new List<CodePath>() + { + new CodePath() + { + type="05", + positionCode=task.CurrentAddress + }, + new CodePath() + { + type="05", + positionCode=task.NextAddress + } + }, + }; + //WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_FLSendTask); + //if (!content.Status) throw new Exception(content.Message); + + task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); + + } + catch (Exception ex) + { + task.TaskState = TaskStatusEnum.Exception.ObjToInt(); + task.ExceptionMessage = ex.Message; + } + } + _taskService.UpdateData(newTasks); + } + catch (Exception ex) + { + WriteError(nameof(AGV_FLJob), ex.Message, ex); + } + } + /// <summary> + /// 鑾峰彇AGV鍦板潃 + /// </summary> + /// <param name="Address"></param> + /// <returns></returns> + public static string GetAGVAddress(string Address) + { + string[] targetCodes = Address.Split("-"); + if (targetCodes.Length == 5) + { + var Row = Convert.ToInt16(targetCodes[1]); + var Column = Convert.ToInt16(targetCodes[2]); + var Layer = Convert.ToInt16(targetCodes[3]); + var a = Row switch + { + 1 => "A1", + 2 => "B1", + 3 => "C1", + 4 => "D1", + 5 => "E1", + _ => throw new Exception($"鏈畾涔夌殑鎺�,鍦板潃:銆恵Address}銆�"), + }; + var b = Layer > 9 ? "" + Layer : "0" + Layer; + var c = Column > 9 ? "" + Column : "0" + Column; + Address = a + b + c; + } + else + { + throw new Exception($"鍦板潃鏈夎,鍦板潃:銆恵Address}銆�"); + } + return Address; + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\350\276\205\346\226\231\344\273\223/AGV_FLJob.cs" similarity index 79% copy from "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" copy to "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\350\276\205\346\226\231\344\273\223/AGV_FLJob.cs" index 3371042..4c08066 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\350\276\205\346\226\231\344\273\223/AGV_FLJob.cs" @@ -21,7 +21,7 @@ namespace WIDESEAWCS_Tasks { [DisallowConcurrentExecution] - public partial class AGVJob : JobBase, IJob + public partial class AGV_FLJob : JobBase, IJob { public readonly ITaskService _taskService; private readonly ITaskExecuteDetailService _taskExecuteDetailService; @@ -29,7 +29,7 @@ private readonly IStationMangerRepository _stationMangerRepository; private readonly IMapper _mapper; - public AGVJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) + public AGV_FLJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; @@ -42,12 +42,10 @@ try { SendAGVTask(); - - SendAGVWaitToTask(); } catch (Exception ex) { - Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); + Console.Out.WriteLine(nameof(AGV_FLJob) + ":" + ex.Message); } return Task.CompletedTask; } 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 c944a34..3d8e7d2 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" @@ -103,7 +103,7 @@ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum); _unitOfWorkManage.CommitTran(); //灏嗕换鍔℃帹閫佸埌WCS - PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV"); + PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV_CSJ"); responseContent.OK(); } catch (Exception ex) @@ -155,7 +155,7 @@ BaseDal.AddData(taskIn); _stockRepository.StockInfoRepository.UpdateData(stockInfo); //灏嗕换鍔℃帹閫佸埌WCS - PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV"); ; + PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_CSJ"); ; responseContent.OK(); } catch (Exception ex) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index 2da55a0..664fc0a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -7,6 +7,7 @@ using WIDESEA_Common.LocationEnum; using WIDESEA_Common.StockEnum; using WIDESEA_Common.TaskEnum; +using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; using WIDESEA_Core.Helper; using WIDESEA_DTO.Task; @@ -29,6 +30,11 @@ var palletCode = saveModel.MainData["barcode"].ToString(); var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); var stationCode = saveModel.MainData["startPoint"].ToString(); + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); + if (warehouse == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板簱鍖�"); + } Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode && x.WarehouseId == warehouseId); if (task != null) { @@ -57,37 +63,45 @@ { return WebResponseContent.Instance.Error($"浠撳簱涓嶆纭�"); } - - Dt_Task newTask = new Dt_Task() + if (warehouse.WarehouseCode == WarehouseEnum.HA60.ToString()) { - CurrentAddress = stationCode, - Grade = 0, - NextAddress = "", - PalletCode = palletCode, - Roadway = "", - SourceAddress = stationCode, - TargetAddress = "", - TaskType = TaskTypeEnum.Inbound.ObjToInt(), - TaskStatus = TaskStatusEnum.New.ObjToInt(), - WarehouseId = stockInfo.WarehouseId, - PalletType = stockInfo.PalletType - }; - - if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) - { - stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseId); + if (locationInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒板綋鍓嶅簱鍖鸿揣浣嶄俊鎭�"); + return DeviceRequestInboundTask(stationCode, locationInfo.RoadwayNo, palletCode); } else { - stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + Dt_Task newTask = new Dt_Task() + { + CurrentAddress = stationCode, + Grade = 0, + NextAddress = "", + PalletCode = palletCode, + Roadway = "", + SourceAddress = stationCode, + TargetAddress = "", + TaskType = TaskTypeEnum.Inbound.ObjToInt(), + TaskStatus = TaskStatusEnum.New.ObjToInt(), + WarehouseId = stockInfo.WarehouseId, + PalletType = stockInfo.PalletType + }; + + if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) + { + stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + } + else + { + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + } + _unitOfWorkManage.BeginTran(); + int taskId = BaseDal.AddData(newTask); + newTask.TaskId = taskId; + _stockRepository.StockInfoRepository.UpdateData(stockInfo); + _unitOfWorkManage.CommitTran(); + PushTasksToWCS(new List<Dt_Task> { newTask }); + return WebResponseContent.Instance.OK(data: newTask); } - _unitOfWorkManage.BeginTran(); - int taskId = BaseDal.AddData(newTask); - newTask.TaskId = taskId; - _stockRepository.StockInfoRepository.UpdateData(stockInfo); - _unitOfWorkManage.CommitTran(); - PushTasksToWCS(new List<Dt_Task> { newTask }); - return WebResponseContent.Instance.OK(data: newTask); } catch (Exception ex) { @@ -154,14 +168,17 @@ { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); } + LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; _unitOfWorkManage.BeginTran(); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); int taskId = BaseDal.AddData(newTask); newTask.TaskId = taskId; _stockRepository.StockInfoRepository.UpdateData(stockInfo); _unitOfWorkManage.CommitTran(); WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); - //PushTasksToWCS(new List<Dt_Task> { newTask }); + PushTasksToWCS(new List<Dt_Task> { newTask }); return WebResponseContent.Instance.OK(data: wMSTaskDTO); } catch (Exception ex) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" index 0e01f92..4d97816 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" @@ -1,8 +1,8 @@ let config = { - baseUrl: 'http://10.30.4.92:9283', + baseUrl: 'http://10.30.5.60:9293', urls: [ - 'http://10.30.4.92:9283', - 'http://10.30.4.92:9283' + 'http://10.30.5.60:9293', + 'http://10.30.5.60:9293' ] } export { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/InPinku.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/InPinku.vue" new file mode 100644 index 0000000..34a0abe --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/InPinku.vue" @@ -0,0 +1,522 @@ +<template> + <view> + <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem"> + </uni-segmented-control> + <view class="content"> + <view v-if="current === 0" class="headerstyle"> + <view class="itemstyle"> + <uni-forms label-width="180"> + <uni-forms-item label="鍐呯鏍囩:"> + <uni-easyinput type="text" placeholder="璇锋壂鎻忓唴绠辨爣绛�" ref='midInput' :focus="focus" + v-model="materSn" @input="snInput" /> + </uni-forms-item> + <uni-forms-item> + <button @click="submit" type="primary" size="default" style="margin-top: 2%;">鍏ュ钩搴�</button> + </uni-forms-item> + </uni-forms> + <uni-list> + <uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index"> + <template v-slot:body> + <view class="uni-list-box"> + <uni-icons type="trash" size="22" style="position: absolute;right: 5%;" + @click="deleteList(index)"> + </uni-icons> + <view class="uni-content"> + <view class="uni-title-sub uni-ellipsis-2">閲囪喘鍗曞彿锛歿{item.purchaseOrderNo}}</view> + <view class="uni-note">鐗╂枡缂栫爜锛歿{item.materielCode}}</view> + <view class="uni-note">鎵规鍙凤細{{item.lotNo}}</view> + <view class="uni-note">鏁伴噺锛歿{item.quantity}}</view> + <view class="uni-note">鐢熶骇鏃ユ湡锛歿{item.productionDate}}</view> + <view class="uni-note">鏈夋晥鏈燂細{{item.effectiveDate}}</view> + </view> + </view> + </template> + </uni-list-item> + </uni-list> + </view> + </view> + <view v-if="current === 1" class="headerstyle"> + <view class="itemstyle"> + <uni-forms label-width="120"> + <uni-forms-item label="鎵樼洏鏉$爜"> + <uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode" + placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" ref='midInput' @input="inputChangebarcode" /> + </uni-forms-item> + <uni-forms-item label="鍦板潃鏉$爜"> + <uni-easyinput type="text" v-model="address" placeholder="璇锋壂鎻忓湴鍧�鏉$爜" ref='midInput' + :focus="addressFocus" /> + </uni-forms-item> + <uni-forms-item> + <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">鍏ュ簱纭</button> + </uni-forms-item> + </uni-forms> + </view> + </view> + <view v-if="current === 2" class="headerstyle"> + <view class="itemstyle"> + <uni-list :border="true"> + <uni-list-item direction="column" v-for="(item,index) in orderInfo" :key="index"> + <template v-slot:body> + <view class="uni-list-box"> + <view class="uni-content"> + <view style="font-size: 18px;">鍗曟嵁鍙凤細{{orderNo}}</view> + <view style="font-size: 18px;">鐗╂枡缂栫爜锛歿{item.materielCode}}</view> + <!-- <view style="font-size: 18px;">鐗╂枡鍚嶇О锛歿{item.matName}}</view> --> + <view style="font-size: 18px;">鏁伴噺锛歿{item.orderQuantity}}</view> + <view style="font-size: 18px;">鍗曚綅锛歿{item.unit}}</view> + <view style="font-size: 18px;">缁勭洏鏁伴噺锛歿{item.receiptQuantity}}</view> + </view> + </view> + </template> + </uni-list-item> + </uni-list> + </view> + </view> + <view v-if="current === 3" class="headerstyle"> + <view class="itemstyle"> + <uni-forms label-width="120"> + <uni-forms-item> + <uni-easyinput type="text" @input="releaseboxInput" v-model="value" placeholder="璇锋壂鐮�" + ref='midInput' :focus="true" /> + </uni-forms-item> + <uni-forms-item> + <button @click="releasebox" type="primary" size="default">瑙g洏</button> + </uni-forms-item> + </uni-forms> + <uni-list> + <uni-list-item direction="column" v-if="value2"> + <template v-slot:body> + <view class="uni-list-box"> + <view class="uni-content"> + <view class="uni-title-sub uni-ellipsis-2">鎵樼洏鍙凤細{{value2}}</view> + </view> + </view> + </template> + </uni-list-item> + <uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode"> + <template v-slot:body> + <view class="uni-list-box"> + <view class="uni-content"> + <view class="uni-title-sub uni-ellipsis-2">鐗╂枡缂栫爜锛歿{item.matCode}}</view> + <view class="uni-title-sub uni-ellipsis-2">鏁伴噺锛歿{item.matQuantity}}</view> + </view> + </view> + </template> + </uni-list-item> + + <uni-list-item direction="column" v-for="(item,index) in matInfo" :key="index"> + <template v-slot:body> + <view class="uni-list-box"> + <view class="uni-content"> + <view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;"> + 鐗╂枡缂栫爜锛歿{item.matCode}} + </view> + <view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;"> + 鐗╂枡鍚嶇О锛歿{item.matName}} + </view> + <view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;"> + 鏁伴噺锛歿{item.matQty}} + </view> + </view> + </view> + </template> + </uni-list-item> + </uni-list> + </view> + </view> + </view> + <u-toast ref="uToast" /> + </view> +</template> + +<script> + const innerAudioContext = uni.createInnerAudioContext(); + export default { + data() { + return { + items: ['鍏ュ钩搴�'], //, '鍏ュ簱', '鍗曟嵁淇℃伅', '瑙g洏' + current: 0, + matTotal: [], + matInfos: [], + orderNo: "", + label: "", + orderInfo: [], + focus: false, + barcode: "", + materSn: "", + Initiallife: 1000, + sns: [], + sn: "", + addressFocus: false, + inboundBarcode: "", + address: "", + check: true, + value: "", + matInfo: [], + value2: "", + matTotals: [], + warehouseId: "", + Test: false, + Testlabel: "", + Testplaceholder: "", + Testcheck: false, + } + }, + onShow() {}, + onLoad(res) { + this.focus = false; + this.addressFocus = false; + this.orderNo = res.orderNo; + this.warehouseId = res.warehouseId; + if (this.warehouseId == 6) { //娴嬭瘯鏋朵粨搴撳尯ID + this.Test = true; + this.Testlabel = "鍒濆瀵垮懡:"; + this.Testplaceholder = "璇疯緭鍏ュ垵濮嬪鍛�"; + } else if (this.warehouseId == 2) { //娌瑰ⅷ浠撳簱鍖篒D + this.Test = true; + this.Testlabel = "鏁伴噺:"; + this.Testplaceholder = "璇疯緭鍏ユ暟閲�"; + this.Initiallife = 16; + } else if (this.warehouseId == 5) { //杈呮枡浠撳簱鍖篒D + this.address = "8005"; + } + this.label = "鍗曟嵁缂栧彿锛�" + this.orderNo; + this.getData(); + }, + methods: { + voiceSpeech(src) { + innerAudioContext.src = src; // '../../static/success.mp3'; + innerAudioContext.play(); + }, + //瑙g洏 + releasebox() { + if (this.value.length == 0) { + this.$refs.uToast.show({ + title: "璇锋壂鐮�", + type: "error" + }) + return; + } + var param; + var matInfo = this.value.split('|'); + if (matInfo.length == 7) { + param = { + MainData: { + "innerCode": this.value + } + } + } else { + param = { + MainData: { + "barcode": this.value + } + } + } + this.$u.post('/api/StockOperate/ReleaseAllBox', param).then(resdt => { + if (resdt.status) { + uni.$showMsg('瑙g洏鎴愬姛!') + this.value = ""; + this.matInfo = []; + this.matTotals = []; + this.value2 = ""; + } else { + this.$refs.uToast.show({ + title: resdt.message, + type: "error" + }) + } + }) + }, + releaseboxInput() { + this.$nextTick(() => { + if (this.value.length == 0) { + return; + } + var matInfo = this.value.split('|'); + this.matInfo = []; + if (matInfo.length == 7) { + this.$u.post('/api/StockOperate/GetStockInfoByInnerCode', { + MainData: { + "innerCode": this.value + } + }).then(res => { + if (res.status) { + this.matInfo = res.data.stockInfo; + this.matTotals = res.data.stockTotal; + this.value2 = res.data.barcode; + } else { + this.$refs.uToast.show({ + title: res.message, + type: "error" + }) + } + }) + } else { + this.$u.post('/api/StockOperate/GetStockInfoByBarcode', { + MainData: { + "barcode": this.value + } + }).then(res => { + if (res.status) { + this.matInfo = res.data.stockInfo; + this.matTotals = res.data.stockTotal; + this.value2 = res.data.barcode; + } else { + this.$refs.uToast.show({ + title: res.message, + type: "error" + }) + } + }) + } + }) + }, + + updateFocus() { + debugger + this.$nextTick(() => { + this.materSn = ''; + if (!this.focus) { + this.focus = true; + } + }); + }, + barcodeFocus() { + debugger + this.barcode = ''; + if (this.focus) { + this.focus = false; + } + }, + getData() { + var postData = { + MainData: { + orderNo: this.orderNo + }, + } + this.$u.post('/api/InboundOrderDetail/GetInboundOrderDetails', postData).then((res) => { + if (res.status) { + this.orderInfo = res.data; + if (this.orderInfo.length > 3) { + this.loadVisible = true; + } + } + }) + }, + onClickItem(e) { + this.focus = false; + this.addressFocus = false; + if (this.current !== e.currentIndex) { + this.current = e.currentIndex; + if (this.current == 2) { + this.getData(); + } + } + }, + barcodeInput() { + this.$nextTick(function(x) { + if (this.barcode.length > 0) { + // if (this.barcode.substring(0, 1) == 'A' || this.barcode.substring(0, 2) == 'TP') { + this.focus = true; + // } else { + // this.$refs.uToast.show({ + // title: "鎵爜閿欒,璇锋壂鎻忔墭鐩樼爜", + // type: "error" + // }) + // } + } + }) + }, + snInput() { + this.$nextTick(() => { + if (this.warehouseId == 6 || this.warehouseId == 2) { + if (this.sns.length > 0) { + this.sns = []; + } + } + if (this.materSn != "") { + this.focus = false; + var matSn = this.materSn; + setTimeout(() => { + this.materSn = ""; + }, 10); + this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => { + this.Testcheck = false; + if (res.status) { + this.sns.push(res.data.serialNumber); + if (this.warehouseId == 6 || this.warehouseId == 2) { + if (this.matInfos.length > 0) { + this.matInfos = []; + } + } + this.matInfos.push(res.data); + if (res.message) { + this.$refs.uToast.show({ + title: res.message, + type: "error" + }) + setTimeout(() => { + this.voiceSpeech('../../static/fail.mp3'); + }, 100); + return; + } + setTimeout(() => { + this.voiceSpeech('../../static/success.mp3'); + }, 100); + } else { + this.$refs.uToast.show({ + title: res.message, + type: "error" + }) + setTimeout(() => { + this.voiceSpeech('../../static/fail.mp3'); + }, 100); + } + }) + } + }) + }, + inbound() { + if (this.inboundBarcode == "") { + this.$refs.uToast.show({ + title: "璇锋壂鎻忔墭鐩樻潯鐮�", + type: "error" + }) + return; + } + if (this.address == "") { + this.$refs.uToast.show({ + title: "璇锋壂鎻忓湴鍧�鏉$爜", + type: "error" + }) + return; + } + var postData = { + MainData: { + "barcode": this.inboundBarcode, + "startPoint": this.address, + "warehouseId": this.warehouseId + } + } + this.$u.post('/api/Task/RequestInboundTask', postData).then(res => { + if (res.status) { + uni.$showMsg(res.message); + this.inboundBarcode = ""; + this.address = ""; + setTimeout(() => { + this.addressFocus = false; + }, 200); + } else { + this.$refs.uToast.show({ + title: res.message, + type: "error" + }) + } + }).catch(err => { + this.$refs.uToast.show({ + title: err.message, + type: "error" + }) + }) + }, + inputChangebarcode() { + this.addressFocus = false; + this.$nextTick(function(x) { + if (this.inboundBarcode != '') { + this.addressFocus = true; + } + }) + }, + deleteList(res) { + this.matInfos.splice(res, 1); + this.sns.splice(res, 1); + }, + submit() { + if (this.barcode == "") { + this.$refs.uToast.show({ + title: "璇锋壂鎻忔墭鐩樻潯鐮�", + type: 'error' + }) + return; + } + if (this.matInfos.length == 0) { + this.$refs.uToast.show({ + title: "璇锋壂鎻忓唴绠辨爣绛�", + type: 'error' + }) + return; + } + if (this.Test) { + if (!this.Testcheck) { + this.Testcheck = true; + if (this.warehouseId == 2) { + this.$refs.uToast.show({ + title: "璇风‘璁ゆ暟閲�", + type: 'error' + }) + } else if (this.warehouseId == 6) { + this.$refs.uToast.show({ + title: "璇风‘璁ゅ垵濮嬪鍛�", + type: 'error' + }) + } + return; + } + } + if (this.warehouseId == 2) { //娌瑰ⅷ浠撳簱鍖篒D + this.sn = this.sns[0]; + debugger + for (var i = 0; i < this.Initiallife - 1; i++) { + this.sns.push(this.sn); + } + } + debugger + let url = 'palletCode=' + this.barcode + '&initiallife=' + this.Initiallife + '&warehouseId=' + this + .warehouseId; + + this.$u.post('/api/InboundOrder/ManualMaterielGroup?' + url, this.sns).then(res => { + this.Testcheck = false; + if (res.status) { + this.$refs.uToast.show({ + title: "缁勭洏鎴愬姛", + type: "success" + }) + this.focus = false; + this.barcode = ""; + this.matInfos = []; + this.sns = []; + this.matTotal = []; + } else { + this.$refs.uToast.show({ + title: res.message, + type: "error" + }) + } + }) + } + } + } +</script> + +<style lang="scss"> + @import '@/common/uni-ui.scss'; + + .content { + display: flex; + height: 150px; + } + + .content-text { + font-size: 14px; + color: #666; + } + + .itemstyle { + margin-top: 30px; + margin-left: 5%; + } + + .headerstyle { + width: 90%; + } +</style> \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" index 74a55c9..cc69b87 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" @@ -198,6 +198,8 @@ this.Testlabel = "鏁伴噺:"; this.Testplaceholder = "璇疯緭鍏ユ暟閲�"; this.Initiallife = 16; + } else if (this.warehouseId == 5) { //杈呮枡浠撳簱鍖篒D + this.address = "8005"; } this.label = "鍗曟嵁缂栧彿锛�" + this.orderNo; this.getData(); @@ -419,11 +421,14 @@ } this.$u.post('/api/Task/RequestInboundTask', postData).then(res => { if (res.status) { - uni.$showMsg(res.message); this.inboundBarcode = ""; - this.address = ""; + if (this.warehouseId != 5) this.address = ""; setTimeout(() => { this.addressFocus = false; + this.$refs.uToast.show({ + title: "鎴愬姛", + type: "success" + }) }, 200); } else { this.$refs.uToast.show({ @@ -484,12 +489,10 @@ } if (this.warehouseId == 2) { //娌瑰ⅷ浠撳簱鍖篒D this.sn = this.sns[0]; - debugger for (var i = 0; i < this.Initiallife - 1; i++) { this.sns.push(this.sn); } } - debugger let url = 'palletCode=' + this.barcode + '&initiallife=' + this.Initiallife + '&warehouseId=' + this .warehouseId; -- Gitblit v1.9.3