已删除4个文件
已修改27个文件
已重命名3个文件
已添加13个文件
| | |
| | | /// 设å¤ç¼å· |
| | | /// </summary> |
| | | public string EqpCode { get; set; } |
| | | public string PodTyp { get; set; } |
| | | } |
| | | } |
| | |
| | | public string AGVArea { get; set; } |
| | | |
| | | public int PalletType { get; set; } |
| | | /// <summary> |
| | | /// AGVä»»å¡å· |
| | | /// </summary> |
| | | public string AGVTaskNum { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string materielBoxCode = ""); |
| | | |
| | | WebResponseContent RequestWMSZHTask(string agvTaskCode, string palletCode, string palletType,string materialLot); |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·ä»»å¡ |
| | |
| | | return agvResponseContent; |
| | | } |
| | | } |
| | | else //çº¿ä½æ ä»»å¡ |
| | | { |
| | | //è°ç¨AGVé¢è°åº¦æ¥å£ |
| | | AgvScheduleTaskDTO agvScheduleTask = new AgvScheduleTaskDTO() |
| | | { |
| | | PositionCode = "8001", |
| | | NextTask = "15", |
| | | UseableLayers = "1", |
| | | CacheCount = "1", |
| | | Update = "0", |
| | | AgvTyp = "10", |
| | | PreTaskQty = "1", |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), |
| | | ReqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | }; |
| | | WebResponseContent contentFL = _taskService.AgvPreScheduleTask(agvScheduleTask); |
| | | if (!contentFL.Status) |
| | | { |
| | | agvResponseContent.Code = "1"; |
| | | agvResponseContent.Message = contentFL.Message; |
| | | return agvResponseContent; |
| | | } |
| | | } |
| | | //è·åè°å
¥åæ° |
| | | AGVBoxApplyPassDTO boxApplyPassDTO = new AGVBoxApplyPassDTO() |
| | | { |
| | |
| | | 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 (task == null && agvUpdateModel.Method!= "begin") throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡å·ã{agvUpdateModel.TaskCode}ã"); |
| | | switch (agvUpdateModel.Method) |
| | | { |
| | | case "start": |
| | | break; |
| | | case "begin": |
| | | WebResponseContent requestZH = _taskService.RequestWMSZHTask(agvUpdateModel.TaskCode, agvUpdateModel.PodCode,agvUpdateModel.PodTyp,agvUpdateModel.MaterialLot); |
| | | agvResponseContent.Code = requestZH.Status ? "0" : "1"; |
| | | agvResponseContent.Message = requestZH.Status ? "æå" : "失败"; |
| | | return agvResponseContent; |
| | | case "outbin"://åºåºæ ¹æ®è¿ä¸ªä¿¡å·å¤æåè´§å®æ |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | if (task.Roadway!="SC01_ZH") |
| | | { |
| | | 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) |
| | | { |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
置信æ¯"); |
| | | } |
| | | |
| | | task.NextAddress = stationManger?.AGVStationCode ?? ""; |
| | | task.DeviceCode = stationManger?.Remark ?? ""; |
| | | task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); |
| | | task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return content; |
| | | } |
| | | public WebResponseContent RequestWMSZHTask(string agvTaskCode, string palletCode, string palletType, string materialLot) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.AgvTaskNum == agvTaskCode); |
| | | if (task != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ä»»å¡å·{task.TaskNum}对åºä»»å¡å·²åå¨"); |
| | | } |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = ""; |
| | | if (string.IsNullOrEmpty(materialLot)) |
| | | { |
| | | return content.Error("ç©ææ¹æ¬¡ä¸ºç©º"); |
| | | |
| | | } |
| | | responseStr = HttpHelper.Get($"{address}/api/Task/RequestZHInboundTask?agvTaskCode={agvTaskCode}&palletCode={palletCode}&palletType={palletType}&materialLot={materialLot}"); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | if (taskDTO != null) |
| | | { |
| | | taskDTO.AGVTaskNum = agvTaskCode; |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | content.Error(responseContent.Message); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | |
| | | |
| | | if (!string.IsNullOrEmpty(boxcode)) |
| | | { |
| | | string sc = device.Communicator.Read<string>("DB900.598.0"); |
| | | string sc = device.Communicator.Read<string>("DB900.580.0"); |
| | | WriteError(device.DeviceName, $"读åå¼ï¼{boxcode},对æ¯{sc}"); |
| | | string boxEndCode = ""; |
| | | if (boxcode.LastIndexOf(",SC:") >= 0) |
| | | if (boxcode.LastIndexOf(",PO:") >= 0) |
| | | { |
| | | boxEndCode = "M" + boxcode.Substring(0, boxcode.LastIndexOf(",SC:")) + sc.Substring(sc.IndexOf(",SC:")).Replace("\0", ""); |
| | | boxEndCode = "M" + boxcode.Substring(0, boxcode.LastIndexOf(",PO:")) + sc.Substring(sc.IndexOf(",PO:")).Replace("\0", ""); |
| | | } |
| | | else if (boxcode.LastIndexOf(",SC") > 0) |
| | | else if (boxcode.LastIndexOf(",PO") > 0) |
| | | { |
| | | boxEndCode = "M" + boxcode.Substring(0, boxcode.LastIndexOf(",SC")) + sc.Substring(sc.IndexOf("SC:")).Replace("\0", ""); |
| | | boxEndCode = "M" + boxcode.Substring(0, boxcode.LastIndexOf(",PO")) + sc.Substring(sc.IndexOf("PO:")).Replace("\0", ""); |
| | | } |
| | | else if (boxcode.LastIndexOf(",S") > 0) |
| | | else if (boxcode.LastIndexOf(",P") > 0) |
| | | { |
| | | boxEndCode = "M" + boxcode.Substring(0, boxcode.LastIndexOf(",S")) + sc.Substring(sc.IndexOf("SC:")).Replace("\0", ""); |
| | | boxEndCode = "M" + boxcode.Substring(0, boxcode.LastIndexOf(",P")) + sc.Substring(sc.IndexOf("PO:")).Replace("\0", ""); |
| | | } |
| | | |
| | | //å
¥åºç³è¯·ä»»å¡ |
| | |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | string boxcode = device.GetValue<R_ConveyorLineDB, string>(R_ConveyorLineDB.Boxcode, item.StationCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && boxcode.Contains(x.PalletCode) && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode, deviceCode: task.Roadway, nextAddress: task.TargetAddress); |
| | |
| | | { |
| | | if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && !string.IsNullOrEmpty(x.NextAddress)); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StackerCraneCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && !string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StationCode, deviceCode: item.StackerCraneCode, targetAddress: item.StationCode); |
| | |
| | | |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)//å
¥åº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.DeviceCode == item.StationDeviceCode && x.NextAddress == item.StationCode); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using AutoMapper; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IMapper _mapper; |
| | | private List<Dt_ApiInfo> apiInfos; |
| | | |
| | | public StackerCraneJob_GM(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) |
| | | public StackerCraneJob_GM(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IMapper mapper) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _cacheService = cacheService; |
| | | _routerRepository = routerRepository; |
| | | _mapper = mapper; |
| | | |
| | | string? apiInfoStr = _cacheService.Get("apiInfos"); |
| | | if (!string.IsNullOrEmpty(apiInfoStr)) |
| | |
| | | if (string.IsNullOrEmpty(url)) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | WriteInfo(commonStackerCrane.DeviceCode, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | WriteError(commonStackerCrane.DeviceCode, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | return null; |
| | | } |
| | | //HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | string response = HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.CurrentAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | if (string.IsNullOrEmpty(response)) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | WriteError(commonStackerCrane.DeviceCode, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | return null; |
| | | } |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(response); |
| | | if (responseContent == null || !responseContent.Status) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | WriteError(commonStackerCrane.DeviceCode, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | return null; |
| | | } |
| | | WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.Serialize()); |
| | | if (taskDTO == null) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | WriteError(commonStackerCrane.DeviceCode, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); |
| | | return null; |
| | | |
| | | } |
| | | if (task.TaskNum == taskDTO.TaskNum) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | Dt_Task reloTask = _mapper.Map<Dt_Task>(taskDTO); |
| | | //å¤æç§»åºè´§ä½ä»»å¡æ¯å¦å·²åå¨ï¼å¦åå¨å
æ§è¡ |
| | | Dt_Task existTask = _taskService.QueryStackerExistTask(reloTask.PalletCode, reloTask.SourceAddress); |
| | | if (existTask != null) |
| | | { |
| | | return existTask; |
| | | } |
| | | else |
| | | { |
| | | reloTask.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | reloTask.CurrentAddress = taskDTO.SourceAddress; |
| | | reloTask.NextAddress = taskDTO.TargetAddress; |
| | | reloTask.DeviceCode = task.DeviceCode; |
| | | reloTask.TaskType = TaskTypeEnum.Relocation.ObjToInt(); |
| | | int taskId = _taskRepository.AddData(reloTask); |
| | | reloTask.TaskId = taskId; |
| | | } |
| | | return reloTask; |
| | | |
| | | } |
| | | } |
| | | |
| | | return task; |
| | |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | { |
| | | try |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).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_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | foreach (var task in newTasks) |
| | | { |
| | | try |
| | |
| | | WriteError(nameof(AGV_FLJob), ex.Message, ex); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// ä¸åAGVç»§ç»æ§è¡ä»»å¡ |
| | | /// </summary> |
| | | public void SendAGVWaitToTask() |
| | | { |
| | | try |
| | | { |
| | | 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 (WaitToTasks.FirstOrDefault(x => x.TaskState == TaskStatusEnum.AGV_Puting.ObjToInt() || x.TaskState == TaskStatusEnum.Finish.ObjToInt()) != null) |
| | | { |
| | | continue; |
| | | } |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.NextAddress); |
| | | if (stationManger == null) |
| | | { |
| | | continue; |
| | | } |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | 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) |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); |
| | | continue; |
| | | } |
| | | else if (!canPut) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.CurrentAddress); |
| | | if (stationManger == null) |
| | | { |
| | | continue; |
| | | } |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | bool canTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); |
| | | bool requestTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_TakeRequest, stationManger.StationCode); |
| | | if (!requestTake) |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); |
| | | continue; |
| | | } |
| | | else if (!canTake) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | AgvSecureReplyDTO replyDTO = new AgvSecureReplyDTO() |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), //WaitToTask.TaskNum.ToString(), |
| | | taskCode = WaitToTask.AgvTaskNum, |
| | | }; |
| | | WebResponseContent content = _taskService.AgvSecureReply(replyDTO); |
| | | if (content.Status && WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | WaitToTask.TaskState = TaskStatusEnum.AGV_Puting.ObjToInt(); |
| | | _taskService.UpdateTask(WaitToTask, TaskStatusEnum.AGV_Puting); |
| | | break; |
| | | } |
| | | else if (content.Status && WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | WaitToTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | _taskService.UpdateTask(WaitToTask, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | WaitToTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | WaitToTask.ExceptionMessage = content.Message; |
| | | _taskService.UpdateTask(WaitToTask, TaskStatusEnum.Exception); |
| | | } |
| | | } |
| | | _taskService.UpdateData(WaitToTasks); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | List<string> lockLocationCodes = locationCaches_GM.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == roadwayNo); |
| | | //è·åææäºæ·±ä½è´§ä½æ°æ® |
| | | List<Dt_LocationInfo> locationInfoDepth = Repository.QueryData(x => x.RoadwayNo == roadwayNo && x.Depth== locationInfos.Max(v=>v.Depth)); |
| | | if (locationInfos == null || locationInfos.Count == 0) |
| | | { |
| | | throw new Exception($"æªæ¾å°è¯¥å··éçè´§ä½ä¿¡æ¯,å··éå·:{roadwayNo}"); |
| | |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | if (locationInfo != null) |
| | | { |
| | | if (locationInfo.Depth<locationInfoDepth.Max(x=>x.Depth) && palletTypeInfo.LocaitonCount<2) |
| | | { |
| | | Dt_LocationInfo? locationInfoExist = null; |
| | | int Column = locationInfo.Column; |
| | | if (Column % 2 == 0) |
| | | { |
| | | Column -= 1; |
| | | } |
| | | if (locationInfo.Row - locationInfo.Depth == locationInfo.Depth) |
| | | { |
| | | locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row-1) && x.Column== Column && x.Layer==locationInfo.Layer && x.LocationStatus==LocationStatusEnum.InStock.ObjToInt()); |
| | | } |
| | | else |
| | | { |
| | | locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row + 1) && x.Column == Column && x.Layer == locationInfo.Layer && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()); |
| | | } |
| | | //è·åæ·±ä½è´§ä½ç±»å |
| | | if (locationInfoExist==null) |
| | | { |
| | | continue; |
| | | } |
| | | Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); |
| | | if (palletTypeInfoDepth == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (palletTypeInfoDepth.LocaitonCount==2 && palletTypeInfo.LocaitonCount==1) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, undefinedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | if (locationInfo != null) |
| | | { |
| | | if (locationInfo.Depth < locationInfoDepth.Max(x => x.Depth) && palletTypeInfo.LocaitonCount < 2) |
| | | { |
| | | Dt_LocationInfo? locationInfoExist = null; |
| | | int Column = locationInfo.Column; |
| | | if (Column % 2 == 0) |
| | | { |
| | | Column -= 1; |
| | | } |
| | | if (locationInfo.Row - locationInfo.Depth == locationInfo.Depth) |
| | | { |
| | | locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row - 1) && x.Column == Column && x.Layer == locationInfo.Layer && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()); |
| | | } |
| | | else |
| | | { |
| | | locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row + 1) && x.Column == Column && x.Layer == locationInfo.Layer && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()); |
| | | } |
| | | //è·åæ·±ä½è´§ä½ç±»å |
| | | if (locationInfoExist == null) |
| | | { |
| | | continue; |
| | | } |
| | | Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); |
| | | if (palletTypeInfoDepth == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (palletTypeInfoDepth.LocaitonCount == 2) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | |
| | | /// åè°WCSä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("åè°WCSä»»å¡å®æ")] |
| | | FeedBackWCSTaskCompleted |
| | | FeedBackWCSTaskCompleted, |
| | | /// <summary> |
| | | /// QMSæ¥ææ£éªæ¥å£ |
| | | /// </summary> |
| | | [Description("QMSæ¥ææ£éªæ¥å£")] |
| | | WMS_QMSReceiveCheckApi, |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [Description("æå空æ¡ååº")] |
| | | EmptyProductBack = 630, |
| | | |
| | | /// <summary> |
| | | /// é»çå
¥åºå°ä»¶ |
| | | /// </summary> |
| | | [Description("é»çå
¥åºå°ä»¶")] |
| | | InZHProductSmall = 640, |
| | | /// <summary> |
| | | /// é»çå
¥åºå¤§ä»¶ |
| | | /// </summary> |
| | | [Description("é»çå
¥åºå¤§ä»¶")] |
| | | InZHProductLarge = 645, |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | |
| | | /// æ²¹å¢¨ä» |
| | | /// </summary> |
| | | [Description("油墨ä»")] |
| | | HA153 |
| | | HA153, |
| | | /// <summary> |
| | | /// é»çä» |
| | | /// </summary> |
| | | [Description("é»çä»")] |
| | | HA154 |
| | | } |
| | | public enum WarehouseTypEnum |
| | | { |
| | |
| | | Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate); |
| | | } |
| | | } |
| | | public static string GetStr(string textToEncrypt) |
| | | { |
| | | string publicKey; |
| | | string privateKey; |
| | | GenerateRSAKeyPair(out publicKey, out privateKey); |
| | | byte[] encryptedBytes = RSAEncrypt(textToEncrypt, publicKey); |
| | | // å¯ä»¥å°å å¯åçåèæ°ç»è½¬æ¢ä¸ºBase64å符串æ¹ä¾¿åç»å¤çï¼ä¾å¦ä¼ è¾ç |
| | | string encryptedBase64 = Convert.ToBase64String(encryptedBytes); |
| | | return encryptedBase64; |
| | | } |
| | | public static void GenerateRSAKeyPair(out string publicKey, out string privateKey) |
| | | { |
| | | using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(2048)) |
| | | { |
| | | publicKey = rsa.ToXmlString(false); |
| | | privateKey = rsa.ToXmlString(true); |
| | | } |
| | | } |
| | | public static byte[] RSAEncrypt(string plainText, string publicKey) |
| | | { |
| | | byte[] encryptedData; |
| | | using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) |
| | | { |
| | | rsa.FromXmlString(publicKey); |
| | | // å°ææ¬è½¬æ¢ä¸ºUTF8ç¼ç çåèæ°ç» |
| | | byte[] plainBytes = Encoding.UTF8.GetBytes(plainText); |
| | | // 使ç¨SHA1åå¸ç®æ³ä»¥åPkcs1å¡«å
è§åè¿è¡å å¯ |
| | | encryptedData = rsa.Encrypt(plainBytes, true); |
| | | } |
| | | return encryptedData; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Net.Http.Headers; |
| | | using WIDESEA_Core.LogHelper; |
| | | using System.Security.Cryptography; |
| | | |
| | | namespace WIDESEA_Core.Helper |
| | | { |
| | | public class HttpQmsHelper |
| | | { |
| | | public static string Post(string serviceAddress, string requestJson = null, string contentType = "application/json", Dictionary<string, string>? headers = null) |
| | | { |
| | | string result = string.Empty; |
| | | DateTime beginDate = DateTime.Now; |
| | | try |
| | | { |
| | | using (HttpContent httpContent = new StringContent(requestJson)) |
| | | { |
| | | httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
| | | |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | //æ£å¼ |
| | | //string authorization = "AppKey 1930944618148245504"; |
| | | //æµè¯ |
| | | string authorization = "AppKey 1930944618148245504"; |
| | | |
| | | |
| | | headers = new Dictionary<string, string> |
| | | { |
| | | { "Authorization", authorization }, |
| | | //æ£å¼ |
| | | //{ "Site_tenant_id", "6ec60d66-b08e-4ff3-90fa-57748053f79b" } |
| | | //æµè¯ |
| | | { "Site_tenant_id", "6ec60d66-b08e-4ff3-90fa-57748053f79b" } |
| | | }; |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | HttpResponseMessage responseMessage = httpClient.PostAsync(serviceAddress, httpContent).Result; |
| | | result = responseMessage.Content.ReadAsStringAsync().Result; |
| | | } |
| | | return result; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | finally |
| | | { |
| | | Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate); |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.MES |
| | | { |
| | | public class MesLotInfoModel |
| | | { |
| | | public string Product { get; set; } |
| | | public string ProductVersion { get; set; } |
| | | public decimal Qty { get; set; } |
| | | public string DateCode { get; set; } |
| | | public string LotNo { get; set; } |
| | | public bool IsFullNumber { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.QMS |
| | | { |
| | | /// <summary> |
| | | /// Qmsåä¼ |
| | | /// </summary> |
| | | public class CheckResultDTO |
| | | { |
| | | /// <summary> |
| | | /// æ¶è´§åå· |
| | | /// </summary> |
| | | public string EntryNumber { get; set; } |
| | | /// <summary> |
| | | /// æ¶è´§è¡å· |
| | | /// </summary> |
| | | public int RowNumber { get; set; } |
| | | /// <summary> |
| | | /// æ¥ææ£éªåå· |
| | | /// </summary> |
| | | public string InspectionNumber { get; set; } |
| | | /// <summary> |
| | | /// ç»æ |
| | | /// </summary> |
| | | public string Result { get; set; } |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | public string Remark { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.QMS |
| | | { |
| | | /// <summary> |
| | | /// Qmsåä¼ |
| | | /// </summary> |
| | | public class ReceiveResultDTO |
| | | { |
| | | /// <summary> |
| | | /// æ£éª |
| | | /// </summary> |
| | | public string InspectionNumber { get; set; } |
| | | /// <summary> |
| | | /// ID |
| | | /// </summary> |
| | | public string Id { get; set; } |
| | | } |
| | | } |
| | |
| | | /// |
| | | /// </summary> |
| | | public int PalletType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// AGVä»»å¡å· |
| | | /// </summary> |
| | | public string AGVTaskNum { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_External.Model; |
| | | |
| | | namespace WIDESEA_External.QMSService |
| | | { |
| | | /// <summary> |
| | | /// è°ç¨QMSæ¥å£ |
| | | /// </summary> |
| | | public interface IInvokeQMSService : IDependency |
| | | { |
| | | /// <summary> |
| | | /// QMSæ¶è´§æ¥ææ£éªæ¥å£è°ç¨ |
| | | /// </summary> |
| | | /// <param name="receiveModel"></param> |
| | | /// <returns></returns> |
| | | string InvokeReceiveCheckApi(QMSReceiveCheckModel model); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_External.Model |
| | | { |
| | | public class QMSReceiveCheckModel |
| | | { |
| | | /// <summary> |
| | | /// æ¶è´§åå· |
| | | /// </summary> |
| | | public string EntryNumber { get; set; } |
| | | /// <summary> |
| | | /// ç©æç¼ç |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | public string MaterialName { get; set; } |
| | | /// <summary> |
| | | /// æ°é |
| | | /// </summary> |
| | | public decimal Quantity { get; set; } |
| | | /// <summary> |
| | | /// ä¾åºåç¼ç |
| | | /// </summary> |
| | | public string SupplierCode { get; set; } |
| | | /// <summary> |
| | | /// ä¾åºååç§° |
| | | /// </summary> |
| | | public string SupplierName { get; set; } |
| | | /// <summary> |
| | | /// ä¾åºåæ¹æ¬¡å· |
| | | /// </summary> |
| | | public string BatchNumber { get; set; } |
| | | /// <summary> |
| | | /// éè´§åå· |
| | | /// </summary> |
| | | public string DeliveryNumber { get; set; } |
| | | /// <summary> |
| | | /// éè´åå· |
| | | /// </summary> |
| | | public string PurchaseNumber { get; set; } |
| | | /// <summary> |
| | | /// æ¶è´§åè¡å· |
| | | /// </summary> |
| | | public int RowNumber { get; set; } |
| | | /// <summary> |
| | | /// ä»åº |
| | | /// </summary> |
| | | public string WarehouseCode { get; set; } |
| | | /// <summary> |
| | | /// æ¶ææ¶é´ |
| | | /// </summary> |
| | | public string ReceiptDate { get; set; } |
| | | /// <summary> |
| | | /// æ¶æå¤æ³¨ |
| | | /// </summary> |
| | | public string Remark { get; set; } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.APIEnum; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_External.QMSService |
| | | { |
| | | public class InvokeQMSService: IInvokeQMSService |
| | | { |
| | | private readonly IApiInfoRepository _apiInfoRepository; |
| | | public InvokeQMSService(IApiInfoRepository apiInfoRepository) |
| | | { |
| | | _apiInfoRepository = apiInfoRepository; |
| | | } |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | public string InvokeReceiveCheckApi(QMSReceiveCheckModel model) |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_QMSReceiveCheckApi.ToString()); |
| | | MESRoot<QMSReceiveCheckModel> requestModel = new MESRoot<QMSReceiveCheckModel>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = model |
| | | }; |
| | | |
| | | string request = JsonConvert.SerializeObject(requestModel, settings); |
| | | string response = HttpQmsHelper.Post(apiInfo.ApiAddress, request); |
| | | return response; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="tasks"></param> |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = ""); |
| | | WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "", string agvtaskNum = ""); |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = ""); |
| | | WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "", string agvtaskNum = ""); |
| | | |
| | | /// <summary> |
| | | /// ç³è¯·å
¥åºä»»å¡(PDA使ç¨ï¼ä»
æçç»å®å
¥åºç«å°ï¼ä¸åé
è´§ä½) |
| | |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType); |
| | | |
| | | WebResponseContent RequestZHInboundTask(string agvTaskCode, string palletCode, string palletType, string materialLot); |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | /// äººå·¥éæ©åºå |
| | | /// </summary> |
| | | WebResponseContent OutProductSelect(int orderDetailId, List<ProStockViewDTO> proStockViews); |
| | | WebResponseContent GetZHMesMaterialLot(string materialLot); |
| | | } |
| | | } |
| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using Org.BouncyCastle.Asn1.Ocsp; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections; |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string SerNum = materielBoxCode.Substring(0, materielBoxCode.LastIndexOf("SC:")-1); |
| | | string SerNum = ""; |
| | | if (materielBoxCode.LastIndexOf("SC:")<0) |
| | | { |
| | | SerNum = materielBoxCode; |
| | | } |
| | | else |
| | | { |
| | | SerNum = materielBoxCode.Substring(0, materielBoxCode.LastIndexOf("SC:") - 1); |
| | | } |
| | | MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, SerNum); |
| | | //éªè¯å¤ææ¶é´æ ¼å¼ |
| | | WebResponseContent IsValidContent = IsValidMCDates(new List<MatSerNumAnalysisModel>() { model }); |
| | |
| | | { |
| | | return content.Error(IsValidContent.Message); |
| | | } |
| | | string result = materielBoxCode.Substring(materielBoxCode.LastIndexOf("SC:") + 3); |
| | | string result = ""; |
| | | if (materielBoxCode.LastIndexOf("SC:") > 0) |
| | | { |
| | | result = materielBoxCode.Substring(materielBoxCode.LastIndexOf("SC:") + 3); |
| | | } |
| | | //è·åå
¥åºåæç» |
| | | Dt_InboundOrderDetail inboundOrderDetail = _inboundRepository.InboundOrderDetailRepository.QueryFirst(x=>x.BatchNo== model.LotNo && x.MaterielCode== model.MaterielCode); |
| | | if (inboundOrderDetail == null) |
| | |
| | | PalletCode = model.LotNo, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | WarehouseId = inboundOrder.WarehouseId, |
| | | PalletType = GetPalletTypeGMOrPP(warehouse, result.Split("*")[0]), |
| | | StockLength = result.Split("*")[0].ObjToInt(), |
| | | PalletType = GetPalletTypeGMOrPP(warehouse, result.IsNullOrEmpty() ? "" : result.Split("*")[0]), |
| | | StockLength = result.IsNullOrEmpty() ? 0 : result.Split("*")[0].ObjToInt(), |
| | | Details = new List<Dt_StockInfoDetail>() |
| | | }; |
| | | } |
| | |
| | | PalletCode = model.LotNo, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId, |
| | | PalletType = GetPalletTypeGMOrPP(warehouse, request.Split("*")[0]), |
| | | StockLength = request.Split("*")[0].ObjToInt(), |
| | | PalletType = GetPalletTypeGMOrPP(warehouse, request.IsNullOrEmpty() ?"":request.Split("*")[0]), |
| | | StockLength = request.IsNullOrEmpty()?0:request.Split("*")[0].ObjToInt(), |
| | | Details = new List<Dt_StockInfoDetail>() |
| | | }; |
| | | } |
| | |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA152.ToString()) |
| | | { |
| | | |
| | | if (boxWidth.ObjToInt() <= 690 && boxWidth.ObjToInt()>=515) |
| | | if (boxWidth.ObjToInt() <= 690 && boxWidth.ObjToInt()>=520) |
| | | { |
| | | return 15; |
| | | } |
| | |
| | |  |
| | | using AutoMapper; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Globalization; |
| | |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.QMS; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEA_External.QMSService; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_ICheckRepository; |
| | | using WIDESEA_IInboundRepository; |
| | |
| | | private readonly IBasicRepository _basicRepository; |
| | | private readonly ICheckOrderRepository _checkOrderRepository; |
| | | private readonly IStockRepository _stockRepository; |
| | | private readonly ISupplierInfoRepository _supplierInfoRepository; |
| | | private readonly IInvokeQMSService _invokeQMSService; |
| | | |
| | | public ReceiveOrderDetailService(IReceiveOrderDetailRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IInboundRepository inboundRepository, IBasicRepository basicRepository, ICheckOrderRepository checkOrderRepository, IStockRepository stockRepository) : base(BaseDal) |
| | | public ReceiveOrderDetailService(IReceiveOrderDetailRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IInboundRepository inboundRepository, IBasicRepository basicRepository, ICheckOrderRepository checkOrderRepository, IStockRepository stockRepository,ISupplierInfoRepository supplierInfoRepository,IInvokeQMSService invokeQMSService) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _basicRepository = basicRepository; |
| | | _checkOrderRepository = checkOrderRepository; |
| | | _stockRepository = stockRepository; |
| | | _supplierInfoRepository = supplierInfoRepository; |
| | | _invokeQMSService = invokeQMSService; |
| | | } |
| | | |
| | | private static object _rowNoLocker = new object(); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"è¯¥åæ®å·²æ¶è´§å®æ"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == receiveOrder.WarehouseId); |
| | | MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, serNum); |
| | | Dt_SupplierInfo supplierInfo = _supplierInfoRepository.QueryFirst(x => x.SupplierCode == receiveOrder.SuppliersId); |
| | | //æ¶è´§å¢å æ¹æ¬¡å¡æ§ |
| | | //æ¥è¯¢æ¶è´§æç»æ¯å¦æåå¨åä¸ä¸ªæ¹æ¬¡ |
| | | Dt_ReceiveOrderDetail receiveOrderDetailOld = _inboundRepository.ReceiveOrderDetailRepository.QueryFirst(x => x.LotNo == model.LotNo && x.MaterielCode == model.MaterielCode); |
| | |
| | | } |
| | | _inboundRepository.ReceiveOrderRepository.UpdateData(receiveOrder); |
| | | _inboundRepository.PurchaseOrderDetailRepository.UpdateData(purchaseOrderDetail); |
| | | |
| | | |
| | | QMSReceiveCheckModel qMSReceiveCheck = new QMSReceiveCheckModel() |
| | | { |
| | | EntryNumber=receiveOrder.ReceiveOrderNo, |
| | | MaterialCode=receiveOrderDetail.MaterielCode, |
| | | MaterialName=receiveOrderDetail.MaterielName, |
| | | Quantity=(decimal)receiveOrderDetail.ReceivedQuantity, |
| | | SupplierCode=receiveOrder.SuppliersId, |
| | | SupplierName= supplierInfo.SupplierName, |
| | | BatchNumber=receiveOrderDetail.LotNo, |
| | | DeliveryNumber=receiveOrder.DeliveryCode, |
| | | PurchaseNumber=receiveOrderDetail.PurchaseOrderNo, |
| | | RowNumber= receiveOrderDetail.RowNo, |
| | | WarehouseCode= warehouse.WarehouseCode, |
| | | ReceiptDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Remark=" " |
| | | }; |
| | | string response = _invokeQMSService.InvokeReceiveCheckApi(qMSReceiveCheck); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | if (!mesResponseContent.BSucc) |
| | | { |
| | | throw new Exception(mesResponseContent.StrMsg); |
| | | } |
| | | ReceiveResultDTO receiveResult = JsonConvert.DeserializeObject<ReceiveResultDTO>(mesResponseContent.Content.ToString()); |
| | | if (receiveResult==null) |
| | | { |
| | | throw new Exception("æ¥æ¶QMSç»æå¤±è´¥"); |
| | | } |
| | | #region 注é |
| | | if (materielInfo.IsCheck == WhetherEnum.True) |
| | | { |
| | | Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | checkOrder.CheckOrderNo = receiveResult.InspectionNumber; |
| | | checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; |
| | | checkOrder.Result = CheckAcceptEnum.NotCheckAccept.ToString(); |
| | | checkOrder.QualifiedQuantity = 0; |
| | |
| | | && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) |
| | | && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) |
| | | .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity) |
| | | if (useableStockQuantity < needQuantity && useableStockQuantity >0) |
| | | { |
| | | stockInfo.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) |
| | | && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) |
| | |
| | | string roadwayNo=string.Empty; |
| | | foreach (var location in locationCounts.OrderBy(x => x.Count)) |
| | | { |
| | | if (location.Count == 1) |
| | | if (location.Count <= 2) |
| | | continue; |
| | | roadwayNo = location?.RoadwayNo ?? ""; |
| | | break; |
| | |
| | | (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); |
| | | if (locationInfo == null) |
| | | { |
| | | return responseContent.Error($"æµè¯æ¶è´§ä½ããããããããã:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | return responseContent.Error($"æµè¯æ¶è´§ä½:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | } |
| | | //çææµè¯æ¶åºåºä»»å¡ éå®åºå æ´æ¹è´§ä½ç¶æ |
| | | Dt_Task taskOut = new() |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åMESé»çæ¹æ¬¡ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GetZHMesMaterialLot(string materialLot) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_GetProductByLot.ToString()); |
| | | object obj = new { LotNo = materialLot }; |
| | | MESRoot<object> root = new MESRoot<object>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = obj |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc == true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg, mesResponseContent.Content); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// ä»»å¡ä¿¡æ¯æ¨éè³WCS |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "") |
| | | public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "",string agvtaskNum="") |
| | | { |
| | | try |
| | | { |
| | |
| | | taskDTOs.ForEach(x => |
| | | { |
| | | x.AGVArea = agvDescription; |
| | | x.AGVTaskNum = agvtaskNum; |
| | | }); |
| | | string url = AppSettings.Get("WCS"); |
| | | if (string.IsNullOrEmpty(url)) |
| | |
| | | /// ä»»å¡ä¿¡æ¯æ¨éè³WCS |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "") |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "", string agvtaskNum = "") |
| | | { |
| | | try |
| | | { |
| | |
| | | taskDTOs.ForEach(x => |
| | | { |
| | | x.AGVArea = agvDescription; |
| | | x.AGVTaskNum = agvtaskNum; |
| | | }); |
| | | |
| | | string url = AppSettings.Get("WCS"); |
| | |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.OtherEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO.Task; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent RequestZHInboundTask(string agvTaskCode, string palletCode, string palletType, string materialLot) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åæµè¯æ¶ååºåä¿¡æ¯ |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && x.PalletCode== palletCode).Includes(x => x.Details).ToList(); |
| | | if (stockInfos.Count > 0) |
| | | { |
| | | return content.Error($"è½½å
·æçå·²åå¨"); |
| | | } |
| | | Dt_StockInfo? stockInfoOld = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == materialLot)); |
| | | if (stockInfoOld != null) |
| | | { |
| | | return content.Error($"åºåä¿¡æ¯å·²åå¨"); |
| | | } |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x=>x.CodeStartStr== palletType); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | return content.Error($"æçç±»åä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | //è·åé»çæ¹æ¬¡ |
| | | WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); |
| | | if (!requestLotInfo.Status) |
| | | { |
| | | return content.Error($"请æ±é»çæ¹æ¬¡ä¿¡æ¯å¤±è´¥,{requestLotInfo.Message}"); |
| | | } |
| | | MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | MaterielSpec = mesLotInfo.ProductVersion, |
| | | BatchNo = materialLot, |
| | | EffectiveDate = mesLotInfo.DateCode ?? " ", |
| | | MaterielCode = mesLotInfo.Product, |
| | | InboundOrderRowNo = 0, |
| | | MaterielName = mesLotInfo.Product, |
| | | ProductionDate = mesLotInfo.DateCode ?? " ", |
| | | OrderNo = "", |
| | | OutboundQuantity = 0, |
| | | SerialNumber = materialLot, |
| | | StockQuantity = (float)mesLotInfo.Qty, |
| | | Status = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(), |
| | | Unit = "Lot", |
| | | Remark= mesLotInfo.IsFullNumber?"满Lot":"䏿»¡Lot" |
| | | }; |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | PalletCode = palletCode, |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(), |
| | | Details = new List<Dt_StockInfoDetail> { stockInfoDetail } |
| | | }; |
| | | |
| | | //çæéåºä»»å¡ |
| | | Dt_Task taskIn = new() |
| | | { |
| | | CurrentAddress = "AGV_ZH", |
| | | Grade = 0, |
| | | PalletCode = palletCode, |
| | | NextAddress = "", |
| | | Roadway = "SC01_ZH", |
| | | SourceAddress = "AGV_ZH", |
| | | TargetAddress = "", |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = palletTypeInfo.LocaitonCount==2? (int)TaskTypeEnum.InZHProductLarge : (int)TaskTypeEnum.InZHProductSmall, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | | BaseDal.AddData(taskIn); |
| | | //BaseDal.AddData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH"); ; |
| | | content.OK(data: taskIn); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public readonly string[] OutStartPonits = { "5230", "5237", "5244" }; |
| | | /// <summary> |
| | | /// æå使éåºå
¥ä» |
| | |
| | | } |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | Dt_Task? task = BaseDal.QueryData(x=>x.TaskType==TaskTypeEnum.OutProduct.ObjToInt()).OrderByDescending(x=>x.Grade).FirstOrDefault(); |
| | | Dt_Task? task = BaseDal.QueryData(x=>x.TaskType==TaskTypeEnum.OutProduct.ObjToInt()).OrderBy(x=>x.Grade).FirstOrDefault(); |
| | | //æ´æ°åºåºç®çä½ç½® |
| | | result.Item1.ForEach(x => |
| | | { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using SqlSugar; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.MaterielEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.ERP; |
| | | using WIDESEA_DTO.QMS; |
| | | using WIDESEA_External.ERPService; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEA_External.QMSService; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IInboundRepository; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_InboundService; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_Model.Models; |
| | | using static WIDESEA_DTO.ErpResponseContent; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.QMS |
| | | { |
| | | /// <summary> |
| | | /// ERPæ¥å£ |
| | | /// </summary> |
| | | [Route("api/Qms")] |
| | | [ApiController] |
| | | public class QmsController : ControllerBase |
| | | { |
| | | private readonly IBasicService _basicService; |
| | | private readonly IOutboundService _outboundService; |
| | | private readonly IInboundService _inboundService; |
| | | private readonly IInvokeERPService _invokeERPService; |
| | | private readonly IReturnOrderService _returnOrderService; |
| | | private readonly IInvokeQMSService _invokeQMSService; |
| | | |
| | | public QmsController(IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, |
| | | IInvokeERPService invokeERPService, IReturnOrderService returnOrderService, IInvokeQMSService invokeQMSService) |
| | | { |
| | | _basicService = basicService; |
| | | _outboundService = outboundService; |
| | | _inboundService = inboundService; |
| | | _invokeERPService = invokeERPService; |
| | | _returnOrderService = returnOrderService; |
| | | _invokeQMSService = invokeQMSService; |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// æ£éªååä¼ æ´æ° |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost, Route("CheckResultReturn"), AllowAnonymous, MethodParamsValidate] |
| | | //public ErpResponseContent ReceivePurchaseOrder([FromBody] Root<CheckResultDTO> model) |
| | | //{ |
| | | // WebResponseContent content = _inboundService.PurchaseOrderService.ReceivePurchaseOrder(model.Content); |
| | | // if (content.Status) return Instance.OK(); |
| | | // else return Instance.Error(content.Message); |
| | | //} |
| | | /// <summary> |
| | | /// æ¶è´§åæ¥ææ£éªæ¨é |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ReceiveCheck"), AllowAnonymous, MethodParamsValidate] |
| | | public string ReceivePurchaseOrder([FromBody] QMSReceiveCheckModel model) |
| | | { |
| | | string content = _invokeQMSService.InvokeReceiveCheckApi(model); |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æ£éªååä¼ æ´æ° |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("CheckResultReturn"), AllowAnonymous, MethodParamsValidate] |
| | | public MesResponseContent CheckResultReturn([FromBody] ERPCheckModel model) |
| | | { |
| | | string content = _invokeERPService.InvokeCheckOrderApi(model); |
| | | ErpRequestContent requestContent = content.DeserializeObject<ErpRequestContent>(); |
| | | if (requestContent.res != 1) |
| | | { |
| | | return MesResponseContent.Instance.Error(requestContent.Data); |
| | | } |
| | | return MesResponseContent.Instance.OK("æå"); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return Service.AssignInboundTaskLocationByHeight(taskNum, roadwayNo, heightType); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("RequestZHInboundTask"), AllowAnonymous] |
| | | public WebResponseContent RequestZHInboundTask(string agvTaskCode, string palletCode, string palletType, string materialLot) |
| | | { |
| | | return Service.RequestZHInboundTask(agvTaskCode,palletCode,palletType,materialLot); |
| | | } |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡å®æ |
| | | /// </summary> |
| | |
| | | { |
| | | return await Service.TaskCompleted(taskNum); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åä¸ªä»»å¡æ¨éè³WCS |
| | | /// </summary> |
| | |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PushTasksToWCSSingle"), AllowAnonymous] |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "") |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "", string agvtaskNum = "") |
| | | { |
| | | return Service.PushTasksToWCSSingle(taskNum, agvDescription); |
| | | return Service.PushTasksToWCSSingle(taskNum, agvDescription, agvtaskNum); |
| | | } |
| | | /// <summary> |
| | | /// éæ©åºåçæåºåºä»»å¡ |
| | |
| | | { |
| | | return Service.OutProductSelect(orderDetailId, proStockViews); |
| | | } |
| | | /// <summary> |
| | | /// é»çæ¹æ¬¡ç©ææ¥è¯¢ |
| | | /// </summary> |
| | | [HttpPost, Route("GetZHMesMaterialLot"), AllowAnonymous] |
| | | public WebResponseContent GetZHMesMaterialLot(string materialLot) |
| | | { |
| | | return Service.GetZHMesMaterialLot(materialLot); |
| | | } |
| | | } |
| | | } |