111
cjs
2025-06-13 6226621ae47b6dd28e4517ca79bf66b6fa57d95e
ams/Hanhe.iWCS.TaizhouGEMTwoProtocol/ProcessHelper.cs
@@ -132,6 +132,14 @@
                string TRow = string.IsNullOrEmpty(end.CN_S_FLOOR) ? "1" : end.CN_S_FLOOR;
                CMMLog.Info($"任务推送:货位编码:起点信息:{JsonConvert.SerializeObject(start)},终点信息:{JsonConvert.SerializeObject(end)};任务信息:{JsonConvert.SerializeObject(mst)}");
                var trayInfo = MongoDBSingleton.Instance.FindOne<trayTypeTable>(Query.EQ("locCode", mst.CN_S_START_BIT), "trayTypeTable");
                if (trayInfo != null && trayInfo.trayType == "2")
                {
                    start.CN_N_AGV_LOCATION = start.CN_N_AGV_LOCATION + 400;
                    end.CN_N_AGV_LOCATION = end.CN_N_AGV_LOCATION + 400;
                    CMMLog.Info($"任务推送:田字托起点终点 站点更改,起点:{start.CN_N_AGV_LOCATION},终点:{end.CN_N_AGV_LOCATION}");
                }
                if (mst.CN_S_BUSS_TYPE == "3楼复称入缓存架")
                {
                    CMMLog.Info($"任务推送特殊任务处理-3楼复称入缓存架:任务号:{mst.CN_S_TASK_NO},准备获取 sendBit 配置数据。备注:此任务类型仅获取起点。");
@@ -154,6 +162,10 @@
                        if (emp != null)
                        {
                            start.CN_N_AGV_LOCATION = agvLoc.Site[emp.Quantity - 1];
                        }
                        if(agvLoc.trayType == 2)
                        {
                            end.CN_N_AGV_LOCATION = MongoDBSingleton.Instance.FindOne<STOCK_LOCATION_Two>(Query.EQ("CN_S_LOCATION_CODE", mst.CN_S_END_BIT), "STOCK_LOCATION_Two").CN_N_AGV_LOCATION;
                        }
                    }
                }
@@ -242,6 +254,7 @@
                    if (mst.CN_S_BUSS_TYPE == "包装线补空") PLCControl.PackingLineComplete(plc.ip);
                    if (mst.CN_S_BUSS_TYPE == "电梯取货") PLCControl.LiftAction(plc, mst.CN_S_TASK_NO,false);
                    if (mst.CN_S_BUSS_TYPE == "四钴成品出库" || mst.CN_S_BUSS_TYPE == "四钴辅材出库") PLCControl.productOutWare(mst.CN_S_END_BIT, mst.CN_S_TASK_NO, false);
                    if (mst.CN_S_BUSS_TYPE == "3楼缓存架入叠托") PLCControl.CacheStackingMouth6(plc);
                }
            }
        }
@@ -394,6 +407,7 @@
                    result = true;
                }
            }
            var bussTypeInfo = Settings.GetHouWeiCodeo().Where(a => a.location == mst.Ext1).FirstOrDefault();
            if (bussTypeInfo != null)
            {
@@ -451,15 +465,14 @@
            try
            {
                string endMachLoc = "";
                string endLoc = "";
                //1、判断上料平台是否空闲,若空闲更改终点到上料平台
                var plc = Settings.GetPlcInfo().Where(a => a.deviceType == "18" && a.enable == 1).ToList();
                var plc = Settings.GetPlcInfo().Where(a => a.deviceType == "51" && a.enable == 1).ToList();
                if (plc.Count > 0)
                {
                    #region 判断输送线模式 变更注释
                    bool action = true;
                    plc.ForEach(a =>
                    foreach(var a in plc)
                    {
                        bool action = false;
                        var modeResult = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel
                        {
                            dataNum = 1,
@@ -469,11 +482,11 @@
                        });
                        if (modeResult != null && modeResult.errCode == 0)
                        {
                            CMMLog.Debug($"OutWareTask:读取滚筒机{a.ip}通道号为:{a.readAddr}的值为:{modeResult.result[0]}");
                            CMMLog.Debug($"OutWareTask:读取滚筒机ip:{a.ip},端口:{a.port}通道号为:{a.readAddr}的值为:{modeResult.result[0]}");
                            if (modeResult.result[0] == 2)
                            {
                                action = false;
                                CMMLog.Debug($"OutWareTask:输送线为 入库模式,输送线点位:{a.location}");
                                break;
                            }
                            else
                            {
@@ -483,22 +496,33 @@
                                {
                                    if (modelInfo.Mode == "入库模式")
                                    {
                                        action = false;
                                        CMMLog.Debug($"OutWareTask:中间表 ModeList为 入库模式");
                                    }
                                    else
                                    {
                                        action = true;
                                        int[] num = new int[1] { 1 };
                                        var writeRes = OITcpHelper.RegisterWriteOutPutMulti(new OITcpHelper.RegisterWriteOutPutModelMulti
                                        {
                                            host = a.ip,
                                            addr = a.writeAddr,
                                            data = num,
                                            port = a.port
                                        });
                                    }
                                }
                                else
                                {
                                    action = false;
                                    CMMLog.Debug("OutWareTask:中间表 ModeList 为空");
                                }
                            }
                        }
                    });
                    if (!action)
                    {
                        return false;
                    }
                        if (!action)
                        {
                            return false;
                        }
                    };
                    #endregion
                    CMMLog.Info($"OutWareTask 11111");
@@ -581,7 +605,6 @@
            //入库输送线上有两个输送口
            //判断输送线模式和中间表模式都是入库模式
            try
            {
                string endMachLoc = "";
@@ -600,7 +623,7 @@
                    });
                    if (modeResult != null && modeResult.errCode == 0)
                    {
                        CMMLog.Debug($"InWareTask:读取滚筒机{plc.ip}通道号为:{plc.readAddr}的值为:{modeResult.result[0]}");
                        CMMLog.Debug($"InWareTask:读取滚筒机{plc.ip}通道号为:{plc.readAddr}的值为:{JsonConvert.SerializeObject(modeResult.result)}");
                        if (modeResult.result[0] == 1)
                        {
                            action = false;
@@ -619,6 +642,14 @@
                                }
                                else
                                {
                                    int[] num = new int[1] { 2 };
                                    var writeRes = OITcpHelper.RegisterWriteOutPutMulti(new OITcpHelper.RegisterWriteOutPutModelMulti
                                    {
                                        host = plc.ip,
                                        addr = plc.writeAddr,
                                        data = num,
                                        port = plc.port
                                    });
                                    return true;
                                }
                            }