| | |
| | | public ErrInfoResult getErrInfo(string factory) |
| | | { |
| | | ErrInfoResult result = new ErrInfoResult(); |
| | | |
| | | CMMLog.Info("getErrInfo:" + factory); |
| | | result = ApiHelper.getErrInfo(factory); |
| | | return result; |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// pda打包下线 |
| | | /// pda包装下线 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Threading; |
| | | using System.Timers; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.MESHelper; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.PLCControl; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.ProcessHelper; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.ProtocolAnalysis; |
| | | using static System.Runtime.CompilerServices.RuntimeHelpers; |
| | | |
| | | namespace Hanhe.iWCS.JingmenGEMTwoProtocol |
| | | { |
| | |
| | | |
| | | public class bzxxModel |
| | | { |
| | | public string machineNo { get; set; } |
| | | public string mesCode { get; set; } |
| | | } |
| | | |
| | |
| | | internal static ErrInfoResult getErrInfo(string factory) |
| | | { |
| | | ErrInfoResult result = new ErrInfoResult() { sucess = false }; |
| | | |
| | | if(factory == "sanyuan") |
| | | try |
| | | { |
| | | var errList = MongoDBSingleton.Instance.FindAll<errInfoTable>("ErrInfoResult"); |
| | | if (factory.Contains("sanyuan")) |
| | | { |
| | | var errList = MongoDBSingleton.Instance.FindAll<errInfoTable>("errInfoTable"); |
| | | if (errList.Count > 0) |
| | | { |
| | | result.sucess = true; |
| | | result.errInfo = new List<errInfo>(); |
| | | errList.ForEach(r => |
| | | { |
| | | result.errInfo.Add(new errInfo { taskName = r.taskName, errMsg = r.errMsg, time = r.dateTime }); |
| | |
| | | { |
| | | |
| | | } |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | CMMLog.Info("getErrInfo err:"+ex.Message); |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |
| | |
| | | { |
| | | ZZTPWNumResult result = new ZZTPWNumResult() { sucess = false }; |
| | | |
| | | if(factory == "sanyuan") |
| | | if(factory.Contains("sanyuan")) |
| | | { |
| | | var bzEmpInfo = MongoDBSingleton.Instance.FindAll<BZEmptyPoint>("BZEmptyPoint"); |
| | | if (bzEmpInfo.Count > 0) |
| | | { |
| | | result.sucess = true; |
| | | result.zztpwInfo = new List<zztpwInfo>(); |
| | | bzEmpInfo.ForEach(r => |
| | | { |
| | | result.zztpwInfo.Add(new zztpwInfo { S_LOC_CODE = r.Bit, N_QTY = r.Quantity }); |
| | |
| | | |
| | | internal static BZXXResult Bzxx(bzxxModel models) |
| | | { |
| | | BZXXResult result = new BZXXResult() {sucess = false }; |
| | | BZXXResult result = new BZXXResult() {success = false }; |
| | | if(models != null && !string.IsNullOrEmpty(models.mesCode)) |
| | | { |
| | | //通过mesCode获取mes的物料信息 |
| | | var res = helper.WebGet(Settings.MESUrl2 + "?mesCode=" + models.mesCode); |
| | | CMMLog.Info($"Bzxx ReqMsg:{JsonConvert.SerializeObject(res)},url:{Settings.MESUrl2}"); |
| | | try |
| | | { |
| | | if (!string.IsNullOrEmpty(res)) |
| | | { |
| | | var req = JsonConvert.DeserializeObject<mesInfo>(res); |
| | | if(req != null) |
| | | { |
| | | var timeCuo = MongoDBSingleton.Instance.FindOne<TimeCuoInfoCom>(Query.EQ("packingMachineNumber", models.machineNo), "TimeCuoInfoCom"); |
| | | if (timeCuo == null) |
| | | { |
| | | MongoDBSingleton.Instance.Insert<TimeCuoInfoCom>(new TimeCuoInfoCom |
| | | { |
| | | isFold = 1, |
| | | packingMachineNumber = models.machineNo, |
| | | needWeight = (int)req.data.FMustQty, |
| | | realWeight = (int)req.data.FMustQty, |
| | | totalWeight = (int)req.data.FMustQty, |
| | | batchNumber = req.data.Flot, |
| | | productModel = req.data.materialSpec, |
| | | bagNumber_1 = req.data.bagNum, |
| | | totalCount = 1, |
| | | timeStamp = req.data.mesCode, |
| | | photoURL = req.data.barCode, |
| | | ProductionDate = req.data.ywDate, |
| | | // ERP变更-照相机新增字段 |
| | | materialCode = req.data.FMaterialNumber, |
| | | materialName = req.data.materialName, |
| | | measurementUnit = req.data.FUnit, |
| | | createOrganization = req.data.FPrdOrgNumber, |
| | | WarehouseCode = req.data.FStockNumber, |
| | | workshopCode = req.data.FWorkShopNumber, |
| | | BusinessDate = req.data.ywDate, |
| | | barcode = req.data.barCode, |
| | | |
| | | employeeID1 = req.data.jycjj, |
| | | |
| | | //变更注释 |
| | | totalNeedWeight = (int)req.data.FMustQty, |
| | | FEntryID_1 = 0, |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | var query = Query.EQ("packingMachineNumber", models.machineNo); |
| | | //变更注释 |
| | | UpdateBuilder update = Update.Set("isFold", 1).Set("packingMachineNumber",models.machineNo).Set("needWeight", (int)req.data.FMustQty) |
| | | .Set("realWeight", (int)req.data.FMustQty).Set("totalWeight", (int)req.data.FMustQty).Set("batchNumber", req.data.Flot) |
| | | .Set("productModel", req.data.materialSpec).Set("bagNumber_1", req.data.bagNum).Set("totalCount", 1).Set("timeStamp", req.data.mesCode) |
| | | .Set("photoURL", req.data.barCode).Set("ProductionDate", req.data.ywDate).Set("materialCode", req.data.FMaterialNumber) |
| | | .Set("materialName", req.data.materialName).Set("measurementUnit", req.data.FUnit) |
| | | .Set("createOrganization", req.data.FPrdOrgNumber).Set("WarehouseCode", req.data.FStockNumber).Set("workshopCode", req.data.FWorkShopNumber) |
| | | .Set("BusinessDate", req.data.ywDate).Set("barcode", req.data.barCode).Set("employeeID1", req.data.jycjj) |
| | | .Set("totalNeedWeight", (int)req.data.FMustQty).Set("FEntryID_1", 0); |
| | | MongoDBSingleton.Instance.Update<TimeCuoInfoCom>(query, update, UpdateFlags.None); |
| | | } |
| | | |
| | | //生成到接驳平台的任务 |
| | | string traycode = DateTime.Now.ToString("yyyy-MM-dd").Replace("-", ""); |
| | | string timeCuo2 = req.data.mesCode.ToString(); |
| | | var CBInfo = Settings.GetConnectingbitsList().Where(a => a.enable == 1).ToList(); |
| | | if (CBInfo != null) |
| | | { |
| | | AMSHelper.HHAmsExecuteResult amsResult = null; |
| | | foreach (var a in CBInfo) |
| | | { |
| | | if (!string.IsNullOrEmpty(a.locCode)) |
| | | { |
| | | //在中间表中查找点位 |
| | | var CBTable = MongoDBSingleton.Instance.FindOne<ConnectingBits>(Query.EQ("Bit", a.locCode), "ConnectingBits"); |
| | | if (CBTable != null) |
| | | { |
| | | if (string.IsNullOrEmpty(CBTable.trayCode)) |
| | | { |
| | | //生成任务,并且将点位写入中间表 |
| | | amsResult = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), models.machineNo, a.locCode, "PDA打包下线", 0, traycode); |
| | | if (amsResult.success) |
| | | { |
| | | result.success = true; |
| | | CMMLog.Debug($"PDA打包下线:AMS调用API成功!"); |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", a.locCode), Update.Set("trayCode", traycode).Set("timeCuo", timeCuo2), UpdateFlags.None); |
| | | |
| | | //上报条码表 |
| | | CMMLog.Info($" INSERT INTO T_JY_BARCODESync (FBarCode, FBarCodeRule,FMaterialNumber,FCreateOrgNumber,FLot,FUnit,FQty,FStockNumber,FDept,FBillDate,F_JY_CZZ,FOpStatus) VALUES ('{req.data.barCode}','01','{req.data.materialName}','02','{req.data.Flot}','{req.data.FUnit}','{req.data.FMustQty}','CK020','BM000161','{req.data.ywDate}','{req.data.jycjj}','0')"); |
| | | new SqlHelper<object>().ExecuteSql($" INSERT INTO T_JY_BARCODESync (FBarCode, FBarCodeRule,FMaterialNumber,FCreateOrgNumber,FLot,FUnit,FQty,FStockNumber,FDept,FBillDate,F_JY_CZZ,FOpStatus) VALUES ('{req.data.barCode}','01','{req.data.materialName}','02','{req.data.Flot}','{req.data.FUnit}','{req.data.FMustQty}','CK020','BM000161','{req.data.ywDate}','{req.data.jycjj}','0')", false); |
| | | |
| | | break; |
| | | } |
| | | else CMMLog.Debug($"PDA打包下线:AMS调用API失败,开始重新调用!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //生成任务,并且将点位写入中间表 |
| | | amsResult = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), models.machineNo, a.locCode, "PDA打包下线", 0, traycode); |
| | | if (amsResult.success) |
| | | { |
| | | result.success = true; |
| | | CMMLog.Debug($"PDA打包下线:AMS调用API成功!"); |
| | | //打包下线任务生成成功,向中间表插入数据 |
| | | |
| | | MongoDBSingleton.Instance.Insert<ConnectingBits>(new ConnectingBits { Bit = a.locCode, trayCode = traycode, state = "0", timeCuo = timeCuo2 }); |
| | | |
| | | //上报条码表 |
| | | CMMLog.Info($" INSERT INTO T_JY_BARCODESync (FBarCode, FBarCodeRule,FMaterialNumber,FCreateOrgNumber,FLot,FUnit,FQty,FStockNumber,FDept,FBillDate,F_JY_CZZ,FOpStatus) VALUES ('{req.data.barCode}','01','{req.data.materialName}','02','{req.data.Flot}','{req.data.FUnit}','{req.data.FMustQty}','CK020','BM000161','{req.data.ywDate}','{req.data.jycjj}','0')"); |
| | | new SqlHelper<object>().ExecuteSql($" INSERT INTO T_JY_BARCODESync (FBarCode, FBarCodeRule,FMaterialNumber,FCreateOrgNumber,FLot,FUnit,FQty,FStockNumber,FDept,FBillDate,F_JY_CZZ,FOpStatus) VALUES ('{req.data.barCode}','01','{req.data.materialName}','02','{req.data.Flot}','{req.data.FUnit}','{req.data.FMustQty}','CK020','BM000161','{req.data.ywDate}','{req.data.jycjj}','0')", false); |
| | | |
| | | break; |
| | | } |
| | | else CMMLog.Debug($"PDA打包下线:AMS调用API失败,开始重新调用!"); |
| | | } |
| | | } |
| | | else CMMLog.Debug("打包下线口接驳位点位未配置"); |
| | | } |
| | | if(amsResult == null || amsResult.success == false) |
| | | { |
| | | result.errMsg = "任务生成失败,接驳位有任务占用"; |
| | | } |
| | | } |
| | | else CMMLog.Debug("打包下线口接驳位未配置"); |
| | | } |
| | | else |
| | | { |
| | | result.errMsg = $"数据解析失败"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.errMsg = $"查询mes信息失败,mesCode:{models.mesCode}"; |
| | | } |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | result.errMsg = ex.Message; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.errMsg = "参数输入错误"; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public class mesInfo |
| | | { |
| | | public int code { get; set; } |
| | | public string msg { get; set; } |
| | | public mesData data { get; set; } |
| | | public bool isSucess { get; set; } |
| | | } |
| | | |
| | | public class mesData |
| | | { |
| | | /// <summary> |
| | | /// 入库组织 |
| | | /// </summary> |
| | | public string FStockOrgNumber { get; set;} |
| | | /// <summary> |
| | | /// 生产组织 |
| | | /// </summary> |
| | | public string FPrdOrgNumber { get; set; } |
| | | /// <summary> |
| | | /// 入库类型 |
| | | /// </summary> |
| | | public string FInStockType { get; set; } |
| | | /// <summary> |
| | | /// 仓库编码 |
| | | /// </summary> |
| | | public string FStockNumber { get; set; } |
| | | /// <summary> |
| | | /// 生产车间 |
| | | /// </summary> |
| | | public string FWorkShopNumber { get; set; } |
| | | /// <summary> |
| | | /// 库存状态 |
| | | /// </summary> |
| | | public string FStockStatus { get; set; } |
| | | /// <summary> |
| | | /// 单位 |
| | | /// </summary> |
| | | public string FUnit { get; set; } |
| | | /// <summary> |
| | | /// 物料编码 |
| | | /// </summary> |
| | | public string FMaterialNumber { get; set; } |
| | | /// <summary> |
| | | /// 物料名称 |
| | | /// </summary> |
| | | public string materialName { get; set; } |
| | | /// <summary> |
| | | /// 物料规格 |
| | | /// </summary> |
| | | public string materialSpec { get; set; } |
| | | /// <summary> |
| | | /// 批号 |
| | | /// </summary> |
| | | public string Flot { get; set; } |
| | | /// <summary> |
| | | /// 需求重量 |
| | | /// </summary> |
| | | public double FMustQty { get; set; } |
| | | /// <summary> |
| | | /// 退库时间 |
| | | /// </summary> |
| | | public string FProduceDate { get; set; } |
| | | /// <summary> |
| | | /// 唯一标识 |
| | | /// </summary> |
| | | public string FExpiryDate { get; set; } |
| | | /// <summary> |
| | | /// 唯一码 |
| | | /// </summary> |
| | | public int mesCode { get; set; } |
| | | /// <summary> |
| | | /// 完整条码 |
| | | /// </summary> |
| | | public string barCode { get; set; } |
| | | /// <summary> |
| | | /// 袋号 |
| | | /// </summary> |
| | | public string bagNum { get; set; } |
| | | /// <summary> |
| | | /// mes包号 |
| | | /// </summary> |
| | | public string bagCode { get; set; } |
| | | /// <summary> |
| | | /// 员工编码 |
| | | /// </summary> |
| | | public string jycjj { get; set; } |
| | | /// <summary> |
| | | /// 业务日期 |
| | | /// </summary> |
| | | public string ywDate { get; set; } |
| | | } |
| | | |
| | | public class AGV_STATE |
| | |
| | | |
| | | public class BZXXResult |
| | | { |
| | | public bool sucess { get; set;} |
| | | public bool success { get; set;} |
| | | public string errMsg { get; set; } |
| | | } |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 10019-D口 |
| | | if (currActionModel.CN_N_ACTION_CODE == 10019) |
| | | { |
| | | var list = Settings.GetPlcInfo().Where(a => a.enable == 1 && a.deviceType == "43").ToList(); |
| | | if (list.Count > 0) |
| | | { |
| | | list.ForEach(a => |
| | | { |
| | | PLCControl.DMachine(a); |
| | | }); |
| | | } |
| | | Thread.Sleep(3000); |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | return bResult; |
| | | } |
| | |
| | | using System.Globalization; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.PLCControl; |
| | | using Hanhe.iWCS.DeviceDriver; |
| | | using System.Data.OleDb; |
| | | |
| | | namespace Hanhe.iWCS.JingmenGEMTwoProtocol |
| | | { |
| | |
| | | var plc = Settings.GetPlcInfo().Where(a => a.ip == ip).FirstOrDefault(); |
| | | if (plc != null && !plc.location.Contains("FLZT")) |
| | | { |
| | | if (plc.location.Contains("FLZT")) |
| | | { |
| | | //写入返料站台--取货完成 |
| | | var writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | | host = ip, |
| | | addr = plc.writeAddr, |
| | | data = 1, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr}里面数据为1."); |
| | | } |
| | | else |
| | | { |
| | | //写入包装机--安全门关门指令 |
| | | var writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr + 1}里面数据为4."); |
| | | //Console.WriteLine($"写入设备{plc.location}通道{plc.writeAddr + 1}里面数据为4."); |
| | | } |
| | | |
| | | } |
| | | else CMMLog.Debug($"包装下线,4,ip=null!"); |
| | | } |
| | |
| | | //可生成任务 |
| | | var CBInfo = Settings.GetConnectingbitsList().Where(a => a.enable == 1).ToList(); |
| | | if (CBInfo != null && timecuo != null) |
| | | //if (CBInfo != null) |
| | | { |
| | | string timeStamp = timecuo.data.First().timeStamp.ToString(); |
| | | foreach (var a in CBInfo) |
| | |
| | | } |
| | | } |
| | | |
| | | internal static void DGMachine(Settings.PlcInfo plc, string taskNo, bool action) |
| | | { |
| | | if (action) |
| | | { |
| | | var writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | | host = plc.ip, |
| | | addr = plc.writeAddr + 2, |
| | | data = 1, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr + 2}里面数据为1."); |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | dataNum = 1, |
| | | addr = plc.readAddr + 2, |
| | | host = plc.ip, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"查询设备{plc.location}通道{plc.readAddr + 2}里面数据为{JsonConvert.SerializeObject(result)}."); |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | if (result.result[0] == 1) |
| | | { |
| | | //推送小车进入 |
| | | TSHelper.GoToAGV(taskNo, 10, 3); |
| | | writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | | host = plc.ip, |
| | | addr = plc.writeAddr + 2, |
| | | data = 0, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr + 2}里面数据为0."); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | | host = plc.ip, |
| | | addr = plc.writeAddr + 3, |
| | | data = 1, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr + 3}里面数据为1."); |
| | | } |
| | | } |
| | | |
| | | internal static void DGMachineTwo(Settings.PlcInfo plc, string taskNo, bool action) |
| | | { |
| | | if (action) |
| | | { |
| | | var writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | | host = plc.ip, |
| | | addr = plc.writeAddr, |
| | | data = 1, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr}里面数据为1."); |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | dataNum = 1, |
| | | addr = plc.readAddr + 1, |
| | | host = plc.ip, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"查询设备{plc.location}通道{plc.readAddr + 1}里面数据为{JsonConvert.SerializeObject(result)}."); |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | if (result.result[0] == 1) |
| | | { |
| | | //推送小车进入 |
| | | TSHelper.GoToAGV(taskNo, 10, 3); |
| | | writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | | host = plc.ip, |
| | | addr = plc.writeAddr, |
| | | data = 0, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr}里面数据为0."); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var writeRes = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | { |
| | | host = plc.ip, |
| | | addr = plc.writeAddr + 1, |
| | | data = 1, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"写入设备{plc.location}通道{plc.writeAddr + 1}里面数据为1."); |
| | | } |
| | | } |
| | | |
| | | internal static void DMachine(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) |
| | | { |
| | | //成品下线任务生成到接驳平台 |
| | | string traycode = DateTime.Now.ToString("yyyy-MM-dd").Replace("-", ""); |
| | | //可生成任务 |
| | | var CBInfo = Settings.GetConnectingbitsList().Where(a => a.enable == 1).ToList(); |
| | | if (CBInfo != null) |
| | | { |
| | | //string timeStamp = timecuo.data.First().timeStamp.ToString(); |
| | | string timeStamp = ""; |
| | | foreach (var a in CBInfo) |
| | | { |
| | | if (!string.IsNullOrEmpty(a.locCode)) |
| | | { |
| | | //在中间表中查找点位 |
| | | var CBTable = MongoDBSingleton.Instance.FindOne<ConnectingBits>(Query.EQ("Bit", a.locCode), "ConnectingBits"); |
| | | if (CBTable != null) |
| | | { |
| | | if (string.IsNullOrEmpty(CBTable.trayCode)) |
| | | { |
| | | //生成任务,并且将点位写入中间表 |
| | | var amsResult = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), plc.location, a.locCode, "包装机满托下线", 0, traycode); |
| | | if (amsResult.success) |
| | | { |
| | | CMMLog.Debug($"包装机满托下线:AMS调用API成功!"); |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", a.locCode), Update.Set("trayCode", traycode).Set("timeCuo", timeStamp), UpdateFlags.None); |
| | | |
| | | break; |
| | | } |
| | | else CMMLog.Debug($"包装机满托下线:AMS调用API失败,开始重新调用!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //生成任务,并且将点位写入中间表 |
| | | var amsResult = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), plc.location, a.locCode, "包装机满托下线", 0, traycode); |
| | | if (amsResult.success) |
| | | { |
| | | CMMLog.Debug($"包装机满托下线:AMS调用API成功!"); |
| | | //打包下线任务生成成功,向中间表插入数据 |
| | | |
| | | MongoDBSingleton.Instance.Insert<ConnectingBits>(new ConnectingBits { Bit = a.locCode, trayCode = traycode, state = "0", timeCuo = timeStamp }); |
| | | break; |
| | | } |
| | | else CMMLog.Debug($"包装机满托下线:AMS调用API失败,开始重新调用!"); |
| | | } |
| | | } |
| | | else CMMLog.Debug("打包下线口接驳位点位未配置"); |
| | | } |
| | | } |
| | | else CMMLog.Debug("打包下线口接驳位未配置"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | CMMLog.Info($"四钴C设备 err:{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public class WMS_STOCK_VIEW |
| | |
| | | if (mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托") PLCControl.CacheStackingMouth1013(plc.deviceType, mst.CN_S_TASK_NO, mst.CN_S_END_BIT); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼拆盘补空") PLCControl.DiscRemoverReqUnload(plc.deviceType, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "包装线补空") PLCControl.PackingLine(plc.ip, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线") PLCControl.outWare(mst.CN_S_TASK_NO, true); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "PDA打包下线") PLCControl.outWare(mst.CN_S_TASK_NO, true); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼成品出库") PLCControl.productOutWare(mst.CN_S_END_BIT, mst.CN_S_TASK_NO, true); |
| | | if (mst.CN_S_BUSS_TYPE == "烘干机空托上线" || mst.CN_S_BUSS_TYPE == "剪切机满托上线") PLCControl.DGMachineTwo(plc, mst.CN_S_TASK_NO, true); |
| | | } |
| | | if (code == 6) |
| | | { |
| | |
| | | |
| | | if (mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托") PLCControl.writeStackingMouth6(mst.CN_S_END_BIT, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼拆盘补空") PLCControl.DiscRemoverUnloadComplete(plc.deviceType, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线") PLCControl.outWare(mst.CN_S_TASK_NO, false); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "PDA打包下线") PLCControl.outWare(mst.CN_S_TASK_NO, false); |
| | | if (mst.CN_S_BUSS_TYPE == "包装线补空") PLCControl.PackingLineComplete(plc.ip); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼成品出库") PLCControl.productOutWare(mst.CN_S_END_BIT, mst.CN_S_TASK_NO, false); |
| | | if (mst.CN_S_BUSS_TYPE == "烘干机空托上线" || mst.CN_S_BUSS_TYPE == "剪切机满托上线") PLCControl.DGMachineTwo(plc, mst.CN_S_TASK_NO, true); |
| | | } |
| | | } |
| | | else CMMLog.Info($"PlcInfo中未找到该点位,点位:{mst.CN_S_END_BIT}"); |
| | |
| | | if (code == 1012) |
| | | { |
| | | //卸货申请,先判断设备是否允许进料,如果是直接改参数,并通知设备 |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料") PLCControl.PickUpFullDoorUnload(plc.ip, mst.CN_S_TASK_NO);//进入3楼包装取料流程1012,ip:{plc.ip},task:{mst.CN_S_TASK_NO} |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料" || mst.CN_S_BUSS_TYPE == "PDA打包下线") PLCControl.PickUpFullDoorUnload(plc.ip, mst.CN_S_TASK_NO);//进入3楼包装取料流程1012,ip:{plc.ip},task:{mst.CN_S_TASK_NO} |
| | | if (mst.CN_S_BUSS_TYPE == "3楼复称入缓存架" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架NG") PLCControl.SecondWeightInCache1012(plc.ip, mst.CN_S_TASK_NO);//二期:直接改参数 |
| | | if (mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托") TSHelper.GoToAGV(mst.CN_S_TASK_NO, 10, 1); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼叠盘下线") PLCControl.StackingReqUnload(plc.deviceType, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线") PLCControl.PackingLineUnload1012(plc.ip, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "烘干机满托下线" || mst.CN_S_BUSS_TYPE == "剪切机空托下线" || mst.CN_S_BUSS_TYPE == "包装机满托下线") PLCControl.DGMachine(plc,mst.CN_S_TASK_NO,true); |
| | | } |
| | | if (code == 4) |
| | | { |
| | | //卸货完成申请,判断设备那边进料完成,改参数通知agv离开 |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料") PLCControl.PickUpFullDoorComplete(plc.ip, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料" || mst.CN_S_BUSS_TYPE == "PDA打包下线") PLCControl.PickUpFullDoorComplete(plc.ip, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼复称入缓存架" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架NG") PLCControl.SecondWeightInCache4(plc.deviceType, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼叠盘下线") PLCControl.StackingComplete(plc.deviceType, mst.CN_S_TASK_NO); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线") PLCControl.PackingLineComplete4(plc.ip, mst.CN_S_SOURCE_NO); |
| | | if (mst.CN_S_BUSS_TYPE != "3楼包装取料") WMSHelper.ExecuteState(mst.CN_S_SOURCE_NO, 4); |
| | | if (mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托NG") PLCControl.CacheStackingMouth6(plc); |
| | | if (mst.CN_S_BUSS_TYPE == "辅材入库") PLCControl.fcrk(plc); |
| | | if (mst.CN_S_BUSS_TYPE == "烘干机满托下线" || mst.CN_S_BUSS_TYPE == "剪切机空托下线" || mst.CN_S_BUSS_TYPE == "包装机满托下线") PLCControl.DGMachine(plc, mst.CN_S_TASK_NO, false); |
| | | |
| | | } |
| | | } |
| | | else CMMLog.Info($"点位{mst.CN_S_START_BIT}未配置"); |
| | |
| | | |
| | | |
| | | } |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线") |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "PDA打包下线") |
| | | { |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", mst.CN_S_END_BIT), Update.Set("state", "1"), UpdateFlags.None); |
| | | |
| | |
| | | { |
| | | CMMLog.Info($"起点安全对接:收到任务号:{mst.CN_S_TASK_NO},任务类型:{mst.CN_S_BUSS_TYPE},任务信号:{action.CN_N_ACTION_CODE}"); |
| | | //3楼拆盘补空:拆盘机补空托盘 3楼包装补空:包装机补空托 |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架NG" || mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托" || mst.CN_S_BUSS_TYPE == "3楼叠盘下线" || mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托NG" || mst.CN_S_BUSS_TYPE == "辅材入库") |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架NG" || mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托" || mst.CN_S_BUSS_TYPE == "3楼叠盘下线" || mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托NG" || mst.CN_S_BUSS_TYPE == "辅材入库" || mst.CN_S_BUSS_TYPE == "PDA打包下线" || mst.CN_S_BUSS_TYPE == "烘干机满托下线" || mst.CN_S_BUSS_TYPE == "剪切机空托下线" || mst.CN_S_BUSS_TYPE == "包装机满托下线") |
| | | { |
| | | CMMLog.Info($"起点安全对接:即将进入任务流程:{mst.CN_S_BUSS_TYPE},状态号为:{action.CN_N_ACTION_CODE}"); |
| | | ProcessHelper.StartPickUpDoorSafe(mst, action.CN_N_ACTION_CODE); |
| | |
| | | { |
| | | CMMLog.Info($"终点安全对接:收到任务号:{mst.CN_S_TASK_NO},任务类型:{mst.CN_S_BUSS_TYPE},任务信号:{action.CN_N_ACTION_CODE}"); |
| | | //3楼拆盘补空:拆盘机补空托盘 3楼包装补空:包装机补空托 |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料" ||mst.CN_S_BUSS_TYPE == "地面货位取料" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架" || mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托" || mst.CN_S_BUSS_TYPE == "3楼拆盘补空" || mst.CN_S_BUSS_TYPE == "包装线补空" || mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "3楼成品出库") |
| | | if (mst.CN_S_BUSS_TYPE == "3楼包装取料" ||mst.CN_S_BUSS_TYPE == "地面货位取料" || mst.CN_S_BUSS_TYPE == "3楼复称入缓存架" || mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托" || mst.CN_S_BUSS_TYPE == "3楼拆盘补空" || mst.CN_S_BUSS_TYPE == "包装线补空" || mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "3楼成品出库" || mst.CN_S_BUSS_TYPE == "PDA打包下线" || mst.CN_S_BUSS_TYPE == "剪切机满托上线" || mst.CN_S_BUSS_TYPE == "烘干机空托上线") |
| | | { |
| | | ProcessHelper.EndPickUpDoorSafe(mst, action.CN_N_ACTION_CODE); |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region MESUrl2 |
| | | private static string _MESUrl2 = ""; |
| | | public static string MESUrl2 |
| | | { |
| | | get |
| | | { |
| | | if (_MESUrl2 == "") |
| | | { |
| | | _MESUrl2 = XmlHelper.GetElementValue("mesurl2"); |
| | | } |
| | | return _MESUrl2; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region BGIP |
| | | private static string _BGIP = ""; |
| | | public static string BGip |
| | |
| | | |
| | | <!--MES接口地址--> |
| | | <mesurl>http://10.1.141.236:2222/api/WmsApi/GlmTonBagFillInfo</mesurl> |
| | | <!--MES接口地址--> |
| | | <mesurl2>http://10.1.141.236:2222/api/WmsApi/GlmTonBagFillInfo</mesurl2> |
| | | <!--是否启用Mes接口获取数据 0 默认开启 1 不通过MES获取数据--> |
| | | <mesOpen>0</mesOpen> |
| | | <!--221118打包机下线流程变更 0 使用原有流程 1 使用变更流程--> |
| | |
| | | {"task":"18","taskType":"辅材入库","location":"3F_NG_DB"}, |
| | | {"task":"18","taskType":"辅材出库","location":"3F_NG_DB"}, |
| | | {"task":"18","taskType":"辅材回库","location":"3F_NG_DB"}, |
| | | {"task":"19","taskType":"3楼成品出库","location":"CK001_XN01"} |
| | | {"task":"19","taskType":"3楼成品出库","location":"CK001_XN01"}, |
| | | {"task":"19","taskType":"烘干机空托上线","location":"CK001_XN01"}, |
| | | {"task":"19","taskType":"烘干机满托下线","location":"CK001_XN01"}, |
| | | {"task":"19","taskType":"剪切机满托上线","location":"CK001_XN01"}, |
| | | {"task":"19","taskType":"剪切机空托下线","location":"CK001_XN01"}, |
| | | |
| | | ]]]> |
| | | </huoWeiCode> |