| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 1.创建入库任务 |
| | | /// </summary> |
| | |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | if (model.taskType == "机台半制品入库" || model.taskType == "成型机余料回库") |
| | | if (model.taskType.Contains("机台半制品入库") || model.taskType.Contains("成型机余料入库")) |
| | | { |
| | | var itemInfos = model.itemInfo; |
| | | if (itemInfos == null || itemInfos.Count == 0) |
| | |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "物料信息不能为空"; |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | foreach (var item in itemInfos) |
| | | { |
| | | var overage = WMSHelper.getOverage(item.bc_entried); |
| | | if (overage != null) |
| | | { |
| | | DateTime txndate = DateTime.Parse(item.txndate); |
| | | DateTime minTime = txndate.AddHours(overage.MINHOUR); |
| | | DateTime maxTime = txndate.AddDays(overage.OVERAGE); |
| | | item.effective_time = minTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | item.expiration_time = maxTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = $"未查询到物料存放时间配置信息,条形码:{item.bc_entried}"; |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = model.taskType, |
| | | S_OP_DEF_CODE = model.taskNo, |
| | | S_OP_DEF_NAME = "半制品/余料/空托下发入库任务", |
| | | N_PRIORITY = model.priority, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | Location startLoc = WMSHelper.GetEmptyTrayStartLoc(model.trayType); |
| | | Location middleLoc = null; |
| | | string cntrCode = ""; |
| | | string descCntrCode = ""; |
| | | if (startLoc != null) |
| | | EmptyTrayBuffer buffer = new EmptyTrayBuffer() |
| | | { |
| | | // 查询货位容器编码 、目标容器编码 |
| | | 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 (model.trayType == 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(1, startLoc.N_ROADWAY, 2); |
| | | if (locCodes.Count > 0) |
| | | { |
| | | middleLoc = LocationHelper.GetLoc(locCodes[0]); |
| | | } |
| | | } |
| | | |
| | | Location endLoc = LocationHelper.GetLoc(model.endLoc); |
| | | if (endLoc == null) |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "WMS系统没有该货位,请检查终点货位编码是否正确"; |
| | | return result; |
| | | } |
| | | |
| | | if (startLoc != 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 = model.taskNo, |
| | | N_PRIORITY = model.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); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "库内没有查到空托盘"; |
| | | } |
| | | TASK_NO = model.taskNo, |
| | | TRAY_TYPE = model.trayType, |
| | | END_LOC = model.endLoc, |
| | | PRIORITY = model.priority, |
| | | }; |
| | | WMSHelper.addEmptyTrayBuffer(buffer); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode); |
| | | Location middleLoc = null; |
| | | string descCntrCode = ""; |
| | | string cntrCode = ""; |
| | | if (startLoc != null) |
| | | Location endLoc = LocationHelper.GetLoc(model.endLoc); |
| | | if (endLoc.N_CURRENT_NUM == 0) |
| | | { |
| | | // 查询接驳位 |
| | | var locCodes = Settings.getAgvJBLocList(1, startLoc.N_ROADWAY, 2); |
| | | if (locCodes.Count > 0) |
| | | int taskNum = 0; |
| | | for (int i = 0; i < endLoc.N_CAPACITY; i++) |
| | | { |
| | | middleLoc = LocationHelper.GetLoc(locCodes[0]); |
| | | Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode); |
| | | Location middleLoc = null; |
| | | string descCntrCode = ""; |
| | | string cntrCode = ""; |
| | | if (startLoc != null) |
| | | { |
| | | // 查询接驳位 |
| | | var locCodes = Settings.getAgvJBLocList(startLoc.N_ROADWAY, 2); |
| | | if (locCodes.Count > 0) |
| | | { |
| | | middleLoc = LocationHelper.GetLoc(locCodes[0]); |
| | | } |
| | | |
| | | // 查询货位容器编码 、目标容器编码 |
| | | var locCntrRels = LocationHelper.GetLocCntrRel(startLoc.S_CODE); |
| | | if (locCntrRels.Count > 0) |
| | | { |
| | | foreach (var item in locCntrRels) |
| | | { |
| | | var cntrItemRels = ContainerHelper.GetCntrItemRel(item.S_CNTR_CODE); |
| | | if (cntrItemRels.Count > 0) |
| | | { |
| | | descCntrCode = cntrItemRels[0].S_CNTR_CODE; |
| | | } |
| | | cntrCode = cntrCode + "," + item.S_CNTR_CODE; |
| | | } |
| | | cntrCode = cntrCode.Substring(1, cntrCode.Length - 1); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"库内没有物料:{model.itemCode}", "WMS"); |
| | | break; |
| | | } |
| | | |
| | | |
| | | if (endLoc != null) |
| | | { |
| | | string taskType = "成型机叫料出库任务"; |
| | | if (model.taskType == 2) |
| | | { |
| | | taskType = "抽检叫料出库任务"; |
| | | } |
| | | |
| | | |
| | | 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 = taskType, |
| | | S_OP_DEF_CODE = model.taskNo, |
| | | S_OP_DEF_NAME = "叫料出库任务", |
| | | N_PRIORITY = model.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); |
| | | taskNum++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 查询货位容器编码 、目标容器编码 |
| | | var locCntrRels = LocationHelper.GetLocCntrRel(startLoc.S_CODE); |
| | | if (locCntrRels.Count > 0) |
| | | if (taskNum < endLoc.N_CAPACITY) |
| | | { |
| | | foreach (var item in locCntrRels) |
| | | { |
| | | var cntrItemRels = ContainerHelper.GetCntrItemRel(item.S_CNTR_CODE); |
| | | if (cntrItemRels.Count > 0) |
| | | { |
| | | descCntrCode = cntrItemRels[0].S_CNTR_CODE; |
| | | } |
| | | cntrCode = cntrCode + "," + item.S_CNTR_CODE; |
| | | } |
| | | cntrCode = cntrCode.Substring(1, cntrCode.Length - 1); |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = $"库内物料不足,已生成出库任务数:{taskNum}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "库内没有查到此物料"; |
| | | return result; |
| | | } |
| | | |
| | | Location endLoc = LocationHelper.GetLoc(model.endLoc); |
| | | if (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 = model.taskNo, |
| | | N_PRIORITY = model.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); |
| | | } |
| | | } |
| | | result.ResultMsg = "终点货位当前容量不为0,无法叫料"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | if(model.itemInfo != null && model.itemInfo.Count > 0) |
| | | { |
| | | foreach (var item in model.itemInfo) |
| | | { |
| | | var overage = WMSHelper.getOverage(item.bc_entried); |
| | | if (overage != null) |
| | | { |
| | | DateTime txndate = DateTime.Parse(item.txndate); |
| | | DateTime minTime = txndate.AddHours(overage.MINHOUR); |
| | | DateTime maxTime = txndate.AddDays(overage.OVERAGE); |
| | | item.effective_time = minTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | item.expiration_time = maxTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = $"未查询到物料存放时间配置信息,条形码:{item.bc_entried}"; |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var container = ContainerHelper.GetCntr(model.trayCode); |
| | | if (container != null) |
| | | if (container != null) |
| | | { |
| | | Location startLoc = LocationHelper.GetLoc(model.startLoc); |
| | | Location endLoc = WMSHelper.GetInstockEndLoc(container.N_TYPE, model.startLoc, 2); |
| | |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "人工入库任务", |
| | | S_OP_DEF_CODE = model.taskNo, |
| | | S_OP_DEF_NAME = "人工入库任务", |
| | | N_PRIORITY = model.priority, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "没有空余的货位"; |
| | | result.ResultMsg = "立库没有空余的货位"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "WMS系统中没有该容器"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode , model.endLoc); |
| | | Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode,model.trayCode , model.endLoc); |
| | | Location endLoc = LocationHelper.GetLoc(model.endLoc); |
| | | |
| | | if (startLoc != null) |
| | |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "人工出库任务", |
| | | S_OP_DEF_CODE = model.taskNo, |
| | | S_OP_DEF_NAME = "人工出库任务", |
| | | N_PRIORITY = model.priority, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | |
| | | else |
| | | { |
| | | result.ResultCode = 1; |
| | | result.ResultMsg = "库内没有此物料"; |
| | | result.ResultMsg = "库内没有满足条件的物料"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "母拖入库任务", |
| | | S_OP_DEF_CODE = taskNo, |
| | | S_OP_DEF_NAME = "母拖入库任务", |
| | | N_PRIORITY = 1, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | |
| | | /// <param name="loc"></param> |
| | | /// <param name="wmsTaskNo"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult baseTrayInStockAgv(string loc, string wmsTaskNo) |
| | | public static ReturnResult autoBaseTrayInStock(string loc, string wmsTaskNo) |
| | | { |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | var mst = WMSHelper.GetWmsTask(wmsTaskNo); |
| | | if (mst != null && mst.N_B_STATE < 2) |
| | | var cst = WCSHelper.GetTaskByStart(loc); |
| | | if (cst == null) |
| | | { |
| | | Location startLoc = LocationHelper.GetLoc(loc); |
| | | Location endLoc = LocationHelper.GetLoc(Settings.baseTrayInBufferLoc); |
| | | if (!(endLoc != null && endLoc.N_CURRENT_NUM == 0)) |
| | | Location endLoc = null; |
| | | var baseTrayBufferLoc = Settings.baseTrayBufferLocList.Where(a => a.bufferOutLoc == loc).FirstOrDefault(); |
| | | if (baseTrayBufferLoc != null) |
| | | { |
| | | endLoc = LocationHelper.GetLoc(baseTrayBufferLoc.bufferInLoc); |
| | | } |
| | | if (endLoc == null || endLoc.N_CURRENT_NUM > 0) |
| | | { |
| | | endLoc = WMSHelper.GetInstockEndLoc(0, loc, 2); |
| | | } |
| | | } |
| | | |
| | | if (endLoc != null && startLoc != null) |
| | | { |
| | |
| | | // 创建一段入库任务 |
| | | WCSTask wcsTask = new WCSTask() |
| | | { |
| | | S_OP_NAME = mst.S_OP_DEF_NAME, |
| | | S_OP_CODE = mst.S_CODE, |
| | | S_OP_CODE = wmsTaskNo, |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_CNTR_CODE = trayCode, |
| | | S_TYPE = "母拖入库任务", |
| | |
| | | /// <param name="loc"></param> |
| | | /// <param name="taskNo"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult baseTrayOutStock(string loc ,string taskNo) |
| | | public static ReturnResult baseTrayOutStock(string loc ,string taskNo ,int exclude = 1) |
| | | { |
| | | LogHelper.Info("【母拖出库任务】开始下发母拖出库任务", "WMS"); |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | Location startLoc = LocationHelper.GetLoc(Settings.baseTrayInBufferLoc); |
| | | Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0, exclude); |
| | | Location endLoc = LocationHelper.GetLoc(loc); |
| | | var agvJBLoc = Settings.getAgvJBLoc(loc); |
| | | |
| | | if (startLoc != null && startLoc.N_CURRENT_NUM == 1 && agvJBLoc.type == 1) |
| | | { |
| | | var locCntrRels = LocationHelper.GetLocCntrRel(startLoc.S_CODE); |
| | | if (locCntrRels.Count > 0) |
| | | { |
| | | var container = ContainerHelper.GetCntr(locCntrRels[0].S_CNTR_CODE); |
| | | if (container.N_TYPE != 0) |
| | | { |
| | | startLoc = null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(startLoc == null || startLoc.N_CURRENT_NUM != 1) |
| | | { |
| | | startLoc = WMSHelper.GetEmptyTrayStartLoc(0); |
| | | } |
| | | |
| | | if (startLoc != null) |
| | | { |
| | |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "母拖出库任务", |
| | | S_OP_DEF_CODE = taskNo, |
| | | S_OP_DEF_NAME = "母拖出库任务", |
| | | N_PRIORITY = 1, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | |
| | | /// <param name="loc"></param> |
| | | /// <param name="wmsTaskNo"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult baseTrayOutStockAgv(string loc, string wmsTaskNo) |
| | | public static ReturnResult autoBaseTrayOutStock(string loc, string wmsTaskNo) |
| | | { |
| | | ReturnResult result = new ReturnResult(); |
| | | try |
| | | { |
| | | var mst = WMSHelper.GetWmsTask(wmsTaskNo); |
| | | if (mst != null && mst.N_B_STATE < 2) |
| | | var cst = WCSHelper.GetTaskByEnd(loc); |
| | | if (cst == null) |
| | | { |
| | | Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0); |
| | | Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0, 0); |
| | | Location endLoc = LocationHelper.GetLoc(loc); |
| | | |
| | | if (startLoc != null) |
| | |
| | | // 创建入库任务 |
| | | WCSTask wcsTask = new WCSTask() |
| | | { |
| | | S_OP_NAME = mst.S_OP_DEF_NAME, |
| | | S_OP_CODE = mst.S_CODE, |
| | | S_OP_CODE = wmsTaskNo, |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_CNTR_CODE = trayCode, |
| | | S_TYPE = "母拖出库任务", |
| | |
| | | TaskProcess.OperateStatus(cst, 6); |
| | | break; |
| | | case 7: |
| | | WCSHelper.UpdateStatus(cst, "异常取消"); |
| | | WCSHelper.Cancel(cst); |
| | | WCSHelper.UpdateStatus(cst, "取消"); |
| | | TaskProcess.OperateStatus(cst, 7); |
| | | mst.N_B_STATE = 3; |
| | | WMSHelper.UpdateTaskState(mst); |
| | | break; |
| | | case 8: |
| | | WCSHelper.UpdateStatus(cst, "强制完成"); |
| | |
| | | if(mst.N_B_STATE != 2) |
| | | { |
| | | // 创建下个任务 |
| | | if (cst.S_TYPE.Contains("出库") && !cst.S_TYPE.Contains("母拖")) |
| | | if (cst.S_TYPE.Contains("出库") && !cst.S_TYPE.Contains("母拖") && !cst.S_TYPE.Contains("人工")) |
| | | { |
| | | WCSCore.createLastTask(cst.S_END_LOC, mst, 2); |
| | | } |
| | |
| | | } |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 货位状态反馈 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public static bool locStateFeedBack(LocStateFeedBackModel model) |
| | | { |
| | | bool result = false; |
| | | var task = WCSHelper.GetTask(model.req_no); |
| | | if (task != null) |
| | | { |
| | | TaskAction taskAction = null; |
| | | if (model.type == "1") |
| | | { |
| | | taskAction = WCSHelper.getActionRecord(task.S_CODE, 1101); |
| | | } |
| | | if (model.type == "2") |
| | | { |
| | | taskAction = WCSHelper.getActionRecord(task.S_CODE, 1103); |
| | | } |
| | | if (taskAction != null) |
| | | { |
| | | taskAction.N_S_STATUS = 1; |
| | | result = WCSHelper.updateActionRecord(taskAction); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | S_ITEM = matl.item, |
| | | S_BC_ENTRIED = matl.bc_entried, |
| | | S_TOOLING_CODE = matl.toolineCode, |
| | | S_MCN = matl.mcn, |
| | | S_OPR = matl.opr, |
| | | TXNDATE = DateTime.Parse(matl.txndate, enGB) , |
| | | S_SHIFT = matl.shift, |
| | | N_QTY = matl.qty, |
| | | N_STOCK = matl.stock, |
| | | S_LOKASI = matl.lokasi, |
| | | S_SARANA = matl.sarana, |
| | | BOM1 = matl.bom1, |
| | | BOM2 = matl.bom2, |
| | | BOM3 = matl.bom3, |
| | | S_FOVRAGE = matl.fovrage, |
| | | S_JDGE = matl.jdge, |
| | | S_WMS_JDGE = matl.WMS_jdge, |
| | | EFFECTIVE_TIME = matl.effective_time, |
| | | EXPIRATION_TIME = matl.expiration_time, |
| | | N_OVERAGE = matl.overagv, |
| | | N_MINHOUR = matl.minhour, |
| | | N_PRODUCT_TYPE_CODE = matl.productTypeCode, |
| | | LAST_MODIFY_TIME = matl.last_modify_time |
| | | }; |
| | | itemBarcodeInfos.Add(itemBarcodeInfo); |
| | |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步物料条码信息失败"; |
| | | responseResult.ResultMsg = "同步GT条码物料信息失败"; |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步物料状态信息 |
| | | /// 同步条码状态信息 |
| | | /// </summary> |
| | | /// <param name="updateMatlStatuses"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult synUpdateMatlStatus(List<UpdateMatlStatus> updateMatlStatuses) |
| | | public static ReturnResult synBarcodeStatus(List<UpdateMatlStatus> updateMatlStatuses) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | var bo = WMSHelper.batchUpdateItemStatus(updateMatlStatuses); |
| | | if (!bo) |
| | | List<iWMS_semi_bld_BCstatus> list = new List<iWMS_semi_bld_BCstatus> (); |
| | | if (updateMatlStatuses.Count > 0) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步物料状态信息失败"; |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步更新物料存放时间配置信息 |
| | | /// </summary> |
| | | /// <param name="overages"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult synUpdateMatlTimeConfig(List<MatlOverage> overages) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | if (overages != null && overages.Count > 0) |
| | | { |
| | | List<Overage> overageList = new List<Overage>(); |
| | | |
| | | foreach (var item in overages) |
| | | foreach (var item in updateMatlStatuses) |
| | | { |
| | | Overage overage = new Overage |
| | | iWMS_semi_bld_BCstatus bCstatus = new iWMS_semi_bld_BCstatus() |
| | | { |
| | | MCNGRP = item.mcngrp, |
| | | ITEMPATT = item.itempatt, |
| | | OVERAGE = item.overage, |
| | | MINHOUR = int.Parse(item.minhour.ToString()) , |
| | | FLAG_STS = item.flag_sts, |
| | | S_BC_ENTRIED = item.bc_entried, |
| | | S_MCNGRP = item.mcngrp, |
| | | S_JDGE = item.jdge, |
| | | LAST_MODIFY_TIME = item.last_modify_time |
| | | }; |
| | | overageList.Add(overage); |
| | | list.Add(bCstatus); |
| | | } |
| | | var bo = WMSHelper.batchUpdateMatlTimeConfig(overageList); |
| | | |
| | | var bo = WMSHelper.synBarcodeStatus(list); |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步物料状态信息失败"; |
| | | responseResult.ResultMsg = "同步条码状态信息失败"; |
| | | } |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 记录数据同步时间 |
| | | /// 同步条码状态信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="updateMatlStatuses"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult recordDataSynTime(RecordDataSynTimeModel model) |
| | | public static ReturnResult synSamplingStatus(List<UpdateMatlStatus> updateMatlStatuses) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | SynDataTimeRecord record = new SynDataTimeRecord() |
| | | List<iWMS_semi_bld_BCsample> list = new List<iWMS_semi_bld_BCsample>(); |
| | | if (updateMatlStatuses.Count > 0) |
| | | { |
| | | S_SYN_TIME = model.sysTime, |
| | | N_SYN_NUM = model.synNum, |
| | | RECORD_TABLE = model.recordTable |
| | | }; |
| | | var bo = WMSHelper.addSynDataTimeReord(record); |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步物料状态信息失败"; |
| | | foreach (var item in updateMatlStatuses) |
| | | { |
| | | iWMS_semi_bld_BCsample bCstatus = new iWMS_semi_bld_BCsample() |
| | | { |
| | | S_BC_ENTRIED = item.bc_entried, |
| | | S_MCNGRP = item.mcngrp, |
| | | S_JDGE = item.jdge, |
| | | LAST_MODIFY_TIME = item.last_modify_time |
| | | }; |
| | | list.Add(bCstatus); |
| | | } |
| | | |
| | | var bo = WMSHelper.synSamplingStatus(list); |
| | | if (!bo) |
| | | { |
| | | responseResult.ResultCode = 1; |
| | | responseResult.ResultMsg = "同步条码状态信息失败"; |
| | | } |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 查询上一次的数据同步时间 |
| | | /// </summary> |
| | | /// <param name="recordTable"></param> |
| | | /// <param name="tableType"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult findLastDataSynTime(string recordTable) |
| | | public static ReturnResult findDataLastSynTime(int tableType) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | var synDataTime = WMSHelper.getLastDataSynTime(recordTable); |
| | | var synDataTime = WMSHelper.getDataLastSynTime(tableType); |
| | | responseResult.data = synDataTime; |
| | | return responseResult; |
| | | } |
| | |
| | | public class CreateOutOrderModel |
| | | { |
| | | public string taskNo { get; set; } // 任务号 |
| | | public string trayCode { get; set; } // 托盘号 |
| | | public string itemCode { get; set; } // 物料编码 |
| | | public string endLoc { get; set; } // 终点货位 |
| | | public int priority { get; set; } = 0; // 优先级 默认0 |
| | | public int taskType { get; set; } = 1; // 1.成型机叫料任务 2.抽检出库任务 |
| | | } |
| | | |
| | | public class EmptyTrayOutOrderModel |
| | |
| | | { |
| | | public string item { get; set; } // 物品代码 |
| | | public string bc_entried { get; set; } // 条形码编号 |
| | | public string toolineCode { get; set; } // 工装条码 |
| | | public string mcn { get; set; } // 机器代码编号 |
| | | public string opr { get; set; } // 操作员 |
| | | public string txndate { get; set; } // 生产时间 |
| | | public string shift { get; set; } // 工作班次 |
| | | public int qty { get; set; } // 产品数量 |
| | | public string sarana { get; set; } // 产品材料的托盘/盒/推车/货车ID |
| | | public string fovrage { get; set; } // 是否过期的状态 Y=过期,N=未过期 |
| | | public string jdge { get; set; } // 质量状态 OK=产品合格,NG=产品不合格,HLM=产品待定 |
| | | public string effective_time { get; set; } // 生效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public string expiration_time { get; set; } // 失效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public string jdge { get; set; } // 质量状态 OK=产品合格,HOLD = 产品待定 |
| | | public int overage { get; set; } // 生效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public int minhour { get; set; } // 失效时间 (yyyy-MM-dd HH:mm:ss) |
| | | public int productTypeCode { get; set; } // 失效时间 (yyyy-MM-dd HH:mm:ss) |
| | | } |
| | | |
| | | |