| | |
| | | { |
| | | "Version": 1, |
| | | "WorkspaceRootPath": "C:\\software\\A-\u5DE5\u4F5C\\\u6E90\u7801\\GIT\\\u8346\u95E8\u683C\u6797\u7F8E\u5357\u533A\\ams\\Hanhe.iWCS.JingmenGEMTwoProtocol\\", |
| | | "Documents": [ |
| | | { |
| | | "AbsoluteMoniker": "D:0:0:{BCE5B4FC-C2CD-459E-AAD0-34D4900B4528}|Hanhe.iWCS.JingmenGEMTwoProtocol.csproj|c:\\software\\a-\u5DE5\u4F5C\\\u6E90\u7801\\git\\\u8346\u95E8\u683C\u6797\u7F8E\u5357\u533A\\ams\\hanhe.iwcs.jingmengemtwoprotocol\\enentlisten.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", |
| | | "RelativeMoniker": "D:0:0:{BCE5B4FC-C2CD-459E-AAD0-34D4900B4528}|Hanhe.iWCS.JingmenGEMTwoProtocol.csproj|solutionrelative:enentlisten.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" |
| | | } |
| | | ], |
| | | "Documents": [], |
| | | "DocumentGroupContainers": [ |
| | | { |
| | | "Orientation": 0, |
| | |
| | | "DocumentGroups": [ |
| | | { |
| | | "DockedWidth": 16, |
| | | "SelectedChildIndex": 7, |
| | | "SelectedChildIndex": -1, |
| | | "Children": [ |
| | | { |
| | | "$type": "Bookmark", |
| | |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" |
| | | }, |
| | | { |
| | | "$type": "Document", |
| | | "DocumentIndex": 0, |
| | | "Title": "EnentListen.cs", |
| | | "DocumentMoniker": "C:\\software\\A-\u5DE5\u4F5C\\\u6E90\u7801\\GIT\\\u8346\u95E8\u683C\u6797\u7F8E\u5357\u533A\\ams\\Hanhe.iWCS.JingmenGEMTwoProtocol\\EnentListen.cs", |
| | | "RelativeDocumentMoniker": "EnentListen.cs", |
| | | "ToolTip": "C:\\software\\A-\u5DE5\u4F5C\\\u6E90\u7801\\GIT\\\u8346\u95E8\u683C\u6797\u7F8E\u5357\u533A\\ams\\Hanhe.iWCS.JingmenGEMTwoProtocol\\EnentListen.cs", |
| | | "RelativeToolTip": "EnentListen.cs", |
| | | "ViewState": "AgIAACIAAAAAAAAAAAAcwE0BAAAMAAAAAAAAAA==", |
| | | "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", |
| | | "WhenOpened": "2025-07-14T00:36:42.299Z", |
| | | "EditorCaption": "" |
| | | } |
| | | ] |
| | | }, |
| | |
| | | { |
| | | "Version": 1, |
| | | "WorkspaceRootPath": "C:\\software\\A-\u5DE5\u4F5C\\\u6E90\u7801\\GIT\\\u8346\u95E8\u683C\u6797\u7F8E\u5357\u533A\\ams\\Hanhe.iWCS.JingmenGEMTwoProtocol\\", |
| | | "Documents": [], |
| | | "WorkspaceRootPath": "C:\\software\\A-\u5DE5\u4F5C\\\u6E90\u7801\\WCS\\Hanhe.iWCS.3.3\\\u8346\u95E8\u683C\u6797\u7F8E\\Hanhe.iWCS.JingmenGEMTwoProtocol\\", |
| | | "Documents": [ |
| | | { |
| | | "AbsoluteMoniker": "D:0:0:{BCE5B4FC-C2CD-459E-AAD0-34D4900B4528}|Hanhe.iWCS.JingmenGEMTwoProtocol.csproj|c:\\software\\a-\u5DE5\u4F5C\\\u6E90\u7801\\wcs\\hanhe.iwcs.3.3\\\u8346\u95E8\u683C\u6797\u7F8E\\hanhe.iwcs.jingmengemtwoprotocol\\enentlisten.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", |
| | | "RelativeMoniker": "D:0:0:{BCE5B4FC-C2CD-459E-AAD0-34D4900B4528}|Hanhe.iWCS.JingmenGEMTwoProtocol.csproj|solutionrelative:enentlisten.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" |
| | | } |
| | | ], |
| | | "DocumentGroupContainers": [ |
| | | { |
| | | "Orientation": 0, |
| | |
| | | "DocumentGroups": [ |
| | | { |
| | | "DockedWidth": 16, |
| | | "SelectedChildIndex": -1, |
| | | "SelectedChildIndex": 7, |
| | | "Children": [ |
| | | { |
| | | "$type": "Bookmark", |
| | |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" |
| | | }, |
| | | { |
| | | "$type": "Document", |
| | | "DocumentIndex": 0, |
| | | "Title": "EnentListen.cs", |
| | | "DocumentMoniker": "C:\\software\\A-\u5DE5\u4F5C\\\u6E90\u7801\\WCS\\Hanhe.iWCS.3.3\\\u8346\u95E8\u683C\u6797\u7F8E\\Hanhe.iWCS.JingmenGEMTwoProtocol\\EnentListen.cs", |
| | | "RelativeDocumentMoniker": "EnentListen.cs", |
| | | "ToolTip": "C:\\software\\A-\u5DE5\u4F5C\\\u6E90\u7801\\WCS\\Hanhe.iWCS.3.3\\\u8346\u95E8\u683C\u6797\u7F8E\\Hanhe.iWCS.JingmenGEMTwoProtocol\\EnentListen.cs", |
| | | "RelativeToolTip": "EnentListen.cs", |
| | | "ViewState": "AgIAAOYAAAAAAAAAAAAgwFEBAAA1AAAAAAAAAA==", |
| | | "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", |
| | | "WhenOpened": "2025-07-14T00:36:42.299Z", |
| | | "EditorCaption": "" |
| | | } |
| | | ] |
| | | }, |
| | |
| | | var req = JsonConvert.DeserializeObject<mesInfo>(res); |
| | | if(req != null) |
| | | { |
| | | if (req.isSucess) |
| | | if (req.isSuccess) |
| | | { |
| | | var mesCodeLen = req.data.mesCode.Length; |
| | | var mesCodeTwo = int.Parse(req.data.mesCode.Substring(0, mesCodeLen - 3)); |
| | | var timeCuo = MongoDBSingleton.Instance.FindOne<TimeCuoInfoCom>(Query.EQ("packingMachineNumber", models.machineNo), "TimeCuoInfoCom"); |
| | | if (timeCuo == null) |
| | | { |
| | |
| | | productModel = req.data.materialSpec, |
| | | bagNumber_1 = req.data.bagNum, |
| | | totalCount = 1, |
| | | timeStamp = mesCodeTwo, |
| | | timeStampMES = req.data.mesCode, |
| | | photoURL = req.data.barCode, |
| | | ProductionDate = req.data.ywDate, |
| | | // ERP变更-照相机新增字段 |
| | |
| | | //变更注释 |
| | | 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", mesCodeTwo) |
| | | .Set("productModel", req.data.materialSpec).Set("bagNumber_1", req.data.bagNum).Set("totalCount", 1).Set("timeStampMES", 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) |
| | |
| | | |
| | | //生成到接驳平台的任务 |
| | | string traycode = DateTime.Now.ToString("yyyy-MM-dd").Replace("-", ""); |
| | | string timeCuo2 = mesCodeTwo.ToString(); |
| | | var CBInfo = Settings.GetConnectingbitsList().Where(a => a.enable == 1).ToList(); |
| | | if (CBInfo != null) |
| | | { |
| | |
| | | { |
| | | 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); |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", a.locCode), Update.Set("trayCode", traycode).Set("timeCuo", req.data.mesCode), UpdateFlags.None); |
| | | |
| | | break; |
| | | } |
| | |
| | | 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); |
| | | |
| | | MongoDBSingleton.Instance.Insert<ConnectingBits>(new ConnectingBits { Bit = a.locCode, trayCode = traycode, state = "0", timeCuo = req.data.mesCode }); |
| | | |
| | | break; |
| | | } |
| | | else CMMLog.Debug($"PDA打包下线:AMS调用API失败,开始重新调用!"); |
| | | } |
| | | if (amsResult != null && amsResult.success) |
| | | { |
| | | //上报条码表 |
| | | 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); |
| | | //var plc = Settings.GetPlcInfo().Where(b => b.location == models.machineNo && b.enable == 1).First(); |
| | | //if(plc != null) |
| | | //{ |
| | | // var wirteall01 = OITcpHelper.RegisterWriteOutPut(new OITcpHelper.RegisterWriteOutPutModel |
| | | // { |
| | | // addr = plc.writeAddr, |
| | | // host = plc.ip, |
| | | // port = plc.port, |
| | | // data = 4 |
| | | // }); |
| | | //} |
| | | |
| | | } |
| | | } |
| | | else CMMLog.Debug("打包下线口接驳位点位未配置"); |
| | |
| | | public int code { get; set; } |
| | | public string msg { get; set; } |
| | | public mesData data { get; set; } |
| | | public bool isSucess { get; set; } |
| | | public bool isSuccess { get; set; } |
| | | } |
| | | |
| | | public class mesData |
| | |
| | | /// <summary> |
| | | /// 时间戳 |
| | | /// </summary> |
| | | public int timeStamp { get; set; } |
| | | public int timeStamp { get; set; } |
| | | /// <summary> |
| | | /// 时间戳 |
| | | /// </summary> |
| | | public string timeStampMES { get; set; } |
| | | /// <summary> |
| | | /// 照片url |
| | | /// </summary> |
| | |
| | | /// 小车到达包装机安全门口请求进入 |
| | | /// </summary> |
| | | /// <param name="ips"></param> |
| | | internal static void PickUpFullDoorUnload(string ip, string taskNo) |
| | | internal static void PickUpFullDoorUnload(string ip, string taskNo, string type) |
| | | { |
| | | var plc = Settings.GetPlcInfo().Where(a => a.ip == ip).FirstOrDefault(); |
| | | //ASM写入通道0小车动作,1-取料 |
| | | int[] num = new int[2] { 1, 1 }; |
| | | //if(type == "PDA打包下线") |
| | | //{ |
| | | // num[0] = 4; |
| | | //} |
| | | var writeRes0 = OITcpHelper.RegisterWriteOutPutMulti(new OITcpHelper.RegisterWriteOutPutModelMulti |
| | | { |
| | | host = ip, |
| | |
| | | if (locInfo.state == "1") |
| | | { |
| | | //变更注释 |
| | | //if (string.IsNullOrEmpty(locInfo.END_LOC)) |
| | | //{ |
| | | if (string.IsNullOrEmpty(locInfo.END_LOC)) |
| | | { |
| | | CMMLog.Info("InWarehouse:" + JsonConvert.SerializeObject(locInfo)); |
| | | string wmstaskno = ""; |
| | | string trayCode = locInfo.timeCuo; |
| | |
| | | } |
| | | } |
| | | else CMMLog.Info($"接驳位入立库流程:WMS生成任务失败!"); |
| | | //} |
| | | //else |
| | | //{ |
| | | // //防止辅材回库的终点货位数据没删,导致入库任务计算成了辅材任务,这里需要二次判断 |
| | | // if(locInfo.trayCode.Substring(0,3) == "SWT") |
| | | // { |
| | | // HHAmsExecuteResult req = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), locCode, locInfo.END_LOC, "辅材转运", 0, locInfo.trayCode); |
| | | // } |
| | | // else |
| | | // { |
| | | // MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("_id", locInfo._id), Update.Set("END_LOC", ""), UpdateFlags.None); |
| | | // } |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | //防止辅材出库的终点货位数据没删,导致入库任务计算成了辅材任务,这里需要二次判断 |
| | | HHAmsExecuteResult req = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), locCode, locInfo.END_LOC, "辅材出库(二段)", 0, locInfo.trayCode); |
| | | if (req.success) |
| | | { |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", locCode), Update.Set("state", "2"), "ConnectingBits", UpdateFlags.None); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | else CMMLog.Info("立库通道未配置"); |
| | | } |
| | | |
| | | internal static void fcrk(Settings.PlcInfo plc) |
| | | internal static void fcrk(Settings.PlcInfo plc,bool action, string taskNo = "") |
| | | { |
| | | int[] num = new int[1] { 2 }; |
| | | var wirte1 = OITcpHelper.RegisterWriteOutPutMulti(new OITcpHelper.RegisterWriteOutPutModelMulti |
| | | if (action) |
| | | { |
| | | addr = plc.writeAddr + 2, |
| | | host = plc.ip, |
| | | port = plc.port, |
| | | data = num |
| | | }); |
| | | CMMLog.Info($"在通道{plc.writeAddr + 2}中写入{JsonConvert.SerializeObject(num)},ip:{plc.ip},端口:{plc.port}"); |
| | | 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 = 2, |
| | | addr = plc.readAddr, |
| | | host = plc.ip, |
| | | port = plc.port |
| | | }); |
| | | CMMLog.Debug($"查询设备{plc.location}通道{plc.readAddr}里面数据为{result.result[0]}、{result.result[1]}."); |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | if (result.result[0] == 1 && result.result[1] == 2) |
| | | { |
| | | //推送小车进入 |
| | | TSHelper.GoToAGV(taskNo, 10, 1); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int[] num = new int[1] { 2 }; |
| | | var wirte1 = OITcpHelper.RegisterWriteOutPutMulti(new OITcpHelper.RegisterWriteOutPutModelMulti |
| | | { |
| | | addr = plc.writeAddr + 2, |
| | | host = plc.ip, |
| | | port = plc.port, |
| | | data = num |
| | | }); |
| | | CMMLog.Info($"在通道{plc.writeAddr + 2}中写入{JsonConvert.SerializeObject(num)},ip:{plc.ip},端口:{plc.port}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | using System.Linq; |
| | | using System.Net.Configuration; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Web.UI.WebControls.WebParts; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.ApiHelper; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.EnentListen; |
| | |
| | | if(mst.CN_S_STATUS=="未执行" || mst.CN_S_STATUS == "待推送") |
| | | { |
| | | mst = MongoDBSingleton.Instance.FindOne<TN_I_TASK_MST>(Query.EQ("CN_S_TASK_NO", mst.CN_S_TASK_NO), "TN_I_TASK_MST"); |
| | | if (mst.CN_S_BUSS_TYPE == "辅材回库") |
| | | { |
| | | var CBTableList = MongoDBSingleton.Instance.FindAll<ConnectingBits>("ConnectingBits"); |
| | | foreach (var a in CBTableList) |
| | | { |
| | | if (string.IsNullOrEmpty(a.trayCode)) |
| | | { |
| | | string cntrType = mst.transportInfo[0].trayCode; |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", a.Bit), Update.Set("trayCode", cntrType).Set("END_LOC", mst.CN_S_END_BIT), UpdateFlags.None); |
| | | |
| | | MongoDBSingleton.Instance.Update<TN_I_TASK_MST>(Query.EQ("CN_S_TASK_NO", mst.CN_S_TASK_NO), Update.Set("CN_S_END_BIT", a.Bit), UpdateFlags.None); |
| | | |
| | | new SqlHelper<object>().ExecuteSql($"update dbo.tn_am_task_mst set CN_S_END_BIT='{a.Bit}',CN_S_END_AGVBIT = '{StockInstance.Instance.GetAGVCodeForBitCode(a.Bit)}' where CN_S_TASK_NO = '{mst.CN_S_TASK_NO}'"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | StringBuilder sbMsg = new StringBuilder(); |
| | | var start = StockInstance.Instance.GetLocationInfoTwo(mst.CN_S_START_BIT); |
| | |
| | | //两个接驳平台 |
| | | if (mst.CN_S_START_BIT == conn[0].locCode || mst.CN_S_START_BIT == conn[1].locCode) |
| | | { |
| | | start.CN_N_AGV_LOCATION = Settings.GetConnectingbitsList().Where(a => a.locCode == mst.CN_S_START_BIT).First().agvSite[1]; |
| | | if(mst.CN_S_BUSS_TYPE == "辅材出库(二段)") |
| | | { |
| | | start.CN_N_AGV_LOCATION = Settings.GetConnectingbitsList().Where(a => a.locCode == mst.CN_S_START_BIT).First().agvSite[0]; |
| | | } |
| | | else |
| | | { |
| | | start.CN_N_AGV_LOCATION = Settings.GetConnectingbitsList().Where(a => a.locCode == mst.CN_S_START_BIT).First().agvSite[1]; |
| | | } |
| | | |
| | | } |
| | | if (mst.CN_S_END_BIT == conn[0].locCode || mst.CN_S_END_BIT == conn[1].locCode) |
| | | { |
| | | end.CN_N_AGV_LOCATION = Settings.GetConnectingbitsList().Where(a => a.locCode == mst.CN_S_END_BIT).First().agvSite[0]; |
| | | if(mst.CN_S_BUSS_TYPE == "辅材出库(二段)") |
| | | { |
| | | end.CN_N_AGV_LOCATION = Settings.GetConnectingbitsList().Where(a => a.locCode == mst.CN_S_END_BIT).First().agvSite[1]; |
| | | } |
| | | else |
| | | { |
| | | end.CN_N_AGV_LOCATION = Settings.GetConnectingbitsList().Where(a => a.locCode == mst.CN_S_END_BIT).First().agvSite[0]; |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (conn.Count == 1) |
| | |
| | | var endLoc = MongoDBSingleton.Instance.FindOne<MongoTN_AB_STOCK_LOCATION>(Query.EQ("CN_S_LOCATION_CODE", mst.CN_S_END_BIT), "MongoTN_AB_STOCK_LOCATION"); |
| | | if(startLoc != null && endLoc != null) |
| | | { |
| | | if(startLoc.CN_S_AREA_CODE == "CKHJ" || endLoc.CN_S_AREA_CODE == "CKHJ") |
| | | if(startLoc.CN_S_AREA_CODE == "CKHJ" || endLoc.CN_S_AREA_CODE == "CKHJ" || endLoc.CN_S_AREA_CODE == "CPTPFCHJ" || startLoc.CN_S_AREA_CODE == "CPTPFCHJ") |
| | | { |
| | | TRow = "1"; |
| | | } |
| | |
| | | if (code == 1012) |
| | | { |
| | | //卸货申请,先判断设备是否允许进料,如果是直接改参数,并通知设备 |
| | | 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 == "PDA打包下线") PLCControl.PickUpFullDoorUnload(plc.ip, mst.CN_S_TASK_NO, mst.CN_S_BUSS_TYPE);//进入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 == "辅材入库") PLCControl.fcrk(plc, true, 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) |
| | |
| | | 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 == "辅材入库") PLCControl.fcrk(plc, false); |
| | | 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); |
| | | |
| | | } |
| | |
| | | // } |
| | | //} |
| | | } |
| | | if (mst.CN_S_BUSS_TYPE == "3楼成品出库" || mst.CN_S_BUSS_TYPE == "辅材出库") |
| | | if (mst.CN_S_BUSS_TYPE == "3楼成品出库") |
| | | { |
| | | //3楼成品出库任务拦截 |
| | | if (!OutWareTask(mst)) |
| | |
| | | { |
| | | result = true; |
| | | } |
| | | } |
| | | if (mst.CN_S_BUSS_TYPE == "辅材出库") |
| | | { |
| | | FCOutTask(mst); |
| | | } |
| | | if (mst.CN_S_BUSS_TYPE == "电钴生产退库") |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 辅材出库 |
| | | /// </summary> |
| | | /// <param name="mst"></param> |
| | | private static void FCOutTask(TN_I_TASK_MST mst) |
| | | { |
| | | var CBInfo = Settings.GetConnectingbitsList().Where(a => a.enable == 1).ToList(); |
| | | if (CBInfo != 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)) |
| | | { |
| | | //修改任务终点,并且将点位写入中间表 |
| | | MongoDBSingleton.Instance.Update<TN_I_TASK_MST>(Query.EQ("CN_S_TASK_NO", mst.CN_S_TASK_NO), Update.Set("CN_S_END_BIT", a.locCode), UpdateFlags.None); |
| | | |
| | | new SqlHelper<object>().ExecuteSql($"update dbo.tn_am_task_mst set CN_S_END_BIT='{a.locCode}',CN_S_END_AGVBIT = '{StockInstance.Instance.GetAGVCodeForBitCode(a.locCode)}' where CN_S_TASK_NO = '{mst.CN_S_TASK_NO}'"); |
| | | |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", a.locCode), Update.Set("trayCode", mst.CN_S_BATCH_NO).Set("END_LOC", a.locCode), UpdateFlags.None); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //修改任务终点,并且将点位写入中间表 |
| | | MongoDBSingleton.Instance.Update<TN_I_TASK_MST>(Query.EQ("CN_S_TASK_NO", mst.CN_S_TASK_NO), Update.Set("CN_S_END_BIT", a.locCode), UpdateFlags.None); |
| | | |
| | | new SqlHelper<object>().ExecuteSql($"update dbo.tn_am_task_mst set CN_S_END_BIT='{a.locCode}',CN_S_END_AGVBIT = '{StockInstance.Instance.GetAGVCodeForBitCode(a.locCode)}' where CN_S_TASK_NO = '{mst.CN_S_TASK_NO}'"); |
| | | |
| | | MongoDBSingleton.Instance.Insert<ConnectingBits>(new ConnectingBits { Bit = a.locCode, trayCode = mst.CN_S_BATCH_NO, state = "0", END_LOC = a.locCode }); |
| | | } |
| | | } |
| | | else CMMLog.Debug("接驳位点位未配置"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 四钴生产退库 |
| | | /// 将任务拆分成两段任务,第一段任务终点改为接驳平台 |
| | | /// 二段任务从接驳平台入库 |
| | |
| | | { |
| | | //1、判断辅材入库终点是否有任务 |
| | | //2、判断输送线模式和中间表模式都是入库模式 |
| | | bool action = true; |
| | | var plc = Settings.GetPlcInfo().Where(a => a.deviceType == "18" && a.enable == 1).ToList(); |
| | | if (plc.Count > 0) |
| | | CMMLog.Debug("辅材入库流程 开始"); |
| | | |
| | | bool action = false; |
| | | var plc = Settings.GetPlcInfo().Where(a => a.location == mst.CN_S_START_BIT && a.enable == 1).First(); |
| | | if (plc != null) |
| | | { |
| | | foreach(var a in plc) |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | if(CheckStartFree(a.location) && CheckEndFree(a.location)) |
| | | dataNum = 1, |
| | | addr = plc.readAddr + 3, |
| | | host = plc.ip, |
| | | port = plc.port |
| | | }); |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | CMMLog.Debug($"辅材入库流程:读取滚筒机{plc.ip}通道号为:{plc.readAddr + 3}的值为:{result.result[0]}"); |
| | | if (result.result[0] == 1) |
| | | { |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | CMMLog.Debug($"辅材入库流程:输送线为 出库模式,输送线点位:{plc.location}"); |
| | | return action; |
| | | } |
| | | if (result.result[0] == 2) |
| | | { |
| | | //读取中间表模式 |
| | | var modelInfo = MongoDBSingleton.Instance.FindOne<ModeList>("ModeList"); |
| | | if (modelInfo != null) |
| | | { |
| | | dataNum = 1, |
| | | addr = a.readAddr + 3, |
| | | host = a.ip, |
| | | port = a.port |
| | | }); |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | CMMLog.Debug($"辅材入库流程:读取滚筒机{a.ip}通道号为:{a.readAddr + 3}的值为:{result.result[0]}"); |
| | | if (result.result[0] == 1) |
| | | if (modelInfo.Mode == "出库模式") |
| | | { |
| | | action = false; |
| | | CMMLog.Debug($"辅材入库流程:输送线为 出库模式,输送线点位:{a.location}"); |
| | | break; |
| | | CMMLog.Debug($"辅材入库流程:中间表 ModeList为 出库模式"); |
| | | return action; |
| | | } |
| | | else |
| | | { |
| | | //读取中间表模式 |
| | | var modelInfo = MongoDBSingleton.Instance.FindOne<ModeList>("ModeList"); |
| | | if(modelInfo != null) |
| | | { |
| | | if(modelInfo.Mode == "出库模式") |
| | | { |
| | | action = false; |
| | | CMMLog.Debug($"辅材入库流程:中间表 ModeList为 出库模式"); |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | action = false; |
| | | CMMLog.Debug("辅材入库流程:中间表 ModeList 为空"); |
| | | break; |
| | | } |
| | | action = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | CMMLog.Debug("辅材入库流程:中间表 ModeList 为空"); |
| | | return action; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | action = false; |
| | | CMMLog.Debug($"辅材入库流程:当前点位有任务,点位:{a.location}"); |
| | | break; |
| | | } |
| | | }; |
| | | } |
| | | |
| | | if (action) |
| | | { |
| | | //入库模式核验正确 判断货物是否到位 |
| | | var startPlc = plc.Where(a => a.location == mst.CN_S_START_BIT).First(); |
| | | if(startPlc != null) |
| | | result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | dataNum = 1, |
| | | addr = startPlc.readAddr + 1, |
| | | host = startPlc.ip, |
| | | port = startPlc.port |
| | | }); |
| | | dataNum = 1, |
| | | addr = plc.readAddr + 1, |
| | | host = plc.ip, |
| | | port = plc.port |
| | | }); |
| | | |
| | | if (result != null && result.errCode == 0) |
| | | if (result != null && result.errCode == 0) |
| | | { |
| | | CMMLog.Debug($"辅材入库流程:读取滚筒机{plc.ip}通道号为:{plc.readAddr + 1}的值为:{result.result[0]}"); |
| | | if (result.result[0] == 2) |
| | | { |
| | | CMMLog.Debug($"辅材入库流程:读取滚筒机{startPlc.ip}通道号为:{startPlc.readAddr + 3}的值为:{result.result[0]}"); |
| | | if (result.result[0] == 2) |
| | | int[] num = new int[2] { 2, 1 }; |
| | | var wirteal = OITcpHelper.RegisterWriteOutPutMulti(new OITcpHelper.RegisterWriteOutPutModelMulti |
| | | { |
| | | int[] num = new int[2] { 2, 1 }; |
| | | var wirteal = OITcpHelper.RegisterWriteOutPutMulti(new OITcpHelper.RegisterWriteOutPutModelMulti |
| | | { |
| | | addr = startPlc.writeAddr + 1, |
| | | host = startPlc.ip, |
| | | data = num, |
| | | port = startPlc.port |
| | | }); |
| | | addr = plc.writeAddr + 1, |
| | | host = plc.ip, |
| | | data = num, |
| | | port = plc.port |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | #region 判断输送线模式 变更注释 |
| | | |
| | | //foreach(var a in plc) |
| | | //{ |
| | | // bool action = false; |
| | | // var modeResult = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | // { |
| | | // dataNum = 1, |
| | | // addr = a.readAddr + 3, |
| | | // host = a.ip, |
| | | // port = a.port |
| | | // }); |
| | | // if (modeResult != null && modeResult.errCode == 0) |
| | | // { |
| | | // CMMLog.Debug($"OutWareTask:读取滚筒机{a.ip}通道号为:{a.readAddr + 3}的值为:{modeResult.result[0]}"); |
| | | // if (modeResult.result[0] == 2) |
| | | // { |
| | | // CMMLog.Debug($"OutWareTask:输送线为 入库模式,输送线点位:{a.location}"); |
| | | // break; |
| | | // } |
| | | // else |
| | | // { |
| | | // //读取中间表模式 |
| | | // var modelInfo = MongoDBSingleton.Instance.FindOne<ModeList>("ModeList"); |
| | | // if (modelInfo != null) |
| | | // { |
| | | // if (modelInfo.Mode == "入库模式") |
| | | // { |
| | | // CMMLog.Debug($"OutWareTask:中间表 ModeList为 入库模式"); |
| | | // } |
| | | // else |
| | | // { |
| | | // action = true; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // CMMLog.Debug("OutWareTask:中间表 ModeList 为空"); |
| | | // } |
| | | // } |
| | | // } |
| | | // if (!action) |
| | | // { |
| | | // return false; |
| | | // } |
| | | //}; |
| | | foreach(var a in plc) |
| | | { |
| | | bool action = false; |
| | | var modeResult = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | dataNum = 1, |
| | | addr = a.readAddr + 3, |
| | | host = a.ip, |
| | | port = a.port |
| | | }); |
| | | if (modeResult != null && modeResult.errCode == 0) |
| | | { |
| | | CMMLog.Debug($"OutWareTask:读取滚筒机{a.ip}通道号为:{a.readAddr + 3}的值为:{modeResult.result[0]}"); |
| | | if (modeResult.result[0] == 2) |
| | | { |
| | | CMMLog.Debug($"OutWareTask:输送线为 入库模式,输送线点位:{a.location}"); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | //读取中间表模式 |
| | | var modelInfo = MongoDBSingleton.Instance.FindOne<ModeList>("ModeList"); |
| | | if (modelInfo != null) |
| | | { |
| | | if (modelInfo.Mode == "入库模式") |
| | | { |
| | | CMMLog.Debug($"OutWareTask:中间表 ModeList为 入库模式"); |
| | | } |
| | | else |
| | | { |
| | | action = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | CMMLog.Debug("OutWareTask:中间表 ModeList 为空"); |
| | | } |
| | | } |
| | | } |
| | | if (!action) |
| | | { |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | |
| | | WMSHelper.ExecuteState(mst.CN_S_SOURCE_NO, action.CN_N_ACTION_CODE); |
| | | if (mst.CN_S_BUSS_TYPE == "包装线补空") PLCControl.PickUpBlankComplete(mst.CN_S_END_BIT, mst.CN_S_START_BIT); |
| | | //if (mst.CN_S_BUSS_TYPE == "3楼包装取料") PLCControl.CheckUpReqUnload(mst.CN_S_END_BIT, mst.CN_S_TASK_NO,); |
| | | if (mst.CN_S_BUSS_TYPE == "缓存架入立库" || mst.CN_S_BUSS_TYPE == "辅材转运") |
| | | if (mst.CN_S_BUSS_TYPE == "缓存架入立库" || mst.CN_S_BUSS_TYPE == "辅材出库(二段)") |
| | | { |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", mst.CN_S_START_BIT), Update.Set("trayCode", "").Set("state", "0"), UpdateFlags.None); |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", mst.CN_S_START_BIT), Update.Set("trayCode", "").Set("state", "0").Set("END_LOC", ""), UpdateFlags.None); |
| | | //MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", mst.CN_S_START_BIT), Update.Set("trayCode", "").Set("state", "0"), UpdateFlags.None); |
| | | } |
| | | if (mst.CN_S_BUSS_TYPE == "电钴缓存架入立库" || mst.CN_S_BUSS_TYPE == "电钴生产退库(二段)") |
| | | { |
| | |
| | | |
| | | |
| | | } |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "PDA打包下线") |
| | | if (mst.CN_S_BUSS_TYPE == "3楼打包下线" || mst.CN_S_BUSS_TYPE == "PDA打包下线" || mst.CN_S_BUSS_TYPE == "辅材出库") |
| | | { |
| | | MongoDBSingleton.Instance.Update<ConnectingBits>(Query.EQ("Bit", mst.CN_S_END_BIT), Update.Set("state", "1"), UpdateFlags.None); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 二段任务的终点货位 |
| | | /// </summary> |
| | | //public string END_LOC { get; set; } //变更注释 |
| | | public string END_LOC { get; set; } |
| | | } |
| | | |
| | | public class DGConnectingBits |
| | |
| | | else if (ItemCode == "time" || ItemCode == "拆盘变更" || ItemCode == "打包下线") |
| | | { |
| | | CMMLog.Info($"{trayCode}"); |
| | | var time = MongoDBSingleton.Instance.FindOne<TimeCuoInfoCom>(Query.EQ("timeStamp", int.Parse(trayCode)), "TimeCuoInfoCom"); |
| | | TimeCuoInfoCom time = new TimeCuoInfoCom { }; |
| | | if (trayCode.Contains("MES")) |
| | | { |
| | | time = MongoDBSingleton.Instance.FindOne<TimeCuoInfoCom>(Query.EQ("timeStampMES", trayCode), "TimeCuoInfoCom"); |
| | | } |
| | | else |
| | | { |
| | | time = MongoDBSingleton.Instance.FindOne<TimeCuoInfoCom>(Query.EQ("timeStamp", int.Parse(trayCode)), "TimeCuoInfoCom"); |
| | | } |
| | | if (ItemCode == "time" && time != null) |
| | | { |
| | | int TimeStamp = string.IsNullOrEmpty(timeStamp) ? time.timeStamp : int.Parse(timeStamp); |