| | |
| | | using HH.WCS.Mobox3.YNJT_BZP.process; |
| | | using HH.WCS.Mobox3.YNJT_BZP.util; |
| | | using HH.WCS.Mobox3.YNJT_BZP.wms; |
| | | using MySqlX.XDevAPI.Common; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | /// </summary> |
| | | public static void AutoEmptyTrayOutStock() |
| | | { |
| | | Location endLoc = LocationHelper.GetLoc(Settings.baseTrayOutBufferLoc); // 母拖出库接驳位 |
| | | if (endLoc != null && endLoc.N_CURRENT_NUM == 0 && endLoc.N_LOCK_STATE == 0) |
| | | foreach (var item in Settings.baseTrayBufferLocList) |
| | | { |
| | | var cst = WCSHelper.GetTaskByStartAndEnd(endLoc.S_CODE); |
| | | if (cst == null) |
| | | Location endLoc = LocationHelper.GetLoc(item.bufferOutLoc); // 母拖出库接驳位 |
| | | if (endLoc != null && endLoc.N_CURRENT_NUM == 0 && endLoc.N_LOCK_STATE == 0) |
| | | { |
| | | ApiHelper.baseTrayOutStock(endLoc.S_CODE, null , 0); |
| | | var cst = WCSHelper.GetTaskByStartAndEnd(endLoc.S_CODE); |
| | | if (cst == null) |
| | | { |
| | | ApiHelper.baseTrayOutStock(endLoc.S_CODE, null, 0); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 缓存空托自动出库 |
| | | /// </summary> |
| | | public static void BufferEmptyTrayOutStock() |
| | | { |
| | | var emptyTrayBuffers = WMSHelper.getEmptyTrayBufferList(); |
| | | foreach (var buffer in emptyTrayBuffers) |
| | | { |
| | | var dateTime = DateTime.Now.AddMinutes(-1); |
| | | if (buffer.T_CREATE < dateTime) |
| | | { |
| | | Location startLoc = WMSHelper.GetEmptyTrayStartLoc(buffer.TRAY_TYPE); |
| | | Location middleLoc = null; |
| | | string cntrCode = ""; |
| | | string descCntrCode = ""; |
| | | if (startLoc != null) |
| | | { |
| | | // 查询货位容器编码 、目标容器编码 |
| | | var locCntrRels = LocationHelper.GetLocCntrRel(startLoc.S_CODE); |
| | | if (locCntrRels.Count > 0) |
| | | { |
| | | foreach (var item in locCntrRels) |
| | | { |
| | | var container = ContainerHelper.GetCntr(item.S_CNTR_CODE); |
| | | if (buffer.TRAY_TYPE == container.N_TYPE) |
| | | { |
| | | descCntrCode = item.S_CNTR_CODE; |
| | | } |
| | | cntrCode = cntrCode + "," + item.S_CNTR_CODE; |
| | | } |
| | | cntrCode = cntrCode.Substring(1, cntrCode.Length - 1); |
| | | } |
| | | |
| | | var locCodes = Settings.getAgvJBLocList( startLoc.N_ROADWAY, 2); |
| | | if (locCodes.Count > 0) |
| | | { |
| | | middleLoc = LocationHelper.GetLoc(locCodes[0]); |
| | | } |
| | | } |
| | | |
| | | Location endLoc = LocationHelper.GetLoc(buffer.END_LOC); |
| | | |
| | | if (startLoc != null && endLoc != null) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = descCntrCode, |
| | | S_CODE = WMSHelper.GenerateTaskNo(), |
| | | S_START_LOC = startLoc.S_CODE, |
| | | S_START_AREA = startLoc.S_AREA_CODE, |
| | | S_END_LOC = endLoc.S_CODE, |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "空托出库任务", |
| | | S_OP_DEF_CODE = buffer.TASK_NO, |
| | | S_OP_DEF_NAME = "空托出库任务", |
| | | N_PRIORITY = buffer.PRIORITY, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | | |
| | | if (WMSHelper.CreateWmsTask(wmsTask)) |
| | | { |
| | | // 创建一段出库任务 |
| | | WCSTask wcsTask = new WCSTask() |
| | | { |
| | | S_OP_NAME = wmsTask.S_OP_DEF_NAME, |
| | | S_OP_CODE = wmsTask.S_CODE, |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_CNTR_CODE = cntrCode, |
| | | S_TYPE = wmsTask.S_TYPE + "-1", |
| | | S_START_LOC = startLoc.S_CODE, |
| | | S_START_AREA = startLoc.S_AREA_CODE, |
| | | S_END_LOC = middleLoc.S_CODE, |
| | | S_END_AREA = middleLoc.S_AREA_CODE, |
| | | S_SCHEDULE_TYPE = "WCS", |
| | | N_PRIORITY = 1, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | | |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | // 起点、接驳点、终点加锁 |
| | | LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); |
| | | LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); |
| | | |
| | | // 更新作业任务状态 |
| | | wmsTask.N_B_STATE = 1; |
| | | WMSHelper.UpdateTaskState(wmsTask); |
| | | |
| | | buffer.IS_CREATED = "Y"; |
| | | WMSHelper.updateEmptyTrayBuffer(buffer); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 条码状态更新 |
| | | /// </summary> |
| | | public static void BarcodeStatusUpdate() |
| | | { |
| | | |
| | | } |
| | | |
| | | } |
| | | } |