| | |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"WMS系统未查询到终点货位:{model.endLocCode}"); |
| | | throw new BusinessException($"WMS系统未查询到终点货位:{model.endLocCode},请检查终点货位编码是否正确"); |
| | | } |
| | | else |
| | | |
| | | var areaCodes = Settings.getRelAreaCodes(endLoc.S_AREA_CODE); |
| | | if (areaCodes.Count == 0) |
| | | { |
| | | if (endLoc.C_ENABLE == "Y") |
| | | { |
| | | if (endLoc.N_LOCK_STATE != 0) |
| | | { |
| | | var existTask = WCSHelper.GetTaskByStartOrEnd(model.endLocCode); |
| | | if (existTask != null) |
| | | { |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"终点货位:{model.endLocCode} 已有任务"); |
| | | throw new BusinessException($"终点货位:{model.endLocCode} 已有任务"); |
| | | } |
| | | else |
| | | { |
| | | LocationHelper.UnLockLoc(model.endLocCode); // 没有任务就,自动解锁终点货位 |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"终点货位:{model.endLocCode} 已禁用,请联系管理人员解除禁用"); |
| | | throw new BusinessException($"终点货位:{model.endLocCode} 已禁用,请联系管理人员解除禁用"); |
| | | } |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"未配置库区:{endLoc.S_AREA_CODE}的关联关系"); |
| | | throw new BusinessException($"未配置库区:{endLoc.S_AREA_CODE}的关联关系"); |
| | | } |
| | | |
| | | var transfeRelevance = WMSHelper.GetTransfeRelevance(model.endLocCode); // 接驳货位关联属性 |
| | | if (transfeRelevance == null) |
| | | { |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"终点货位:{model.endLocCode},缺少配置属性,请联系管理人员进行配置属性"); |
| | | throw new BusinessException($"终点货位:{model.endLocCode},缺少配置属性,请联系管理人员进行配置属性"); |
| | | } |
| | | |
| | | Location startLoc = WMSHelper.getOutStockStartLoc(transfeRelevance.S_RELE_AREA, null); |
| | | Location startLoc = WMSHelper.getOutStockStartLoc(areaCodes[0], null); |
| | | if (startLoc == null) |
| | | { |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"未查询到空工装,立库可能缺少空工装"); |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"库区:{areaCodes[0]}未查询到空工装"); |
| | | throw new BusinessException($"未查询到空工装,立库可能缺少空工装"); |
| | | } |
| | | |
| | |
| | | S_END_LOC = endLoc.S_CODE, |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "空工装出库任务", |
| | | S_OP_DEF_NAME = "空工装出库缓存位", |
| | | S_OP_DEF_NAME = "空工装出库", |
| | | N_PRIORITY = 10, |
| | | T_START_TIME = DateTime.Now, |
| | | }; |
| | |
| | | |
| | | /// <summary> |
| | | /// WCS读码请求流程 |
| | | /// 1.判断RFID 是否读取成功(托盘号是否为空) |
| | | /// 2.查询关于RFID的预创建任务 |
| | | /// 3.如果读取成功,则激活预创建任务 |
| | | /// 4.如果读取不成功,查看异常区是否有空货位,有则创建搬运异常区任务,无则,记录异常激活预创建任务 |
| | | /// 业务场景:读码入库、读码出库 |
| | | /// 1.判断RFID是否存在WMS系统中,否,则默认为RFID无法识别 |
| | | /// 2.判断RFID是否与任务RFID是否一致 |
| | | /// 3.记录RFID异常信息 |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <returns></returns> |
| | |
| | | ResponseResult responseResult = new ResponseResult(); |
| | | |
| | | Location loc = LocationHelper.GetLoc(request.loc); |
| | | if (loc == null) |
| | | if (loc != null) |
| | | { |
| | | WMSHelper.addAlarmRecord("流程异常", "中", $"读码位:{request.loc},没有在WMS系统中录入"); |
| | | throw new BusinessException($"读码位:{request.loc},没有在WMS系统中录入"); |
| | | } |
| | | |
| | | var locCntrRels = LocationHelper.GetLocCntr(request.loc); |
| | | if (locCntrRels.Count > 0) |
| | | { |
| | | string taskCntrCode = locCntrRels[0].S_CNTR_CODE; |
| | | // 2.查询关于RFID的预创建任务 |
| | | var cst = WCSHelper.GetPreCreatedTaskByCntr(taskCntrCode); |
| | | var cst = WCSHelper.GetTask(request.taskNo); |
| | | if (cst != null) |
| | | { |
| | | bool errFlag = true; |
| | | // 1.判断RFID 是否读取成功(托盘号是否为空) |
| | | if (request.cntrNo != null) |
| | | var container = ContainerHelper.GetCntr(request.cntrNo); |
| | | if (container != null) |
| | | { |
| | | if (request.cntrNo == taskCntrCode) |
| | | if (cst.S_CNTR_CODE == request.cntrNo) |
| | | { |
| | | Container container = ContainerHelper.GetCntr(request.cntrNo); |
| | | if (container.N_E_STATE == 0) |
| | | { |
| | | errFlag = false; |
| | | WCSHelper.ActivatePreCreateTask(cst.S_OP_CODE); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ContainerHelper.UpdateCntrState(taskCntrCode, 1,"WCS反馈RFID与任务RFID不一致"); |
| | | ContainerHelper.UpdateCntrState(cst.S_CNTR_CODE, 1); |
| | | WMSHelper.addRfidAnomalyRecord(cst.S_CNTR_CODE, 2, request.loc, cst.S_CODE); |
| | | } |
| | | } |
| | | else |
| | | else |
| | | { |
| | | ContainerHelper.UpdateCntrState(taskCntrCode, 1,"WCS反馈RFID为null"); |
| | | } |
| | | |
| | | // 方案1 4.激活预创建任务 |
| | | if (errFlag) |
| | | { |
| | | WCSHelper.ActivatePreCreateTask(cst.S_OP_CODE,1); |
| | | ContainerHelper.UpdateCntrState(cst.S_CNTR_CODE, 1); |
| | | WMSHelper.addRfidAnomalyRecord(cst.S_CNTR_CODE, 1, request.loc, cst.S_CODE); |
| | | } |
| | | |
| | | // 方案2 4.如果读取不成功,查看异常区是否有空货位 |
| | |
| | | WCSHelper.ActivatePreCreateTask(cst.S_OP_CODE); |
| | | }*/ |
| | | } |
| | | else |
| | | else |
| | | { |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"读码位:{request.loc}触发读码请求,读码位上容器:{taskCntrCode}没有预创建任务"); |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"没有查询到读码的任务,任务号:{request.taskNo}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WMSHelper.addAlarmRecord("流程异常", "中", $"读码位:{request.loc},没有查询到容器"); |
| | | throw new BusinessException($"读码位:{request.loc},没有查询到容器"); |
| | | WMSHelper.addAlarmRecord("流程异常", "中", $"读码位:{request.loc},没有在WMS系统中录入"); |
| | | throw new BusinessException($"读码位:{request.loc},没有在WMS系统中录入"); |
| | | } |
| | | return responseResult; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public static ResponseResult offLineProcess(OffLineRequest model) { |
| | | ResponseResult responseResult = new ResponseResult(); |
| | | |
| | | // 查询起点货位是否存在已存在任务,防止任务重复发起 |
| | | var existWmsTask = WMSHelper.GetWmsTaskByStart(model.loc); |
| | | if (existWmsTask == null) |
| | | { |
| | | // 判断满料接驳位对应的空工装缓存位状态(查询线体光电) |
| | | // 查询对应机台的物料下线配置信息 |
| | | var logicConfig = WMSHelper.getLogicConfigByJtCode(model.jtNo); |
| | | if (logicConfig != null) |
| | | { |
| | | // 根据物料下线配置信息,判断任务类型是直连下线还是非直连下线 |
| | | if (logicConfig.S_TASK_TYPE == "1" || logicConfig.S_TASK_TYPE == "2") |
| | | { |
| | | // 满料下线(直连) |
| | | // 直连下线,需要判断校验RFID |
| | | LjMesTask mesTask = null; |
| | | if (model.cntrNo != null && model.cntrNo != "") |
| | | var container = ContainerHelper.GetCntr(model.cntrNo); |
| | | if (container != null) |
| | | { |
| | | var container = ContainerHelper.GetCntr(model.cntrNo); |
| | | if (container == null) |
| | | mesTask = WMSHelper.getLjMesTaskByCntr(model.cntrNo); |
| | | if (mesTask == null) |
| | | { |
| | | ContainerHelper.AddCntr(model.cntrNo); |
| | | ContainerHelper.UpdateCntrState(model.cntrNo, 1, $"满料下线(直连),WCS反馈的RFID:{model.cntrNo}在WMS系统中不存在"); |
| | | WMSHelper.addAlarmRecord("流程异常", "中", $"满料下线(直连),WCS反馈的RFID:{model.cntrNo}在WMS系统中不存在"); |
| | | } |
| | | else |
| | | { |
| | | ContainerHelper.UpdateCntrState(model.cntrNo, 0, ""); |
| | | mesTask = WMSHelper.getLjMesTaskByCntr(model.cntrNo); |
| | | if (mesTask == null) |
| | | { |
| | | ContainerHelper.UpdateCntrState(model.cntrNo, 1, $"未查询到MES任务"); |
| | | WMSHelper.addAlarmRecord("流程异常", "低", $"满料下线(直连),容器:{model.cntrNo}未查询到MES任务"); |
| | | } |
| | | ContainerHelper.UpdateCntrState(model.cntrNo, 1); |
| | | WMSHelper.addRfidAnomalyRecord(model.cntrNo, 3, model.loc, null); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | model.cntrNo = ContainerHelper.GenerateCntrNo(); |
| | | model.isNormal = false; |
| | | } |
| | | |
| | | if (!model.isNormal) |
| | | { |
| | | ContainerHelper.AddCntr(model.cntrNo); |
| | | ContainerHelper.UpdateCntrState(model.cntrNo, 1, $"WCS反馈的RFID:{model.cntrNo} 为空"); |
| | | WMSHelper.addAlarmRecord("流程异常", "中", $"WCS反馈的RFID:{model.cntrNo} 为空"); |
| | | ContainerHelper.UpdateCntrState(model.cntrNo, 1); |
| | | WMSHelper.addRfidAnomalyRecord(model.cntrNo, 1, model.loc, null); |
| | | } |
| | | triggerItemOffLineFlow(model.loc, model.cntrNo, logicConfig, mesTask); |
| | | } |
| | |
| | | return responseResult; |
| | | } |
| | | |
| | | middleLoc = WMSHelper.GetMinTaskTransfeLoc(startLoc.S_AREA_CODE, "1", "2"); |
| | | middleLoc = WMSHelper.GetMinTaskTransfeLoc(startLoc.S_AREA_CODE, 2 , 2); |
| | | if (middleLoc == null) { |
| | | WMSHelper.addAlarmRecord("流程异常", "高", $"MES叫料任务{mesTask.ID},立库接驳位可能处于锁定或禁用状态,请查看"); |
| | | responseResult.code = 1; |
| | |
| | | wmsEndLoc = WMSHelper.getInStockEndLoc(null, container.N_DETAIL_COUNT == 0 ? 0 : 1, container.N_TYPE); |
| | | if (wmsEndLoc != null) |
| | | { |
| | | agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, "1", "1", "2"); // 1.立库接驳位 1.入库 2.非直连 |
| | | agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, 1, 2); // 1.立库接驳位 1.入库 2.非直连 |
| | | if (agvEndLoc != null) |
| | | { |
| | | LogHelper.Info($"创建立库站台到立库的预创建任务,agv终点货位:{agvEndLoc.S_CODE},立库终点货位:{wmsEndLoc.S_CODE}", "AGV"); |
| | |
| | | wmsEndLoc = WMSHelper.getInStockEndLoc(null, container.N_DETAIL_COUNT == 0 ? 0 : 1, container.N_TYPE); |
| | | if (wmsEndLoc != null) |
| | | { |
| | | agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, "1", "1", "2"); // 1.立库接驳位 1.入库 2.非直连 |
| | | agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, 1, 2); // 1.立库接驳位 1.入库 2.非直连 |
| | | if (agvEndLoc != null) |
| | | { |
| | | LogHelper.Info($"创建立库站台到立库的预创建任务,agv终点货位:{agvEndLoc.S_CODE},立库终点货位:{wmsEndLoc.S_CODE}", "AGV"); |
| | |
| | | } |
| | | } |
| | | |
| | | middleLoc = WMSHelper.GetTransfeRelevanceLoc(startLoc.S_AREA_CODE, "1" , "2"); |
| | | middleLoc = WMSHelper.GetTransfeRelevanceLoc(startLoc.S_AREA_CODE, 1 , 2); |
| | | |
| | | if (middleLoc != null) |
| | | { |
| | |
| | | wmsEndLoc = WMSHelper.getInStockEndLoc(null, container.N_DETAIL_COUNT == 0 ? 0 : 1, container.N_TYPE); |
| | | if (wmsEndLoc != null) |
| | | { |
| | | agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, "1", "1", "2"); // 1.立库接驳位 1.入库 2.非直连 |
| | | agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, 1, 2); // 1.立库接驳位 1.入库 2.非直连 |
| | | if (agvEndLoc != null) |
| | | { |
| | | // 预先生成入库站台-立库终点的搬运任务 |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public static bool switchStationAttribute(SwitchStationAttributeModel model) |
| | | public static ResponseResult switchStationAttribute(SwitchStationAttributeModel model) |
| | | { |
| | | bool result = false; |
| | | ResponseResult responseResult = new ResponseResult(); |
| | | var task = WCSHelper.GetTaskByStartOrEnd(model.locCode); |
| | | if (task == null) |
| | | if (task == null) |
| | | { |
| | | var transfeRelevance= WMSHelper.GetTransfeRelevance(model.locCode); // 接驳位属性 |
| | | var transfeRelevance = WMSHelper.GetTransfeRelevance(model.locCode); // 接驳位属性 |
| | | LogHelper.Info($"原站台属性:{JsonConvert.SerializeObject(transfeRelevance)}", "WMS"); |
| | | if (transfeRelevance != null && transfeRelevance.S_TYPE == "1") |
| | | if (transfeRelevance != null && transfeRelevance.N_PROPERTY == 2) |
| | | { |
| | | if (model.signalType == "1") |
| | | { |
| | | if (transfeRelevance.S_PROPERTY == "2") |
| | | { |
| | | result = true; |
| | | } |
| | | else |
| | | { |
| | | result = WMSHelper.updateTransfeLocProperty(model.locCode, "2"); |
| | | } |
| | | WMSHelper.updateTransfeLocProperty(model.locCode, 0); |
| | | } |
| | | if (model.signalType == "2") |
| | | { |
| | | if (transfeRelevance.S_PROPERTY == "3") |
| | | { |
| | | result = true; |
| | | } |
| | | else |
| | | { |
| | | result = WMSHelper.updateTransfeLocProperty(model.locCode, "3"); |
| | | } |
| | | WMSHelper.updateTransfeLocProperty(model.locCode, 1); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | else |
| | | { |
| | | responseResult.code = 1; |
| | | responseResult.msg = "接驳位存在未完成的任务,无法切换站台属性"; |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public string taskNo { get; set; } // 托盘号 |
| | | public string loc { get; set; } // 货位 上料点、下料点、读码位、称重位(必填) |
| | | public string cntrNo { get; set; } // 托盘号 |
| | | public int signalType { get; set; } //请求类型 1:下线请求 2:叫料请求 3:读码请求(必填) |
| | |
| | | public string loc { get; set; } // 货位 上料点、下料点、读码位、称重位(必填) |
| | | public string cntrNo { get; set; } // 托盘号 |
| | | public string jtNo { get; set; } // 机台号 |
| | | public bool isNormal { get; set; } //是否异常 |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | public string loc { get; set; } // 货位 上料点、下料点、读码位、称重位(必填) |
| | | public string cntrNo { get; set; } // 托盘号 |
| | | public string taskNo { get; set; } // 任务号 |
| | | } |
| | | |
| | | public class AddTaskModel { |