| | |
| | | try |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | string CntrCode = "";//托盘编码 |
| | | string ItemCode = "";//物料编码 |
| | | if (partData != null) |
| | | { |
| | | CntrCode = partData.rfid;//托盘编码 |
| | | ItemCode = partData.partNumber;//物料编码 |
| | | } |
| | | string Start = ""; //取货点 |
| | | string CntrCode = partData.rfid;//托盘编码 |
| | | string ItemCode = partData.partNumber;//物料编码 |
| | | string End = ""; |
| | | string areacode = ""; |
| | | string note = ""; //立库下发任务需要通知mes接口物料到位,用备注自动进行区分 |
| | | //根据物料获取对应库区 |
| | | #region 根据物料确认出库来源 |
| | | var iteminfo = db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE.Trim() == ItemCode).First(); |
| | | if (iteminfo != null) |
| | | { |
| | | //LogHelper.Info($"Createtask==>物料数据:{JsonConvert.SerializeObject(iteminfo)}"); |
| | | areacode = iteminfo.S_WH_CODE; |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(areacode)) |
| | | { |
| | | LogHelper.Info($"Createtask==>根据物料编码:{ItemCode}未能找到物料来源,需同步物料数据"); |
| | | result.code = "1"; |
| | | result.msg = $"根据物料编码:{ItemCode}未能找到物料来源,需同步物料数据"; |
| | | AddErrorInfo("寻找出库区失败", result.msg); |
| | | return result; |
| | | } |
| | | //var task = db.Queryable<WCSTask>().Where(a => a.S_EQ_NO.Trim() == taskData.taskNum).First(); |
| | | //if (task != null) |
| | | #region 根据任务来源字段判断库区来源来源 |
| | | //var iteminfo = db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE.Trim() == ItemCode).First(); |
| | | //if (iteminfo != null) |
| | | //{ |
| | | // LogHelper.Info($"Createtask==> 任务号{taskData.taskNum},该任务已经存在,不允许创建任务"); |
| | | // //LogHelper.Info($"Createtask==>物料数据:{JsonConvert.SerializeObject(iteminfo)}"); |
| | | // areacode = iteminfo.S_WH_CODE; |
| | | //} |
| | | |
| | | //if (string.IsNullOrEmpty(areacode)) |
| | | //{ |
| | | // LogHelper.Info($"Createtask==>根据物料编码:{ItemCode}未能找到物料来源,需同步物料数据"); |
| | | // result.code = "1"; |
| | | // result.msg = $"任务号{taskData.taskNum},该任务已经存在,不允许创建任务"; |
| | | // result.msg = $"根据物料编码:{ItemCode}未能找到物料来源,需同步物料数据"; |
| | | // AddErrorInfo("寻找出库区失败", result.msg); |
| | | // return result; |
| | | //} |
| | | int n_type = 0; //任务来源 1.钢丝立库 2.胶片库 3.预备库 ,4.原材料库,通过物料确认任务来源 |
| | | |
| | | switch (areacode) |
| | | |
| | | int n_type = 0; //任务来源 1.密炼立库 3.预备库 ,4.原材料库 |
| | | string Source = ""; |
| | | switch (taskData.source) |
| | | { |
| | | case "ML": |
| | | n_type = 1; |
| | | break; |
| | | case "JP": |
| | | n_type = 2; |
| | | Source = "密炼"; |
| | | break; |
| | | case "YBK": |
| | | n_type = 3; |
| | | Source = "预备库"; |
| | | break; |
| | | case "wmwhse1": |
| | | case "YCL": |
| | | n_type = 4; |
| | | Source = "原材料"; |
| | | break; |
| | | } |
| | | LogHelper.Info($"Createtask==>任务类型:{n_type}"); |
| | | Console.WriteLine($"Createtask==>任务来源:{n_type}"); |
| | | if (n_type == 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"物料库区:{areacode}属于未定义库区,请检查物料表重新定义物料库区"; |
| | | AddErrorInfo("物料库区未定义", result.msg); |
| | | result.msg = $"任务来源:{taskData.source}属于未定义库区,请检查物料来源是否属于约定字段"; |
| | | AddErrorInfo("任务来源未定义", result.msg); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | Location endloc = new Location(); |
| | |
| | | { |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | Start = taskData.pickStation; |
| | | if (CreateCntrIteminfo(Start, CntrCode, ItemCode, partData.partDesc, partData.partType, partData.lotNumber, partData.unit, partData.weight, taskData.carrierType, taskData.grade)) |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | endloc = Computeloc(CntrCode, taskData.dropStation, taskData.carrierType); |
| | | if (endloc != null) |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"机台编码:{taskData.dropStation},未找到可用货位"; |
| | | AddErrorInfo("寻找出库货位失败", result.msg); |
| | | AddErrorInfo("寻找出库货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg); |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Putin==> 任务起点:{taskData.pickStation}找不到对应货位,请检查货位表"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"Putin==> 任务起点:{taskData.pickStation}找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg); |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | } |
| | | } |
| | | else if (taskData.taskType == 2)//入库流程,直接使用起点货位和终点货位生成任务,起点需要有托盘 |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点{Start},未找到托盘货位绑定关系"; |
| | | AddErrorInfo("托盘查找失败", result.msg); |
| | | AddErrorInfo("托盘查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | { |
| | | Start = taskData.pickStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{taskData.dropStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 4)//原材料库需要判断是否需要分配电梯任务,创建分档任务 |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点:{startloc.S_AREA_CODE},终点:{endloc.S_AREA_CODE}未找到对应库区"; |
| | | AddErrorInfo("货位查找失败", result.msg); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | if (startArea.N_FLOOR == endArea.N_FLOOR) |
| | |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 5)//移库流程,直接使用起点货位和终点货位生成任务, |
| | | else if (taskData.taskType == 5)//移库流程,直接使用起点货位和终点货位生成任务,并绑定托盘 |
| | | { |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | if (CreateCntrIteminfo(taskData.pickStation, CntrCode, ItemCode, partData.partDesc, partData.partType, partData.lotNumber, partData.unit, partData.weight, taskData.carrierType, taskData.grade)) |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = taskData.pickStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{taskData.dropStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg); |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据托盘{partData.rfid},未找到托盘货位绑定关系"; |
| | | AddErrorInfo("货位查找失败", result.msg); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | { |
| | | note = "异常库区入库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | if (CreateCntrIteminfo(taskData.pickStation, CntrCode, ItemCode, partData.partDesc, partData.partType, partData.lotNumber, partData.unit, partData.weight, taskData.carrierType, taskData.grade)) |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"终点库区:{taskData.dropStation}无可用货位"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点库区:{taskData.dropStation},未找到对应货位"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg); |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点:{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点:{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | LogHelper.Info($"Createtask==> 任务类型有误"); |
| | | result.code = "1"; |
| | | result.msg = "任务类型:{taskData.taskType}不在规定范围内"; |
| | | AddErrorInfo("任务类型错误", result.msg); |
| | | AddErrorInfo("任务类型错误", result.msg, Source); |
| | | } |
| | | if (taskData.taskType != 4) |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 预备库任务状态下发 |
| | | /// </summary> |
| | |
| | | LogHelper.Info($"AllowThrough==> 参数为null"); |
| | | result.code = "1"; |
| | | result.msg = "参数为null值,请检查参数格式"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, "", model.task_no); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据下发任务号{model.task_no}未找到对应任务"; |
| | | AddErrorInfo("未找到任务", result.msg); |
| | | AddErrorInfo("未找到任务", result.msg, "", model.task_no); |
| | | return result; |
| | | } |
| | | return result; |
| | |
| | | try |
| | | { |
| | | //创建托盘数据绑定关系 |
| | | if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight,model.Qty)) |
| | | if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty)) |
| | | { |
| | | //创建成功流程 |
| | | } |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "产出信息下发失败,托盘物料绑定关系创建失败"; |
| | | AddErrorInfo("创建绑定关系失败", result.msg); |
| | | AddErrorInfo("创建绑定关系失败", result.msg, "Mes"); |
| | | return result; |
| | | } |
| | | return result; |
| | |
| | | internal static Result Putin(Putin model, int n_type) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "入平库任务下发成功" }; |
| | | string Source = "Mes"; |
| | | if (n_type == 0) |
| | | { |
| | | Source = "PDA"; |
| | | } |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | Location loc = new Location(); |
| | | |
| | | string Start = model.InitialLocation; //起点货位 |
| | | string itemcode = model.PartNumber; //物料编码 |
| | | string areacode = ""; |
| | | try |
| | | { |
| | | |
| | | |
| | | #region 判断托盘绑定货位是否和下发绑定起点相同,如果没绑定托盘则绑定托盘 |
| | | var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | | if (CntrLoc != null) |
| | | { |
| | | if (CntrLoc.S_LOC_CODE != Start) |
| | | { |
| | | LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"; |
| | | AddErrorInfo("托盘绑定位置不同", result.msg); |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("托盘绑定位置不同", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Putin==>库区:{areacode}无可用货位"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"库区:{areacode}无可用货位"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Putin==> 任务起点:{Start}找不到对应货位,请检查货位表"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"任务起点:{Start}找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点:{Start}有锁"; |
| | | AddErrorInfo("货位有锁", result.msg); |
| | | AddErrorInfo("货位有锁", result.msg, Source); |
| | | return result; |
| | | } |
| | | //创建wcs任务 |
| | |
| | | internal static Result PutOut(PutOut model, int n_type) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "出平库任务下发成功" }; |
| | | string Source = "Mes"; |
| | | if (n_type == 0) |
| | | { |
| | | Source = "PDA"; |
| | | } |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | string Start = ""; |
| | | string End = ""; |
| | | string CntrCode = ""; |
| | | |
| | | string itemcode = model.PartNumber; |
| | | string cntrType = ""; |
| | | string areacode = ""; |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"ItemBack:创建任务失败,物料号{model.PartNumber}不属于规定物料"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,物料号{model.PartNumber}不属于规定物料"; |
| | | AddErrorInfo("物料编码格式错误", result.msg); |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("物料编码格式错误", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"PutOut==> 任务物料:{itemcode}找不到对应库存"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"任务物料:{itemcode}找不到对应库存"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点{Start}有锁"; |
| | | AddErrorInfo("货位有锁", result.msg); |
| | | AddErrorInfo("货位有锁", result.msg, Source); |
| | | return result; |
| | | } |
| | | //创建wcs任务 |
| | |
| | | internal static Result Empty(Empty model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "空工装回库任务下发成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"叠盘货位不可用"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | else |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"根据货位备注:叠盘,货位楼层:{startloc.N_LAYER},货位仓库:{startloc.S_WH_CODE},找不到叠盘货位"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"叠盘货位不可用"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | LogHelper.Info($"根据货位备注:叠盘,货位楼层:{startloc.N_LAYER},货位仓库:{startloc.S_WH_CODE},找不到叠盘货位"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"叠盘货位不可用"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | else |
| | |
| | | LogHelper.Info($"根据货位备注:片胶堆叠位,货位仓库:{startloc.S_WH_CODE},找不到叠盘货位"); |
| | | result.code = "1"; |
| | | result.msg = $"叠盘货位不可用"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"创建任务失败,根据托盘编码{model.Rfid}未找到托盘出库任务"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,根据托盘编码{model.Rfid}未找到托盘出库任务"; |
| | | AddErrorInfo("查找任务失败", result.msg); |
| | | LogHelper.Info($"{result.msg}"); |
| | | AddErrorInfo("查找任务失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | if (string.IsNullOrEmpty(areacode)) |
| | | { |
| | | LogHelper.Info($"创建任务失败,根据托盘编码{model.Rfid}找到出库任务{mst.S_CODE}的起点库区为空"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,根据托盘编码{model.Rfid}找到出库任务{mst.S_CODE}的起点库区为空"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | LogHelper.Info($"{result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"库区:{areacode}无可用货位"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"库区:{areacode}无可用货位"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | LogHelper.Info($"{result.msg}"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Empty==> 任务起点:{Start}找不到对应货位,请检查货位表"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"Empty==> 任务起点:{Start}找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | LogHelper.Info($"{result.msg}"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | Result result = new Result() { code = "200", msg = "空工装呼叫任务下发成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"callfixture:创建空工装呼叫任务==>根据货位{endloc.S_CODE}未找到托盘货位绑定关系"); |
| | | result.code = "1"; |
| | | result.msg = $"创建空工装呼叫任务==>根据货位{endloc.S_CODE}未找到托盘货位绑定关系"; |
| | | AddErrorInfo("查找托盘失败", result.msg); |
| | | LogHelper.Info($"callfixture:{result.msg}"); |
| | | AddErrorInfo("查找托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"callfixture==> 任务起点:{End}找不到对应货位,请检查货位表"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"任务起点:{End}找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | LogHelper.Info($"callfixture:{result.msg}"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | |
| | | } |
| | | #endregion |
| | |
| | | internal static Result ItemBack(ItemBack model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "余料返回任务下发成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | |
| | | } |
| | |
| | | { |
| | | if (CntrLoc.S_LOC_CODE != Start) |
| | | { |
| | | LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"; |
| | | AddErrorInfo("托盘绑定位置不同", result.msg); |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("托盘绑定位置不同", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}未找到绑定货位"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}未找到绑定货位"; |
| | | AddErrorInfo("查找托盘货位失败", result.msg); |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("查找托盘货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"ItemBack:创建任务失败,物料号{model.PartNumber}不属于规定物料"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,物料号{model.PartNumber}不属于规定物料"; |
| | | AddErrorInfo("物料编码格式错误", result.msg); |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("物料编码格式错误", result.msg, Source); |
| | | return result; |
| | | } |
| | | var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == areacode).ToList(); |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"终点库区:{areacode}无可用货位"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点库区:{areacode},未找到对应货位"; |
| | | AddErrorInfo("查找库区失败", result.msg); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | //loc = StorageCompute(itemcode, areacode); |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"库区:{areacode}无可用货位"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"库区:{areacode}无可用货位"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"货位:{Start}找不到对应货位"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"货位:{Start}找不到对应货位"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | msg = "线边库存查询成功" |
| | | |
| | | }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | |
| | | } |
| | |
| | | internal static Result add(add model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "物料主数据创建成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | try |
| | |
| | | if (db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE == model.PartNumber).Count() > 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "物料主数据已存在"; |
| | | AddErrorInfo("物料主数据已存在", result.msg); |
| | | result.msg = $"物料编码:{model.PartNumber}的物料主数据已存在"; |
| | | // AddErrorInfo("物料主数据已存在", result.msg, Source); |
| | | LogHelper.Info($"add:{result.msg}"); |
| | | return result; |
| | | } |
| | | TN_Material itemInfo = new TN_Material(); |
| | | itemInfo.S_ITEM_CODE = model.PartNumber; |
| | | itemInfo.ITEM_TYPE = model.PartClass; |
| | | itemInfo.S_ITEM_NAME = model.PartDesc; |
| | | itemInfo.REMARK1 = model.StewingTime.ToString("yyyy-MM-dd"); |
| | | itemInfo.REMARK2 = model.OverdueTime.ToString("yyyy-MM-dd"); |
| | | itemInfo.REMARK1 = model.StewingTime; |
| | | itemInfo.REMARK2 = model.OverdueTime; |
| | | itemInfo.S_MP_TYPE = model.Unit; |
| | | |
| | | db.Insertable<TN_Material>(itemInfo).ExecuteCommand(); |
| | | if (db.Insertable<TN_Material>(itemInfo).ExecuteCommand()>0) |
| | | { |
| | | LogHelper.Info($"add:物料编码:{model.PartNumber}的物料主数据已同步"); |
| | | } ; |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"物料主数据创建失败 错误信息:{ex}"; |
| | | LogHelper.Error("add Error:" + ex.ToString(), ex); |
| | |
| | | internal static Result CreatTask(CreatTask model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "点对点任务创建成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | string Start = ""; //取货点 |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,根据起点{model.InitialLocation}未找到对应货位绑定托盘托盘"; |
| | | AddErrorInfo("查找托盘失败", result.msg); |
| | | AddErrorInfo("查找托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | internal static Result CreatelevatorTask(Elevator model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "点对点任务创建成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点{startloc.S_CODE}有锁"; |
| | | AddErrorInfo("货位有锁", result.msg); |
| | | AddErrorInfo("货位有锁", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).First(); |
| | | if (cntr == null) |
| | | { |
| | | LogHelper.Info($"callfixture:创建空工装呼叫任务==>根据货位{endloc.S_CODE}未找到托盘货位绑定关系"); |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"起点{model.Data.start_loc_code}未查询绑定托盘"; |
| | | AddErrorInfo("查找托盘失败", result.msg); |
| | | LogHelper.Info($"callfixture:创建空工装呼叫任务==>{result.msg}"); |
| | | AddErrorInfo("查找托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,根据货位编码:{dtcode}未找到电梯货位"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 货位信息上传 |
| | | /// </summary> |
| | |
| | | { |
| | | |
| | | Result result = new Result() { code = "200", msg = "货位信息上传成功" }; |
| | | String Source = "MES"; |
| | | RequestList<UploadLoc> result1 = new RequestList<UploadLoc>(); |
| | | List<UploadLoc> listuploadloc = new List<UploadLoc>(); |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"货位上传失败,根据货位编码{item.Location}未找到对应的货位信息"; |
| | | AddErrorInfo("查找货位失败", result.msg); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | LogHelper.Info($"物料到位回报失败=>回报地址没有配置"); |
| | | result.code = "1"; |
| | | result.msg = $"物料到位回报失败=>回报地址没有配置"; |
| | | AddErrorInfo("地址错误", result.msg); |
| | | AddErrorInfo("地址错误", result.msg, Source); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | internal static Result ClearLoc(ClearTask model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "库位清除成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | | AddErrorInfo("参数为空", result.msg); |
| | | AddErrorInfo("参数为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | string loc = model.LocationNum; |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据货位:{loc}找不到货位关系"; |
| | | AddErrorInfo("货位为空", result.msg); |
| | | AddErrorInfo("货位为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | |
| | | #endregion |
| | | var loc = LocationHelper.GetLocByItemCode(areacode, itemcode, level); |
| | | LogHelper.Info($"airlift=>根据库区编码:{areacode},物料编码:{itemcode},物料等级计算出有托盘货位{JsonConvert.SerializeObject(loc)}"); |
| | | result = FindStartcolByLoclist(loc); |
| | | LogHelper.Info($"airlift=>可用货位为:{JsonConvert.SerializeObject(result)}"); |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建托盘物料绑定关系 |
| | | /// 立库任务下发创建托盘物料绑定关系 |
| | | /// </summary> |
| | | /// <param name="loc">货位编码</param> |
| | | /// <param name="cntr">托盘编码</param> |
| | | /// <param name="partNumber">物料编码</param> |
| | | /// <param name="partDesc">物料描述</param> |
| | | /// <param name="partType">物料类型</param> |
| | | /// <param name="cntrtype">托盘类型</param> |
| | | /// <param name="unit">物料单位</param> |
| | | /// <param name="weight">物料重量</param> |
| | | internal static bool CreateCntrIteminfo(string loc, string cntr, string partNumber, string partDesc, string partType, string batch, string unit, string weight, string cntrtype = "1", string level = "") |
| | | internal static bool CreateCntrIteminfo(partData partData, taskData taskData) |
| | | { |
| | | return ContainerHelper.CreateCntrItem(loc, cntr, partNumber, partDesc, partType, cntrtype, batch, weight, unit, level); |
| | | if (partData == null && taskData == null) |
| | | { |
| | | LogHelper.Info($"CreateCntrIteminfo==> 立库任务下发参数有空,创建物料托盘绑定关系失败"); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return ContainerHelper.CreateCntrItem(taskData.pickStation, partData.rfid, partData.partNumber, partData.partDesc, partData.partType, taskData.carrierType, partData.lotNumber, taskData.wmsLot, partData.weight, partData.unit, |
| | | taskData.tyreType, taskData.supplier, taskData.receiveLot, taskData.subpool, partData.productionTime, partData.maturityTime, taskData.level); |
| | | } |
| | | |
| | | } |
| | | private static object _lockLocation = new object(); |
| | | /// <summary> |
| | | /// 根据托盘编码,机台编码,工装类型计算机台线边区域 |
| | | /// </summary> |
| | | /// <param name="cntrcode">托盘编码</param> |
| | | /// <param name="jtcode">机台编码</param> |
| | | /// <param name="cntrType">托盘类型</param> |
| | | /// <returns></returns> |
| | | internal static Location Computeloc(string cntrcode, string jtcode, string cntrType) |
| | | { |
| | |
| | | |
| | | // var location = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntrcode).First(); |
| | | |
| | | |
| | | var loc = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == jtcode.Trim() && a.S_NOTE == cntrType && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0).First(); |
| | | if (loc != null) |
| | | lock (_lockLocation) |
| | | { |
| | | End = loc; |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Computeloc==》根据机台分组:{jtcode},工装类型:{cntrType} 未找到空货位数据,请检查货位表"); |
| | | } |
| | | var loc = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == jtcode.Trim() && a.S_NOTE == cntrType && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0).First(); |
| | | if (loc != null) |
| | | { |
| | | End = loc; |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Computeloc==》根据机台分组:{jtcode},工装类型:{cntrType} 未找到空货位数据,请检查货位表"); |
| | | } |
| | | |
| | | } |
| | | return End; |
| | | } |
| | | |
| | |
| | | { |
| | | var error = new ErrorInfo |
| | | { |
| | | EEEORMESSAGE = errorInfo, |
| | | ERRORMESSAGE = errorInfo, |
| | | TASKNO = taskno, |
| | | AREACODE = areacode, |
| | | REMAKE = remake, |