| | |
| | | //RegisterReadInPut 读取输入寄存器还是输出寄存器待定,读取通道1的数据 |
| | | var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel |
| | | { |
| | | dataNum = 1, |
| | | dataNum = 2, |
| | | addr = plc.readAddr+1, |
| | | host = plc.ip, |
| | | port = plc.port |
| | |
| | | { |
| | | string wmstaskno = ""; |
| | | string traycode = ""; |
| | | bool req = WMSHelper.WMSEmptyOut(plc.location, "", ref wmstaskno, ref traycode); |
| | | string trayType = ""; |
| | | if (result.result[1] == 1) trayType = "田字托"; |
| | | else trayType = "川字托"; |
| | | bool req = WMSHelper.WMSEmptyOut(plc.location, "",trayType, ref wmstaskno, ref traycode); |
| | | if (req) CMMLog.Debug($"调用WMS获取三楼拆盘机生成任务成功!"); |
| | | else CMMLog.Debug($"调用WMS获取三楼拆盘机生成任务失败!"); |
| | | } |
| | |
| | | info.productWeight = Convert.ToInt32(Completion(result[4]) + Completion(result[5]), 2).ToString(); |
| | | info.oneTrayWeight1 = Convert.ToInt32(Completion(result[6]) + Completion(result[7]), 2).ToString(); |
| | | info.oneTrayWeight = Convert.ToInt32(Completion(result[8]) + Completion(result[9]), 2).ToString(); |
| | | //info.oneTrayWeight = Convert.ToInt32(Completion(result[10]) + Completion(result[11]), 2).ToString(); |
| | | info.trayType = Convert.ToInt32(Completion(result[10]), 2).ToString(); |
| | | info.addState = Convert.ToInt32(Completion(result[11]), 2); |
| | | info.packageCode = Convert.ToInt32(Completion(result[12]), 2).ToString(); |
| | | |
| | |
| | | |
| | | |
| | | CMMLog.Info($"数据处理流程:获取MODBUS转换后的数据信息:location:{info.location},trayCode:{info.trayCode},productWeight:{info.productWeight}" + |
| | | $",oneTrayWeight1:{info.oneTrayWeight1},oneTrayWeight:{info.oneTrayWeight} "+ |
| | | $",oneTrayWeight1:{info.oneTrayWeight1},oneTrayWeight:{info.oneTrayWeight},trayType:{info.trayType} "+ |
| | | $"addState:{info.addState},packageCode:{info.packageCode}"); |
| | | |
| | | #endregion |
| | |
| | | var query1 = Query.And(Query.EQ("machineNo", location), Query.EQ("trayCode", "0")); |
| | | UpdateBuilder updateBuider = Update.Set("location", info.location). |
| | | Set("trayCode", info.trayCode).Set("productWeight", info.productWeight). |
| | | Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1). |
| | | Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1).Set("trayType", info.trayType). |
| | | Set("addWeight", info.addWeight).Set("packNg", info.packNg).Set("secondNg", info.secondNg).Set("addState", info.addState). |
| | | Set("packageCode", info.packageCode).Set("jsonData", json).Set("modify", DateTime.Now); |
| | | MongoDBSingleton.Instance.Update<MachineInfo>(query1, updateBuider, "MachineInfo", UpdateFlags.None); |
| | |
| | | { |
| | | UpdateBuilder updateBuider = Update.Set("location", info.location). |
| | | Set("trayCode", info.trayCode).Set("productWeight", info.productWeight). |
| | | Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1). |
| | | Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1).Set("trayType", info.trayType). |
| | | Set("addWeight", info.addWeight).Set("packNg", info.packNg).Set("secondNg", info.secondNg).Set("addState", info.addState). |
| | | Set("packageCode", info.packageCode).Set("jsonData", json).Set("modify", DateTime.Now); |
| | | MongoDBSingleton.Instance.Update<MachineInfo>(query2, updateBuider, "MachineInfo", UpdateFlags.None); |
| | |
| | | num[b] = Convert.ToInt32(Convert.ToString(int.Parse(machine.oneTrayWeight), 2).PadLeft(32, '0').ToString().Substring(k, 16), 2); |
| | | } |
| | | //for (int b = 10; b <= 11; b++) num[b] = 0;// 叠包后实际重量 && 复称结果 默认:0 |
| | | num[10] = string.IsNullOrEmpty(machine.palletLayers) ? 0 : int.Parse(machine.palletLayers); //是否需要叠托盘 |
| | | num[10] = int.Parse(machineInfoTwo.trayType); //托盘类型 |
| | | num[11] = machine.addState; //是否需要叠包 |
| | | num[12] = int.Parse(machine.packageCode); //袋号 |
| | | //员工编号 |