| | |
| | | using HH.WCS.Mobox3.YNJT_PT.device; |
| | | using HH.WCS.Mobox3.YNJT_PT.core; |
| | | using HH.WCS.Mobox3.YNJT_PT.device; |
| | | using HH.WCS.Mobox3.YNJT_PT.models; |
| | | 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; |
| | | using Swashbuckle.Swagger; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading; |
| | | using Ubiety.Dns.Core; |
| | | using static HH.WCS.Mobox3.YNJT_PT.api.ApiModel; |
| | | using static HH.WCS.Mobox3.YNJT_PT.api.OtherModel; |
| | | using static HH.WCS.Mobox3.YNJT_PT.api.WmsController; |
| | | using static HH.WCS.Mobox3.YNJT_PT.dispatch.WCSDispatch; |
| | | using static HH.WCS.Mobox3.YNJT_PT.util.Settings; |
| | | using static HH.WCS.Mobox3.YNJT_PT.wms.WMSHelper; |
| | | using static System.Net.Mime.MediaTypeNames; |
| | | |
| | | namespace HH.WCS.Mobox3.YNJT_PT.api { |
| | | /// <summary> |
| | |
| | | static ApiHelper() { |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 成型机下线记录 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | public static ResponseResult cxjOffLineRecord(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult response = new ResponseResult(); |
| | | var container = ContainerHelper.GetCntr(model.cntrNo); |
| | | if (container == null) |
| | | { |
| | | ContainerHelper.AddCntr(model.cntrNo); |
| | | } |
| | | |
| | | try |
| | | { |
| | | OffLineModel extData1 = JsonConvert.DeserializeObject<OffLineModel>(model.extData.ToString()); |
| | | OffLineRecord record = new OffLineRecord() |
| | | { |
| | | S_RFID = model.cntrNo, |
| | | S_DEVICE_NO = model.deviceNo, |
| | | N_IS_URGENT = extData1.isUrgent, |
| | | T_OFF_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | N_IS_FULL = extData1.isFull, |
| | | N_NEED_PAIR = extData1.needPair, |
| | | S_LOC = model.loc |
| | | }; |
| | | WMSHelper.addOffLineRecord(record); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Info($"添加成型机下线记录错误,错误原因:{ex.Message}", "WMS"); |
| | | response.code = 500; |
| | | response.msg = "WMS系统内部错误,请联系开发人员排查问题"; |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下线请求 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponseResult offLineRequest(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult response = new ResponseResult(); |
| | | var startLoc = LocationHelper.GetLoc(model.loc); |
| | | if (startLoc != null) |
| | | { |
| | | List<BarcodeModel> extData = JsonConvert.DeserializeObject<List<BarcodeModel>>(model.extData.ToString()); |
| | | int dataCount = extData.Count; |
| | | if (dataCount > 0) |
| | | { |
| | | var rfidExistNull = extData.Where(a => string.IsNullOrEmpty(a.rfid)).Count()>0; |
| | | if (rfidExistNull) |
| | | { |
| | | response.code = 1; |
| | | response.msg = "rfid不能为空"; |
| | | return response; |
| | | } |
| | | else |
| | | { |
| | | if (extData.Count > 0) |
| | | { |
| | | List<BarcodeModel> barcodeList = new List<BarcodeModel>(); |
| | | foreach (var ext in extData) |
| | | { |
| | | string rfid = ext.rfid; |
| | | if (rfid == "88888888") |
| | | { |
| | | // 记录托盘异常 |
| | | |
| | | } |
| | | else |
| | | { |
| | | // 查询成型机中间表,rfid 是否存在 |
| | | var offLineRecord = WMSHelper.getOffLineRecord(rfid); |
| | | if (offLineRecord != null) |
| | | { |
| | | if (offLineRecord.N_IS_FULL == 1) |
| | | { |
| | | if (ext.barcode.Contains("99999999")) |
| | | { |
| | | // 记录条码扫描异常 |
| | | |
| | | } |
| | | else |
| | | { |
| | | // 2.查询物料条码信息表,条码信息是否存在 |
| | | 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 |
| | | { |
| | | // 记录查询条码信息异常 |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | EndLocGroup endLocGroup = null; |
| | | if (barcodeList.Count > 0) |
| | | { |
| | | string itemCode = null; |
| | | var cntrItemRels = ContainerHelper.GetCntrItemRel(barcodeList[0].rfid); |
| | | if (cntrItemRels.Count > 0) |
| | | { |
| | | itemCode = cntrItemRels[0].S_ITEM_CODE; |
| | | } |
| | | endLocGroup = WMSHelper.getInStockEndLoc(barcodeList.Count, itemCode); |
| | | } |
| | | |
| | | foreach (var ext in extData) |
| | | { |
| | | Location endLoc = null; |
| | | string groupNo = null; |
| | | if (barcodeList.Contains(ext)) |
| | | { |
| | | // 满料入库 |
| | | if (endLocGroup != null) |
| | | { |
| | | groupNo = endLocGroup.groupNo; |
| | | endLoc = endLocGroup.endLocList[0]; |
| | | endLocGroup.endLocList.Remove(endLoc); |
| | | } |
| | | |
| | | if (endLoc != null) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = ext.rfid, |
| | | 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.reqId, |
| | | S_OP_DEF_NAME = "成型机满料下线入库", |
| | | N_PRIORITY = 1, |
| | | T_START_TIME = DateTime.Now, |
| | | S_GROUP_NO = groupNo, |
| | | }; |
| | | 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 = wmsTask.S_CNTR_CODE, |
| | | S_TYPE = wmsTask.S_TYPE, |
| | | 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_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); |
| | | |
| | | /*// 绑定容器物料信息 |
| | | var itemBarcodeInfo = WMSHelper.GetGreenTireInformation(ext.barcode); |
| | | WMSHelper.bindBarcodeItemInfo(wmsTask.S_CNTR_CODE, itemBarcodeInfo);*/ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 异常托盘排除 |
| | | var middleLoc = WMSHelper.getMinTaskMiddleLoc(1); // 1.排出位 |
| | | endLoc = WMSHelper.getOnlneLoc(2); // 2.空托上线位(排出的托盘都出库到空托上线位进行处理) |
| | | if (endLoc != null && middleLoc != null) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = ext.rfid, |
| | | 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.reqId, |
| | | S_OP_DEF_NAME = "异常托盘出库检修", |
| | | N_PRIORITY = 1, |
| | | 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 = wmsTask.S_CNTR_CODE, |
| | | S_TYPE = wmsTask.S_TYPE, |
| | | 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 |
| | | { |
| | | LogHelper.Info("异常托盘排出,未获取异常排除接驳位", "WMS"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | response.code = 1; |
| | | response.msg = "入参缺少托盘和条码信息"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | response.code = 1; |
| | | response.msg = "起点货位不存在"; |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读码请求 |
| | | /// 场景:1. |
| | | /// </summary> |
| | | public static ResponseResult readCodeRequest(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult response = new ResponseResult(); |
| | | readCodeFeedbackResponse readCodeFeedbackResponse = new readCodeFeedbackResponse() |
| | | { |
| | | verifyResult = true |
| | | }; |
| | | var wcsTask = WCSHelper.GetTask(model.taskNo); |
| | | var wmsTask = WMSHelper.GetWmsTask(wcsTask.S_OP_CODE); |
| | | if (wcsTask != null && wmsTask != null) |
| | | { |
| | | Location endLoc = LocationHelper.GetLoc(wmsTask.S_END_LOC); // 原终点 |
| | | if (wcsTask.S_TYPE == "满料下线入库任务") |
| | | { |
| | | // 判断rfid是否异常 |
| | | if (model.cntrNo != wcsTask.S_CNTR_CODE) |
| | | { |
| | | // 查询排出口 |
| | | 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); |
| | | |
| | | readCodeFeedbackResponse.verifyResult = false; |
| | | readCodeFeedbackResponse.endLoc = middleLoc.S_CODE; |
| | | } |
| | | } |
| | | else if (wcsTask.S_TYPE == "胚胎叫料出库任务") |
| | | { |
| | | var cntrItemRels = ContainerHelper.GetCntrItemRel(wcsTask.S_CNTR_CODE); |
| | | if (model.cntrNo != wcsTask.S_CNTR_CODE || cntrItemRels.Count == 0 || cntrItemRels.Count > 0 && cntrItemRels[0].S_ITEM_STATE != "OK") |
| | | { |
| | | // 计算排出口 |
| | | 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 |
| | | { |
| | | response.code = 1; |
| | | response.msg = $"任务号:{model.taskNo},未查询到执行中的任务"; |
| | | } |
| | | response.data = readCodeFeedbackResponse; |
| | | return response; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 异常申请(取消任务) |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public static ResponseResult anomalyRequest(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult response = new ResponseResult(); |
| | | readCodeFeedbackResponse readCodeFeedbackResponse = new readCodeFeedbackResponse() |
| | | { |
| | | verifyResult = true |
| | | }; |
| | | var wcsTask = WCSHelper.GetTask(model.taskNo); |
| | | var wmsTask = WMSHelper.GetWmsTask(wcsTask.S_OP_CODE); |
| | | if (wcsTask != null && wmsTask != null) |
| | | { |
| | | Location endLoc = LocationHelper.GetLoc(wmsTask.S_END_LOC); // 原终点 |
| | | if (wcsTask.S_TYPE == "满料下线入库任务") |
| | | { |
| | | // 查询排出口 |
| | | var middleLoc = WMSHelper.getMinTaskMiddleLoc(1, 0, endLoc.N_ROADWAY); |
| | | 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; |
| | | |
| | | // 查询新终点 |
| | | endLoc = WMSHelper.getOnlneLoc(2); |
| | | } |
| | | else if (wcsTask.S_TYPE == "胚胎叫料出库任务") |
| | | { |
| | | endLoc = WMSHelper.getCallOutLoc(endLoc.N_ROW); |
| | | readCodeFeedbackResponse.verifyResult = false; |
| | | readCodeFeedbackResponse.endLoc = endLoc.S_CODE; |
| | | } |
| | | wmsTask.S_END_LOC = endLoc.S_CODE; |
| | | wmsTask.S_END_AREA = endLoc.S_AREA_CODE; |
| | | WMSHelper.UpdateTaskEnd(wmsTask); |
| | | } |
| | | else |
| | | { |
| | | response.code = 1; |
| | | response.msg = $"任务号:{model.taskNo},未查询到执行中的任务"; |
| | | } |
| | | 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> |
| | | /// 4.硫化机呼叫胚胎出库 |
| | | /// 逻辑: |
| | | /// 1.根据机台号查询【硫化机工单表】、【胚胎已完成的条码中间表】筛选当前班次的生产计划数量是否满足,当预计生产数量 = 实际数+在途数量 ,则停止叫料 |
| | | /// 2.查询机台号在【硫化机工单表】对应的物料编码, |
| | | /// 开始计算(1.巷道不报警、2.物料状态OK、3.小于失效时间 大于等于生效时间 4.加急料先出、5.先入先出(生产时间))出库物料,生成任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | public static ResponseResult callItemOutStock(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult response = new ResponseResult(); |
| | | |
| | | var locCodes = model.loc.Split(',').ToList(); |
| | | |
| | | int locNum = locCodes.Count; |
| | | if (locNum > 0) |
| | | { |
| | | Location prevLoc = null; |
| | | Dictionary<string,Location> outLocDic = new Dictionary<string,Location>(); |
| | | foreach (var mcn in locCodes) |
| | | { |
| | | // 1.一个硫化机工位只能同时存在一个正在执行中的任务 |
| | | var existTask = WCSHelper.GetTaskByEnd(mcn); |
| | | if (existTask.Count == 0) |
| | | { |
| | | // 2.根据当前时间,判断班次日期和班次 |
| | | var currentTime = DateTime.Now; |
| | | var shift = getShift(currentTime.TimeOfDay); // 班次 |
| | | var dateShift = currentTime.ToString("dd/MM/yyyy"); |
| | | TimeSpan shiftIII_Start = new TimeSpan(7, 00, 0); // 7:00:00 |
| | | if (shift == "III" && currentTime.TimeOfDay < shiftIII_Start) |
| | | { |
| | | dateShift = DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy"); |
| | | } |
| | | |
| | | // 3.根据班次日期+班次+硫化机工位号查询 硫化机工单 中的物料编码、预计生产数量 |
| | | var productionShedule = WMSHelper.getProductionShedule(dateShift, mcn, shift); |
| | | |
| | | if (productionShedule != null && productionShedule.QTY != 0) |
| | | { |
| | | // 4查询【胚胎已完成的条码中间表】并计算当前班次的已完成数量 |
| | | int finishNum = WMSHelper.getEmbryoFinishNum(dateShift, mcn, shift); |
| | | if (productionShedule.QTY > finishNum) |
| | | { |
| | | // 5.出库策略 1.优先查询前一拖货位的左右两边是否满足条件 2.计算(1.巷道不报警、2.物料状态OK、3.小于失效时间 大于等于生效时间 4.加急料先出、5.先入先出(生产时间))出库物料,生成任务 |
| | | var startLoc = WMSHelper.getOutStockStartLoc(productionShedule.ITEMCODE, prevLoc); |
| | | if (startLoc != null) |
| | | { |
| | | outLocDic.Add(mcn, startLoc); |
| | | prevLoc = startLoc; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 6.判断出库货位是否是同一巷道,同一巷道生成任务组号 |
| | | string groupNo = null; |
| | | if (outLocDic.Count > 1) |
| | | { |
| | | var groupNum = outLocDic.Select(a => a.Value).ToList().GroupBy(a => a.N_ROADWAY).Count(); |
| | | if (groupNum == 1) |
| | | { |
| | | groupNo = GenerateTaskGroupNo(); |
| | | } |
| | | } |
| | | |
| | | // 7.生成出库任务 |
| | | if (outLocDic.Count > 0) |
| | | { |
| | | foreach (var item in outLocDic) |
| | | { |
| | | Location endLoc = LocationHelper.GetLoc(item.Key); |
| | | Location startLoc = item.Value; |
| | | if (endLoc != null) |
| | | { |
| | | var locCntrRels = LocationHelper.GetLocCntr(startLoc.S_CODE); |
| | | if (locCntrRels != null && locCntrRels.Count > 0) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = locCntrRels[0].S_CNTR_CODE, |
| | | 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.reqId, |
| | | S_OP_DEF_NAME = "硫化机呼叫胚胎出库", |
| | | N_PRIORITY = 1, |
| | | T_START_TIME = DateTime.Now, |
| | | S_GROUP_NO = groupNo, |
| | | }; |
| | | 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 = wmsTask.S_CNTR_CODE, |
| | | S_TYPE = wmsTask.S_TYPE, |
| | | 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_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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空托入库 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public static ResponseResult emptyTrayInStock(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult response = new ResponseResult(); |
| | | Location startLoc = LocationHelper.GetLoc(model.loc); |
| | | |
| | | var cntrCodeList = model.loc.Split(',').ToList(); |
| | | if (cntrCodeList.Count > 0) |
| | | { |
| | | var endLocGroup = WMSHelper.getInStockEndLoc(cntrCodeList.Count, null); |
| | | if (endLocGroup.endLocList.Count > 0) |
| | | { |
| | | foreach (var endLoc in endLocGroup.endLocList) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = model.cntrNo, |
| | | 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.reqId, |
| | | S_OP_DEF_NAME = "空托盘回库任务", |
| | | N_PRIORITY = 1, |
| | | T_START_TIME = DateTime.Now, |
| | | S_GROUP_NO = endLocGroup.groupNo, |
| | | }; |
| | | 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 = wmsTask.S_CNTR_CODE, |
| | | S_TYPE = wmsTask.S_TYPE, |
| | | 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_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 |
| | | { |
| | | response.code = 1; |
| | | response.msg = "库区没有可入的空货位"; |
| | | } |
| | | } |
| | | |
| | | return response; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 呼叫空托出库 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ResponseResult callEmptyTrayOutStock(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult responseResult = new ResponseResult(); |
| | | int executeNum = 0; |
| | | string startLocCode = null; |
| | | for (int i = 1; i <= 2; i++) |
| | | { |
| | | Location startLoc = WMSHelper.getOutStockStartLoc(startLocCode); |
| | | if (startLoc != null) |
| | | { |
| | | startLocCode = startLoc.S_CODE; |
| | | Location endLoc = WMSHelper.getMinTaskMiddleLoc(1, 0, startLoc.N_ROADWAY); |
| | | if (endLoc != null) |
| | | { |
| | | var locCntrRels = LocationHelper.GetLocCntr(startLoc.S_CODE); |
| | | if (locCntrRels != null && locCntrRels.Count > 0) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = locCntrRels[0].S_CNTR_CODE, |
| | | 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.reqId, |
| | | S_OP_DEF_NAME = "呼叫空托出库", |
| | | N_PRIORITY = 1, |
| | | 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 = wmsTask.S_CNTR_CODE, |
| | | S_TYPE = wmsTask.S_TYPE, |
| | | 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_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); |
| | | |
| | | executeNum += 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (executeNum < 1) |
| | | { |
| | | responseResult.code = 1; |
| | | responseResult.msg = "立库内空托盘数量不足"; |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 胚胎抽检出库 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static SimpleResult embryoCheckOutStock(EmbryoCheckOutStockModel model) |
| | | { |
| | | SimpleResult result = new SimpleResult(); |
| | | var locCntrs = LocationHelper.GetLocCntrRelByCntr(model.trayCode); |
| | | if (locCntrs.Count == 1) |
| | | { |
| | | Location startLoc = LocationHelper.GetLoc(locCntrs[0].S_LOC_CODE); |
| | | 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) |
| | | { |
| | | var wmsTask = new WMSTask() |
| | | { |
| | | S_CNTR_CODE = model.trayCode, |
| | | 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.reqId, |
| | | S_OP_DEF_NAME = "胚胎抽检出库出库任务", |
| | | N_PRIORITY = 1, |
| | | 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 = wmsTask.S_CNTR_CODE, |
| | | S_TYPE = wmsTask.S_TYPE, |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 异常托盘回库流程 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public static ResponseResult anomalyTrayInStock(NotifyDeviceSignalModel model) |
| | | { |
| | | ResponseResult responseResult = new ResponseResult(); |
| | | LocationHelper.UnBindingLoc(model.loc, new List<string>() { model.cntrNo }); |
| | | ContainerHelper.deleteCntrItemRelByCntr(model.cntrNo); |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 任务状态回报 |
| | | /// 任务状态 1:开始/执行中;完成;3:准备取货;4:取货完成;5:准备卸货;6:卸货完成;7:异常取消;8:强制完成 |
| | | /// 1.根据任务状态回报更新货位状态、任务状态 |
| | | /// 2.更新任务中间表状态 |
| | | /// 4.更新出库任务中间表状态 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public static ReturnResult taskStatusFeedback(TaskStatusFeedbackModel model) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | WCSTask cst = WCSHelper.GetTask(model.taskNo); |
| | | if (cst != null) |
| | | { |
| | | bool isExist = WCSHelper.CheckActionRecordExist(cst.S_CODE, model.status); |
| | | if (!isExist) |
| | | { |
| | | WMSTask mst = WMSHelper.GetWmsTask(cst.S_OP_CODE); |
| | | if (mst != null) |
| | | { |
| | | switch (model.status) |
| | | { |
| | | case 1: |
| | | WCSHelper.Begin(cst); |
| | | break; |
| | | case 2: |
| | | WCSHelper.End(cst); |
| | | break; |
| | | case 3: |
| | | WCSHelper.UpdateStatus(cst, "准备取货"); |
| | | break; |
| | | case 4: |
| | | WCSHelper.UpdateStatus(cst, "取货完成"); |
| | | TaskProcess.OperateStatus(cst, 4); |
| | | break; |
| | | case 5: |
| | | WCSHelper.UpdateStatus(cst, "准备卸货"); |
| | | break; |
| | | case 6: |
| | | WCSHelper.UpdateStatus(cst, "卸货完成"); |
| | | TaskProcess.OperateStatus(cst, 6); |
| | | break; |
| | | case 7: |
| | | WCSHelper.Cancel(cst); |
| | | WCSHelper.UpdateStatus(cst, "取消"); |
| | | TaskProcess.OperateStatus(cst, 7); |
| | | break; |
| | | case 8: |
| | | WCSHelper.UpdateStatus(cst, "强制完成"); |
| | | WCSHelper.End(cst); |
| | | break; |
| | | } |
| | | // 添加WCS动作记录 |
| | | WCSHelper.AddActionRecord(model.taskNo, model.status, model.deviceNo, model.loc); |
| | | |
| | | if (model.status == 2 || model.status == 8) |
| | | { |
| | | if (mst != null && 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 }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询班次 |
| | | /// </summary> |
| | | /// <param name="time"></param> |
| | | /// <returns></returns> |
| | | public static string getShift(TimeSpan time) |
| | | { |
| | | TimeSpan shiftI_Start = new TimeSpan(07, 00, 0); // 07:00:00 |
| | | TimeSpan shiftI_End = new TimeSpan(14, 59, 59); // 14:59:59 |
| | | |
| | | TimeSpan shiftII_Start = new TimeSpan(15, 00, 0); // 15:00:00 |
| | | TimeSpan shiftII_End = new TimeSpan(22, 59, 59); // 22:59:59 |
| | | |
| | | TimeSpan shiftIII_Start = new TimeSpan(23, 00, 0); // 23:00:00 |
| | | TimeSpan shiftIII_End = new TimeSpan(06, 59, 59); // 06:59:59 |
| | | |
| | | // 判断是否在 Shift III(跨天需特殊处理) |
| | | bool isShiftIII = time >= shiftIII_Start || time <= shiftIII_End; |
| | | |
| | | // 返回结果 |
| | | if (time >= shiftI_Start && time <= shiftI_End) |
| | | return "I"; |
| | | else if (time >= shiftII_Start && time <= shiftII_End) |
| | | return "II"; |
| | | else if (isShiftIII) |
| | | return "III"; |
| | | else |
| | | return "No shift"; // 理论上不会触发 |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空托解绑 |
| | | /// </summary> |
| | | public static ReturnResult emptyTrayUnBind(EmptyTrayUnBindModel model) |
| | | { |
| | | ReturnResult responseResult = new ReturnResult(); |
| | | ContainerHelper.deleteCntrItemRelByCntr(model.rfid); |
| | | return responseResult; |
| | | } |
| | | |
| | | public class readCodeFeedbackResponse |
| | | { |
| | | public bool verifyResult { get; set; } |
| | | public string endLoc { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建任务 |
| | | /// </summary> |
| | |
| | | cacheInstockInfos.Add(pair); |
| | | } |
| | | } |
| | | |
| | | |
| | | internal static object in_lock = new object(); |
| | | |
| | | /// <summary> |
| | | /// pad入库 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static SimpleResult Instock(InstockInfo model) { |
| | | var result = new SimpleResult(); |
| | | //pda入库 |
| | | //1 判断起点有没有任务,有没有入库锁 |
| | | lock (in_lock) { |
| | | var loc = LocationHelper.GetLoc(model.start); |
| | | if (loc != null && loc.N_LOCK_STATE == 0) |
| | | { |
| | | //2 根据终点库区计算终点 |
| | | var end = WMSHelper.GetInstockEnd(model.item, model.endArea); |
| | | LogHelper.Info("终点货位:" + JsonConvert.SerializeObject(end), "TSSG"); |
| | | if (end != null) |
| | | { |
| | | var cntrCode = ContainerHelper.GenerateCntrNo(); |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_OP_NAME = "入库", |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "下线入库", |
| | | S_START_LOC = model.start, |
| | | S_END_LOC = end.S_CODE, |
| | | S_SCHEDULE_TYPE = "NDC", |
| | | N_CNTR_COUNT = 1, |
| | | S_CNTR_CODE = cntrCode, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = end.N_CURRENT_NUM + 1 |
| | | }; |
| | | if (ContainerHelper.BindNewCntrItem(model.start, cntrCode, model.item) && WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(model.start, 2); |
| | | LocationHelper.LockLoc(end.S_CODE, 1); |
| | | result.resultCode = 0; |
| | | result.resultMsg = $"任务创建成功,任务号为{wcsTask.S_CODE},终点为{end.S_CODE}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | addKeyValuePair(model.ip, model); |
| | | LogHelper.Info("缓存入库信息:" + JsonConvert.SerializeObject(model), "TSSG"); |
| | | result.resultCode = 2; |
| | | result.resultMsg = "未获取到入库终点"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.resultCode = 1; |
| | | result.resultMsg = "起点有任务未完成"; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移库 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static SimpleResult shiftStock(ShiftStockInfo model) |
| | | { |
| | | var result = new SimpleResult(); |
| | | //1 根据起点库区、排 确定起始货位 |
| | | var startLoc = WMSHelper.GetShiftStockStart(model.startArea, model.startRow); |
| | | if (startLoc != null && startLoc.N_LOCK_STATE == 0) |
| | | { |
| | | //2 根据终点库区计算终点 |
| | | var end = WMSHelper.GetShiftStockEnd( model.endArea, model.endRow); |
| | | if (end != null && end.N_LOCK_STATE == 0) |
| | | { |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_OP_NAME = "移库", |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "移库", |
| | | S_START_LOC = startLoc.S_CODE, |
| | | S_END_LOC = end.S_CODE, |
| | | S_SCHEDULE_TYPE = "NDC", |
| | | N_CNTR_COUNT = 1, |
| | | S_CNTR_CODE = startLoc.LocCntrRel.S_CNTR_CODE, |
| | | N_START_LAYER = startLoc.N_CURRENT_NUM, |
| | | N_END_LAYER = end.N_CURRENT_NUM + 1 |
| | | }; |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(startLoc.S_CODE, 2); |
| | | LocationHelper.LockLoc(end.S_CODE, 1); |
| | | result.resultCode = 0; |
| | | result.resultMsg = $"任务创建成功,任务号为{wcsTask.S_CODE},终点为{end.S_CODE}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.resultCode = 2; |
| | | result.resultMsg = "终点库区没有可入的货位"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.resultCode = 1; |
| | | result.resultMsg = "未找到指定物料"; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | internal static CodeInfo GetCodeInfo(string code, string org) { |
| | | //return new CodeInfo { Fitemid_XK=code, FSourceNo="123456"}; |
| | |
| | | public static void agvCarAlarm(string forkliftNo, string errCode , string errCode2 , string failCode) { |
| | | bool turnLight = false; |
| | | |
| | | var errCodeList = Settings.agvAlarmNoList.Where(a => a.type == 1).Select(a => a.dex).ToList(); |
| | | var errCode2List = Settings.agvAlarmNoList.Where(a => a.type == 2).Select(a => a.dex).ToList(); |
| | | var failCodeList = Settings.agvAlarmNoList.Where(a => a.type == 3).Select(a => a.dex).ToList(); |
| | | |
| | | if (errCodeList.Contains(int.Parse(errCode))) |
| | | { |
| | | turnLight = true; |
| | | LogHelper.Info("StopWord 错误码:" + errCode, "HosttoagvCar"); |
| | | } |
| | | if (errCode2List.Contains(int.Parse(errCode2))) |
| | | { |
| | | turnLight = true; |
| | | LogHelper.Info("StopWord2 错误码:" + errCode2, "HosttoagvCar"); |
| | | } |
| | | if (failCodeList.Contains(int.Parse(failCode))) |
| | | { |
| | | turnLight = true; |
| | | LogHelper.Info("failCode 错误码:" + failCode, "HosttoagvCar"); |
| | | } |
| | | |
| | | var alertorDevices = Settings.alertorLightInfos.Where(a => a.deviceNo == 5 || a.deviceNo == 6).ToList(); |
| | | foreach (var alertorDevice in alertorDevices) |
| | | { |
| | | if (turnLight) |
| | | { |
| | | var result = HH.WCS.Mobox3.YNJT_PT.device.PlcHelper.SendHex(alertorDevice.address, alertorDevice.turnLight); |
| | | LogHelper.Info("开灯,modbus 返回信号:" + result, "HosttoagvCar"); |
| | | } |
| | | /*else |
| | | { |
| | | var result = HH.WCS.Mobox3.YNJT_PT.device.PlcHelper.SendHex(alertorDevice.address, alertorDevice.offLight); |
| | | LogHelper.Info("关灯,modbus 返回信号:" + result, "HosttoagvCar"); |
| | | }*/ |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public class OffLineModel |
| | | { |
| | | public int isUrgent { get; set; } // N_IS_URGENT 是否加急(0.否 1.是) |
| | | public int isFull { get; set; } // 是否满拖 0.否 1.是 |
| | | public int needPair { get; set; } // 0.否 1.是(当前空托盘为配对托盘) |
| | | } |
| | | public class AddTaskModel { |
| | | public string From { get; set; } |
| | | public string To { get; set; } |