| | |
| | | if (trayCode.errCode == 0 && trayCode.result.Length == 80) |
| | | { |
| | | //获取托盘码等信息 读取通道 10、11、12的数据作为托盘码 读取其它通道 重量 叠包等信息 所有数据存入MachineInfo表 |
| | | GetMachineData(pmInfo, trayCode.result); |
| | | string location = ""; |
| | | GetMachineData(pmInfo,ref location, trayCode.result); |
| | | var tray = MongoDBSingleton.Instance.FindOne<MachineInfo>(Query.EQ("machineNo", pmInfo.location), "MachineInfo"); |
| | | if (tray != null && tray.addState == 0) |
| | | { |
| | |
| | | if (trayCode.errCode == 0 && trayCode.result.Length == 95) |
| | | { |
| | | //获取托盘码等信息 读取通道 11、12、13的数据作为托盘码 读取其它通道 重量 叠包等信息 所有数据存入MachineInfo表 |
| | | GetMachineData(pmInfo, trayCode.result, false, "1"); |
| | | string flLoc = ""; |
| | | string location = ""; |
| | | GetMachineData(pmInfo,ref location, trayCode.result, false, "1"); |
| | | if (pmInfo.location.Contains("FLZT")) |
| | | { |
| | | flLoc = pmInfo.location; |
| | | pmInfo.location = location; |
| | | } |
| | | |
| | | var tray = MongoDBSingleton.Instance.FindOne<MachineInfo>(Query.EQ("machineNo", pmInfo.location), "MachineInfo"); |
| | | if (tray != null) |
| | | { |
| | |
| | | { |
| | | CMMLog.Info($"物料编码:{tray.materialCode},批次号:{tray.lotNo}"); |
| | | string timeStamp = ProcessHelper.GetTimeStamp(31, 1, 1); |
| | | pmInfo.location = !string.IsNullOrEmpty(flLoc) ? flLoc : pmInfo.location; |
| | | HHAmsExecuteResult req = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), pmInfo.location, PlcBit02, "3楼包装取料", 0, tray.trayCode, timeStamp); |
| | | ProcessHelper.deleteInfo(pmInfo.location + "-包装下线"); |
| | | //包装取料卸货完成,设备生产数量加一 |
| | |
| | | if (trayCode.errCode == 0 && trayCode.result.Length == 80) |
| | | { |
| | | //获取托盘码等信息 读取通道 10、11、12的数据作为托盘码 读取其它通道 重量 叠包等信息 所有数据存入MachineInfo表 |
| | | GetMachineData(pmInfo, trayCode.result); |
| | | string location = ""; |
| | | GetMachineData(pmInfo,ref location, trayCode.result); |
| | | var tray = MongoDBSingleton.Instance.FindOne<MachineInfo>(Query.EQ("machineNo", pmInfo.location), "MachineInfo"); |
| | | if (tray != null && tray.addState == 0) |
| | | { |
| | |
| | | if (trayCode.errCode == 0 && trayCode.result.Length == 95) |
| | | { |
| | | //获取托盘码等信息 读取通道 11、12、13的数据作为托盘码 读取其它通道 重量 叠包等信息 所有数据存入MachineInfo表 |
| | | GetMachineData(pmInfo, trayCode.result, false, "2"); |
| | | string flLoc = ""; |
| | | string location = ""; |
| | | GetMachineData(pmInfo,ref location, trayCode.result, false, "2"); |
| | | if (pmInfo.location.Contains("FLZT")) |
| | | { |
| | | flLoc = pmInfo.location; |
| | | pmInfo.location = location; |
| | | } |
| | | var tray = MongoDBSingleton.Instance.FindOne<MachineInfo>(Query.EQ("machineNo", pmInfo.location), "MachineInfo"); |
| | | if (tray != null) |
| | | { |
| | |
| | | { |
| | | CMMLog.Info($"物料编码:{tray.materialCode},批次号:{tray.lotNo}"); |
| | | string timeStamp = ProcessHelper.GetTimeStamp(31, 1, 1); |
| | | pmInfo.location = !string.IsNullOrEmpty(flLoc) ? flLoc : pmInfo.location; |
| | | HHAmsExecuteResult req; |
| | | if (pmInfo.deviceType == "22") |
| | | { |
| | |
| | | internal static void PickUpFullDoorComplete(string ip, string taskNo) |
| | | { |
| | | var plc = Settings.GetPlcInfo().Where(a => a.ip == ip).FirstOrDefault(); |
| | | if (plc != null) |
| | | if (plc != null && !plc.location.Contains("FLZT")) |
| | | { |
| | | //写入包装机--安全门关门指令 |
| | | var writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | |
| | | /// <param name="info"></param> |
| | | /// <param name="result"></param> |
| | | /// <param name="noPack">true : MES交互方式 false : 无MES交互方式</param> |
| | | private static void GetMachineData(Settings.PlcInfo pmInfo,int[] result ,bool noPack = true,string isOne = "") |
| | | private static void GetMachineData(Settings.PlcInfo pmInfo, ref string loc, int[] result ,bool noPack = true,string isOne = "") |
| | | { |
| | | //Console.WriteLine($"进入数据处理流程!"); |
| | | CMMLog.Info($"进入数据处理流程!"); |
| | |
| | | string empCode = RemoveNull(GetTrayCode(result.Take(5).ToArray()));//员工编码 |
| | | string trayCode = RemoveNull(GetTrayCode(result.Skip(5).Take(3).ToArray()));//托盘码 |
| | | string location = RemoveNull(GetTrayCode(result.Skip(8).Take(1).ToArray()));//设备货位编码 |
| | | loc = location; |
| | | #region 2024-12-30 变更 加入mes生产订单编号 分录ID 变更注释 |
| | | string orderCode = ""; //生产订单编号 |
| | | int fEntryID = 0; //分录ID |
| | |
| | | CMMLog.Info($"在通道{plc.writeAddr + 2}中写入{JsonConvert.SerializeObject(num)},ip:{plc.ip},端口:{plc.port}"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 四钴A(洗板烘干机组)设备上空下满 |
| | | /// </summary> |
| | | /// <param name="plc"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | internal static void AMachine(Settings.PlcInfo plc) |
| | | { |
| | | if (PickUpStartFree(plc.location) && PickUpEndFree(plc.location)) |
| | | { |
| | | try |
| | | { |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | dataNum = 1, |
| | | addr = plc.readAddr, |
| | | host = plc.ip, |
| | | port = plc.port |
| | | }); |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | if (result.result[0] == 1) |
| | | { |
| | | //送空 |
| | | bool req = WMSHelper.WMSOut(plc.location, "", ""); |
| | | if (req) CMMLog.Debug($"四钴A设备 调用WMS获取空托出库生成任务成功!");//现在任务由WMS自己下发,AMS做拦截处理(查询ext1里面对应的任务类型,并更改任务类型) |
| | | else CMMLog.Debug($"四钴A设备 调用WMS获取空托出库生成任务失败!"); |
| | | } |
| | | if (result.result[0] == 2) |
| | | { |
| | | //取满 |
| | | string wmstaskno = ""; |
| | | string traycode = ""; |
| | | bool req = WMSHelper.WMSIn(plc.location, "", ref wmstaskno, ref traycode); |
| | | if (req) CMMLog.Debug($"四钴A设备 调用WMS获取满托入库生成任务成功!");//现在任务由WMS自己下发,AMS做拦截处理(查询ext1里面对应的任务类型,并更改任务类型) |
| | | else CMMLog.Debug($"四钴A设备 调用WMS获取满托入库生成任务失败!"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | CMMLog.Info($"四钴A设备 err:{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 四钴C(钴板剪切机组)设备上满下空 |
| | | /// </summary> |
| | | /// <param name="a"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | internal static void CMachine(Settings.PlcInfo plc) |
| | | { |
| | | if (PickUpStartFree(plc.location) && PickUpEndFree(plc.location)) |
| | | { |
| | | try |
| | | { |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | dataNum = 1, |
| | | addr = plc.readAddr, |
| | | host = plc.ip, |
| | | port = plc.port |
| | | }); |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | if (result.result[0] == 1) |
| | | { |
| | | //送满 |
| | | bool req = WMSHelper.WMSOut(plc.location, "", ""); |
| | | if (req) CMMLog.Debug($"四钴C设备 调用WMS获取满托出库生成任务成功!");//现在任务由WMS自己下发,AMS做拦截处理(查询ext1里面对应的任务类型,并更改任务类型) |
| | | else CMMLog.Debug($"四钴C设备 调用WMS获取满托出库生成任务失败!"); |
| | | } |
| | | if (result.result[0] == 2) |
| | | { |
| | | //取空 |
| | | string wmstaskno = ""; |
| | | string traycode = ""; |
| | | bool req = WMSHelper.WMSIn(plc.location, "", ref wmstaskno, ref traycode); |
| | | if (req) CMMLog.Debug($"四钴C设备 调用WMS获取空托入库生成任务成功!");//现在任务由WMS自己下发,AMS做拦截处理(查询ext1里面对应的任务类型,并更改任务类型) |
| | | else CMMLog.Debug($"四钴C设备 调用WMS获取空托入库生成任务失败!"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | CMMLog.Info($"四钴C设备 err:{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public class WMS_STOCK_VIEW |