已修改9个文件
已复制1个文件
已重命名3个文件
已添加3个文件
| | |
| | | public enum APIEnum |
| | | { |
| | | /// <summary> |
| | | /// AGVåé任塿¥å£ |
| | | /// æµè¯æ¶AGVåé任塿¥å£ |
| | | /// </summary> |
| | | [Description("AGVåé任塿¥å£")] |
| | | AgvSendTask, |
| | | [Description("æµè¯æ¶AGVåé任塿¥å£")] |
| | | Agv_CSJSendTask, |
| | | |
| | | /// <summary> |
| | | /// AGVå®å
¨ä¿¡å·åå¤ |
| | | /// æµè¯æ¶AGVå®å
¨ä¿¡å·åå¤ |
| | | /// </summary> |
| | | [Description("AGVå®å
¨ä¿¡å·åå¤")] |
| | | AgvSecureReply, |
| | | [Description("æµè¯æ¶AGVå®å
¨ä¿¡å·åå¤")] |
| | | Agv_CSJSecureReply, |
| | | |
| | | /// <summary> |
| | | /// è¾
æAGVä»»å¡åé |
| | | /// </summary> |
| | | [Description("è¾
æAGVä»»å¡åé")] |
| | | Agv_FLSendTask, |
| | | |
| | | /// <summary> |
| | | /// åè°WMSä»»å¡å®æ |
| | |
| | | /// </summary> |
| | | public List<CodePath> PositionCodePath { get; set; } |
| | | /// <summary> |
| | | /// æçå· |
| | | /// </summary> |
| | | public string ctnrCode { get; set; } |
| | | /// <summary> |
| | | /// è½½å
·ç¼å· |
| | | /// </summary> |
| | | public string PodCode { get; set; } |
| | |
| | | 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; |
| | |
| | | /// </summary> |
| | | /// <param name="taskModel"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent AgvSendTask(AgvTaskDTO taskModel); |
| | | WebResponseContent AgvSendTask(AgvTaskDTO taskModel, APIEnum SendTask = APIEnum.Agv_CSJSendTask); |
| | | /// <summary> |
| | | /// å®å
¨ä¿¡å·ç³è¯· |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | /// <param name="secureModel"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent AgvSecureReply(AgvSecureReplyDTO secureReplyModel); |
| | | WebResponseContent AgvSecureReply(AgvSecureReplyDTO secureReplyModel, APIEnum SecureReply = APIEnum.Agv_CSJSecureReply); |
| | | /// <summary> |
| | | /// AGVä»»å¡ç¶æå·æ° |
| | | /// </summary> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </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($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); // AppSettings.Get(APIEnum.AgvSendTask.ToString()); |
| | | string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == SendTask.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(apiAddress)) |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiAddress, taskModel.Serialize()); |
| | | AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); |
| | | if (agvContent.Code == "0") |
| | |
| | | /// </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($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); // AppSettings.Get(APIEnum.AgvSendTask.ToString());// AppSettings.Get(APIEnum.AgvSecureReply.ToString()); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiAddress, secureReplyModel.Serialize()); |
| | | AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); |
| | | if (agvContent.Code == "0") |
| | |
| | | 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)) |
| | |
| | | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | } |
| | | 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) |
| | | { |
ÎļþÃû´Ó ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs ÐÞ¸Ä |
| | |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | public partial class AGVJob |
| | | public partial class AGV_CSJJob |
| | | { |
| | | /// <summary> |
| | | /// ä¸åAGVä»»å¡ |
| | |
| | | { |
| | | 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 |
| | |
| | | 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> |
| | |
| | | { |
| | | 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) |
| | |
| | | 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; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); |
| | | Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message); |
| | | } |
| | | } |
| | | |
ÎļþÃû´Ó ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs ÐÞ¸Ä |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); |
| | | Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using 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; |
| | | } |
| | | } |
| | | } |
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"
Îļþ´Ó ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs ¸´ÖÆ |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | try |
| | | { |
| | | SendAGVTask(); |
| | | |
| | | SendAGVWaitToTask(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); |
| | | Console.Out.WriteLine(nameof(AGV_FLJob) + ":" + ex.Message); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | _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) |
| | |
| | | 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) |
| | |
| | | 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; |
| | |
| | | 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) |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | { |
| | | 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) |
| | |
| | | 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 { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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">è§£ç</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: ['å
¥å¹³åº'], //, 'å
¥åº', 'åæ®ä¿¡æ¯', 'è§£ç' |
| | | 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) { //油墨ä»åºåºID |
| | | this.Test = true; |
| | | this.Testlabel = "æ°é:"; |
| | | this.Testplaceholder = "请è¾å
¥æ°é"; |
| | | this.Initiallife = 16; |
| | | } else if (this.warehouseId == 5) { //è¾
æä»åºåºID |
| | | this.address = "8005"; |
| | | } |
| | | this.label = "åæ®ç¼å·ï¼" + this.orderNo; |
| | | this.getData(); |
| | | }, |
| | | methods: { |
| | | voiceSpeech(src) { |
| | | innerAudioContext.src = src; // '../../static/success.mp3'; |
| | | innerAudioContext.play(); |
| | | }, |
| | | //è§£ç |
| | | 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('è§£çæå!') |
| | | 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) { //油墨ä»åºåºID |
| | | 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> |
| | |
| | | this.Testlabel = "æ°é:"; |
| | | this.Testplaceholder = "请è¾å
¥æ°é"; |
| | | this.Initiallife = 16; |
| | | } else if (this.warehouseId == 5) { //è¾
æä»åºåºID |
| | | this.address = "8005"; |
| | | } |
| | | this.label = "åæ®ç¼å·ï¼" + this.orderNo; |
| | | this.getData(); |
| | |
| | | } |
| | | 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({ |
| | |
| | | } |
| | | if (this.warehouseId == 2) { //油墨ä»åºåºID |
| | | 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; |
| | | |