| | |
| | | using HH.WCS.Mobox3.YNJT_PT.process; |
| | | using HH.WCS.Mobox3.YNJT_PT.util; |
| | | using HH.WCS.Mobox3.YNJT_PT.wms; |
| | | using MySqlX.XDevAPI.Common; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using SqlSugar; |
| | |
| | | N_IS_URGENT = model.isUrgent, |
| | | T_OFF_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | N_IS_FULL = model.isFull, |
| | | |
| | | S_LOC = model.loc |
| | | }; |
| | | WMSHelper.addOffLineRecord(record); |
| | | } |
| | |
| | | var itemBarcodeInfo = WMSHelper.GetGreenTireInformation(ext.barcode); |
| | | if (itemBarcodeInfo != null) |
| | | { |
| | | itemBarcodeInfo.N_URGENT_FLAG = offLineRecord.N_IS_URGENT; |
| | | // 计算生效时间、失效时间 |
| | | var overage = WMSHelper.getOverage(itemBarcodeInfo.BARCODE); |
| | | LogHelper.Info($"计算生效时间、失效时间,返回值:{JsonConvert.SerializeObject(overage)}", "WMS"); |
| | | if (overage != null) |
| | | { |
| | | DateTime txndate = DateTime.Parse(itemBarcodeInfo.TXNDATE); |
| | | DateTime minTime = txndate.AddHours(overage.MINHOUR); |
| | | DateTime maxTime = txndate.AddDays(overage.OVERAGE); |
| | | itemBarcodeInfo.S_EFFECTIVE_TIME = minTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | itemBarcodeInfo.S_EXPIRATION_TIME = maxTime.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | else |
| | | { |
| | | response.code = 1; |
| | | response.msg = $"未查询到物料存放时间配置信息,条形码:{itemBarcodeInfo.BARCODE}"; |
| | | return response; |
| | | } |
| | | |
| | | ContainerHelper.addCntrItemRel(rfid, itemBarcodeInfo); |
| | | barcodeList.Add(ext); |
| | | } |
| | | else |
| | |
| | | wmsTask.N_B_STATE = 1; |
| | | WMSHelper.UpdateTaskState(wmsTask); |
| | | |
| | | // 绑定容器物料信息 |
| | | /*// 绑定容器物料信息 |
| | | var itemBarcodeInfo = WMSHelper.GetGreenTireInformation(ext.barcode); |
| | | WMSHelper.bindBarcodeItemInfo(wmsTask.S_CNTR_CODE, itemBarcodeInfo); |
| | | WMSHelper.bindBarcodeItemInfo(wmsTask.S_CNTR_CODE, itemBarcodeInfo);*/ |
| | | } |
| | | } |
| | | } |
| | |
| | | else |
| | | { |
| | | // 异常托盘排除 |
| | | var middleLoc = WMSHelper.getMinTaskMiddleLoc(1); // 1.异常排出位 |
| | | endLoc = WMSHelper.getAbnormalAreaEmptyLoc(Settings.abnormalArea); |
| | | var middleLoc = WMSHelper.getMinTaskMiddleLoc(1); // 1.排出位 |
| | | endLoc = WMSHelper.getOnlneLoc(2); // 2.空托上线位(排出的托盘都出库到空托上线位进行处理) |
| | | if (endLoc != null && middleLoc != null) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | |
| | | |
| | | /// <summary> |
| | | /// 读码请求 |
| | | /// 场景:1. |
| | | /// </summary> |
| | | public static ResponseResult readCodeRequest(NotifyDeviceSignalModel model) |
| | | { |
| | |
| | | { |
| | | verifyResult = true |
| | | }; |
| | | var wmsTask = WMSHelper.GetWmsTask(model.taskNo); |
| | | if (wmsTask != null) |
| | | var wcsTask = WCSHelper.GetTask(model.taskNo); |
| | | var wmsTask = WMSHelper.GetWmsTask(wcsTask.S_OP_CODE); |
| | | if (wcsTask != null && wmsTask != null) |
| | | { |
| | | if (wmsTask.S_TYPE != "异常托盘出库任务") |
| | | Location endLoc = LocationHelper.GetLoc(wmsTask.S_END_LOC); // 原终点 |
| | | if (wcsTask.S_TYPE == "满料下线入库任务") |
| | | { |
| | | Location endLoc = null; |
| | | Location middleLoc = null; |
| | | // 判断rfid是否异常 |
| | | if (model.cntrNo != wmsTask.S_CNTR_CODE) |
| | | if (model.cntrNo != wcsTask.S_CNTR_CODE) |
| | | { |
| | | endLoc = LocationHelper.GetLoc(wmsTask.S_END_LOC); |
| | | var connectLoc = Settings.connectLocList.Where(a => a.roadway == endLoc.N_ROADWAY && a.type == 1).FirstOrDefault(); |
| | | middleLoc = LocationHelper.GetLoc(connectLoc.locCode); |
| | | endLoc = WMSHelper.getAbnormalAreaEmptyLoc(Settings.abnormalArea); |
| | | // 查询排出口 |
| | | Location middleLoc = WMSHelper.getMinTaskMiddleLoc(1, 0, endLoc.N_ROADWAY); |
| | | // 查询新终点 |
| | | endLoc = WMSHelper.getOnlneLoc(2); |
| | | |
| | | wcsTask.S_END_LOC = middleLoc.S_CODE; |
| | | wcsTask.S_END_AREA = middleLoc.S_AREA_CODE; |
| | | WCSHelper.updateTaskEnd(wcsTask); |
| | | |
| | | wmsTask.S_END_LOC = endLoc.S_CODE; |
| | | wmsTask.S_END_AREA = endLoc.S_AREA_CODE; |
| | | WMSHelper.UpdateTaskEnd(wmsTask); |
| | | |
| | | var wcsTask = WCSHelper.GetTaskBySrcNo(wmsTask.S_CODE); |
| | | if (wcsTask != null) |
| | | { |
| | | wcsTask.S_END_LOC = middleLoc.S_CODE; |
| | | wcsTask.S_END_AREA = middleLoc.S_AREA_CODE; |
| | | WCSHelper.updateTaskEnd(wcsTask); |
| | | } |
| | | |
| | | readCodeFeedbackResponse.verifyResult = false; |
| | | readCodeFeedbackResponse.endLoc = middleLoc.S_CODE; |
| | | response.data = readCodeFeedbackResponse; |
| | | } |
| | | } |
| | | else if (wcsTask.S_TYPE == "胚胎叫料出库任务") |
| | | { |
| | | if (model.cntrNo != wcsTask.S_CNTR_CODE) |
| | | { |
| | | // 计算排出口 |
| | | endLoc = WMSHelper.getCallOutLoc(endLoc.N_ROW); |
| | | |
| | | wcsTask.S_END_LOC = endLoc.S_CODE; |
| | | wcsTask.S_END_AREA = endLoc.S_AREA_CODE; |
| | | WCSHelper.updateTaskEnd(wcsTask); |
| | | |
| | | wmsTask.S_END_LOC = endLoc.S_CODE; |
| | | wmsTask.S_END_AREA = endLoc.S_AREA_CODE; |
| | | WMSHelper.UpdateTaskEnd(wmsTask); |
| | | |
| | | readCodeFeedbackResponse.verifyResult = false; |
| | | readCodeFeedbackResponse.endLoc = endLoc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | var cntrItemRels = ContainerHelper.GetCntrItemRel(wmsTask.S_CNTR_CODE); |
| | | if (cntrItemRels.Count > 0) |
| | | var cntrItemRels = ContainerHelper.GetCntrItemRel(wcsTask.S_CNTR_CODE); |
| | | if (cntrItemRels.Count > 0) |
| | | { |
| | | if (cntrItemRels[0].S_ITEM_STATE != "OK") |
| | | if (cntrItemRels[0].S_ITEM_STATE != "OK") |
| | | { |
| | | middleLoc = WMSHelper.getMinTaskMiddleLoc(1); // 1.异常排出位 |
| | | endLoc = WMSHelper.getAbnormalAreaEmptyLoc(Settings.abnormalArea); |
| | | endLoc = WMSHelper.getMinTaskMiddleLoc(1,endLoc.N_ROADWAY); ; |
| | | |
| | | wcsTask.S_END_LOC = endLoc.S_CODE; |
| | | wcsTask.S_END_AREA = endLoc.S_AREA_CODE; |
| | | WCSHelper.updateTaskEnd(wcsTask); |
| | | |
| | | wmsTask.S_END_LOC = endLoc.S_CODE; |
| | | wmsTask.S_END_AREA = endLoc.S_AREA_CODE; |
| | | WMSHelper.UpdateTaskEnd(wmsTask); |
| | | |
| | | var wcsTask = WCSHelper.GetTaskBySrcNo(wmsTask.S_CODE); |
| | | if (wcsTask != null) |
| | | { |
| | | wcsTask.S_END_LOC = middleLoc.S_CODE; |
| | | wcsTask.S_END_AREA = middleLoc.S_AREA_CODE; |
| | | WCSHelper.updateTaskEnd(wcsTask); |
| | | } |
| | | |
| | | readCodeFeedbackResponse.verifyResult = false; |
| | | readCodeFeedbackResponse.endLoc = middleLoc.S_CODE; |
| | | response.data = readCodeFeedbackResponse; |
| | | readCodeFeedbackResponse.endLoc = endLoc.S_CODE; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | response.data = readCodeFeedbackResponse; |
| | | return response; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 申请新终点 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public static ResponseResult applyDest(ApplyDestModel model) |
| | | { |
| | | ResponseResult response = new ResponseResult(); |
| | | ApplyDest applyDest = new ApplyDest(); |
| | | var wcsTask = WCSHelper.GetTask(model.taskNo); |
| | | if (wcsTask != null) |
| | | { |
| | | var wmsTask = WMSHelper.GetWmsTask(wcsTask.S_OP_CODE); |
| | | if (wcsTask != null) |
| | | { |
| | | string itemCode = null; |
| | | var endLoc = LocationHelper.GetLoc(wcsTask.S_END_LOC); |
| | | var cntrItemRels = ContainerHelper.GetCntrItemRel(wcsTask.S_CNTR_CODE); |
| | | if (cntrItemRels.Count > 0) |
| | | { |
| | | itemCode = cntrItemRels[0].S_ITEM_CODE; |
| | | } |
| | | |
| | | if (model.applyType == 1) |
| | | { |
| | | LocationHelper.LockLoc(wcsTask.S_END_LOC, 3); // 将原货位锁定(其他锁) |
| | | var endLocGroup = WMSHelper.getInStockEndLoc(1, itemCode, endLoc.N_ROADWAY); |
| | | if (endLocGroup.endLocList.Count > 0) |
| | | { |
| | | endLoc = endLocGroup.endLocList[0]; |
| | | applyDest.endLoc = endLoc.S_CODE; |
| | | } |
| | | } |
| | | else if (model.applyType == 2) |
| | | { |
| | | var endLocGroup = WMSHelper.getInStockEndLoc(1, cntrItemRels[0].S_ITEM_CODE, 0, endLoc.N_ROADWAY); |
| | | if (endLocGroup.endLocList.Count > 0) |
| | | { |
| | | endLoc = endLocGroup.endLocList[0]; |
| | | applyDest.endLoc = endLoc.S_CODE; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | response.code = 1; |
| | | response.msg = $"任务:{model.taskNo}不存在"; |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | public class ApplyDest |
| | | { |
| | | public string endLoc { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | S_START_AREA = startLoc.S_AREA_CODE, |
| | | S_END_LOC = endLoc.S_CODE, |
| | | S_END_AREA = endLoc.S_AREA_CODE, |
| | | S_TYPE = "满料下线入库任务", |
| | | S_TYPE = "胚胎叫料出库任务", |
| | | S_OP_DEF_CODE = model.reqId, |
| | | S_OP_DEF_NAME = "成型机满料下线入库", |
| | | S_OP_DEF_NAME = "硫化机呼叫胚胎出库", |
| | | N_PRIORITY = 1, |
| | | T_START_TIME = DateTime.Now, |
| | | S_GROUP_NO = groupNo, |
| | |
| | | if (locCntrs.Count == 1) |
| | | { |
| | | Location startLoc = LocationHelper.GetLoc(locCntrs[0].S_LOC_CODE); |
| | | var connectLoc = Settings.connectLocList.Where(a => a.roadway == startLoc.N_ROADWAY && a.type == 1).First(); |
| | | var connectLoc = Settings.connectLocList.Where(a => a.roadway == startLoc.N_ROADWAY).First(); |
| | | Location middleLoc = LocationHelper.GetLoc(connectLoc.locCode); |
| | | Location endLoc = LocationHelper.GetLoc(""); |
| | | if (endLoc != null) |
| | |
| | | |
| | | if (model.status == 2 || model.status == 8) |
| | | { |
| | | if (mst != null) |
| | | if (mst != null && mst.N_B_STATE != 2) |
| | | { |
| | | if (mst.N_B_STATE != 2) |
| | | if (mst.S_END_LOC != cst.S_END_LOC) |
| | | { |
| | | WCSCore.createLastTask(cst.S_END_LOC, mst); |
| | | } |
| | | else |
| | | { |
| | | mst.N_B_STATE = 2; |
| | | WMSHelper.UpdateTaskState(mst); |
| | | } |
| | | |
| | | if (mst.S_TYPE == "呼叫空托出库") |
| | | { |
| | | LocationHelper.UnBindingLoc(mst.S_END_LOC, new List<string>() { mst.S_CNTR_CODE }); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public class OffLineModel |
| | | { |
| | | public string loc { get; set; } // 下线位 |
| | | public string rfid { get; set; } // 托盘号 |
| | | public string deviceNo { get; set; } // 机台号 |
| | | public int isUrgent { get; set; } // N_IS_URGENT 是否加急(0.否 1.是) |