123
cjs
1 天以前 023358a9d414eb7215464948bffb5979ebb97386
ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs
@@ -215,6 +215,7 @@
                                                                if (req.success)
                                                                {
                                                                    string weight = (double.Parse(tray.oneTrayWeight1) / 100).ToString();
                                                                    //CMMLog.Debug("北区测试数据:包装下线重量:"+(decimal.Parse(tray.oneTrayWeight1) / 100).ToString("F2"));
                                                                    //int weight = int.Parse(tray.oneTrayWeight) / 100;
                                                                    ERPService.packageInfo(tray.machineNo, tray.trayCode, tray.lotNo, weight,1);
                                                                }
@@ -1167,15 +1168,12 @@
                            {
                                CMMLog.Info($"SecondWeightActionOne: machine:{query.machineNo},trayCode:{query.trayCode},weight:{query.weight}");
                                //读取复称平台的重量
                                //Convert.ToInt32(Completion(result[8]) + Completion(result[9]), 2).ToString()
                                //(decimal.Parse(tray.oneTrayWeight1) / 100).ToString("F2");
                                //string weight = (decimal.Parse(Convert.ToInt32(Completion(result.result[4]) + Completion(result.result[5]), 2).ToString()) / 100).ToString("F2");
                                string weight = ((result.result[3] * 65536 + result.result[4]) / 100).ToString();
                                //string weight = ((result.result[3] * 65536 + result.result[4]) / 100).ToString();
                                string weight = ((double)Convert.ToInt32(Completion(result.result[3]) + Completion(result.result[4]), 2) / 100).ToString();
                                //CMMLog.Debug("北区测试数据:复称重量:" + ((double)Convert.ToInt32(Completion(result.result[3]) + Completion(result.result[4]), 2) / 100).ToString());
                                CMMLog.Info($"SecondWeightActionOne: 读取设备{plc.location},ip:{plc.ip}通道{plc.readAddr + 4}里面数据为{result.result[3]}.");
                                CMMLog.Info($"SecondWeightActionOne: 读取设备{plc.location},ip:{plc.ip}通道{plc.readAddr + 5}里面数据为{result.result[4]}.");
                                //double x = (double)Convert.ToInt32(Completion(result[8]) + Completion(result[9]), 2) / 100;
                                //CMMLog.Info($"SecondWeightActionOne: 读取设备{plc.location},ip:{plc.ip}通道{plc.readAddr + 4}里面数据为{result.result[3]}.");
                                CMMLog.Info($"SecondWeightActionOne: weight:{weight}");
                                //重量差值
@@ -1432,7 +1430,7 @@
                //读取通道1里面参数是否为1,判断叠盘机是否需要上料
                var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel
                {
                    dataNum = 1,
                    dataNum = 3,
                    addr = pmInfo.readAddr + 1,
                    host = pmInfo.ip,
                    port = pmInfo.port
@@ -1442,14 +1440,20 @@
                    //参数1表示叠托点申请入料
                    if (result.result[0] == 1)
                    {
                        CMMLog.Debug($"获取碟盘机信号:{JsonConvert.SerializeObject(result)}");
                        var tasks = MongoDBSingleton.Instance.Find<TN_I_TASK_MST>(Query.EQ("CN_S_END_BIT", pmInfo.location), "TN_I_TASK_MST");
                        //判断一下当前叠托点是否有任务占用
                        if (ProcessHelper.CheckEndFree(pmInfo.location) && tasks.Count == 0)
                        {
                            //可以生成任务,调WMS接口获取任务信息
                            bool req = WMSHelper.WMSOut(pmInfo.location, "");
                            if (req) CMMLog.Debug($"调用WMS获取碟盘出库生成任务成功!");//现在任务由WMS自己下发,AMS做拦截处理(查询ext1里面对应的任务类型,并更改任务类型)
                            else CMMLog.Debug($"调用WMS获取碟盘出库生成任务失败!");
                            string trayType = result.result[2] == 1 ? "田字托" : result.result[2] == 2 ? "川字托" : "";
                            if (result.result[2] >= 1 && result.result[2] <= 2)
                            {
                                //可以生成任务,调WMS接口获取任务信息
                                bool req = WMSHelper.WMSOut(pmInfo.location, "",trayType);
                                if (req) CMMLog.Debug($"调用WMS获取碟盘出库生成任务成功!");//现在任务由WMS自己下发,AMS做拦截处理(查询ext1里面对应的任务类型,并更改任务类型)
                                else CMMLog.Debug($"调用WMS获取碟盘出库生成任务失败!");
                            }
                        }
                        else CMMLog.Debug($"检查当前叠托点是否有任务占用,或者MST主表中有缓存架入叠盘机的任务!");
                    }
@@ -1587,6 +1591,7 @@
                    host = plc.ip,
                    port = plc.port
                });
                CMMLog.Debug($"缓存架入叠托,读取叠包口信号:{JsonConvert.SerializeObject(readres)}");
                if (readres != null)
                {
                    var taskInfo = MongoDBSingleton.Instance.FindOne<TN_I_TASK_MST>(Query.EQ("CN_S_TASK_NO", taskNo), "TN_I_TASK_MST");
@@ -3440,7 +3445,7 @@
        public static int[] DiePanTwo(WMSInfo machine, MachineInfoTwo machineInfoTwo)
        {
            var ErpItemInfo = MongoDBSingleton.Instance.FindOne<ERPItemTable>(Query.EQ("item_code", machineInfoTwo.materialCode), "ERPItemTable");
            CMMLog.Info($"缓存架入叠托:收到信号5,查询MachineInfoTwo表信息:{JsonConvert.SerializeObject(ErpItemInfo)}。");
            CMMLog.Info($"缓存架入叠托:收到信号5,查询ERPItemTable表信息:{JsonConvert.SerializeObject(ErpItemInfo)}。");
            //偏移量 +11 通道范围: 40311 ~ 40390
            CMMLog.Info($"叠盘机数据处理.");