public override bool ExeBusiness(ref string reStr) { if (SysCfgModel.SimMode) { if (this.nodeID != "7001") { return(true); } string opWorkerID = "W12346"; string testModID = "MODT0001"; BatteryModuleModel batMod = batModBll.GetModel(testModID); batMod.downcapOPWorkerID = opWorkerID; batModBll.Update(batMod); } return(true); }
public override bool ExeBusiness(ref string reStr) { if (SysCfgModel.SimMode) { if (this.nodeID != "5001") { return(true); } string packID = "PACK00001"; string packOPWorkerID = "W22345"; string[] modIDs = new string[] { "MODT0001", "MODT0002" }; if (batPackBll.Exists(packID)) { return(true); } BatteryPackModel pack = new BatteryPackModel(); pack.batPackID = packID; pack.opWorkerID = packOPWorkerID; pack.packAsmTime = DateTime.Parse(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); batPackBll.Add(pack); foreach (string modID in modIDs) { BatteryModuleModel batMod = batModBll.GetModel(modID); if (batMod == null) { continue; } batMod.batPackID = packID; batMod.curProcessStage = EnumModProcessStage.模组装配到PACK.ToString(); batModBll.Update(batMod); AddProcessRecord(modID, EnumModProcessStage.模组装配到PACK.ToString()); } } return(true); }
private bool ExeBusinessUpper(ref string reStr) { List <string> recvBarcodesBuf = barcodeRW.GetBarcodesBuf(); if (recvBarcodesBuf.Contains("START") || recvBarcodesBuf.Contains("start")) { this.currentTaskPhase = 1; logRecorder.AddDebugLog(nodeName, "流程开始"); this.db1ValsToSnd[0] = 2; //开始扫码 } if (this.currentTaskPhase < 1) { //待机状态 this.db1ValsToSnd[0] = 1; return(true); } if (this.currentTaskPhase == 3) { System.Threading.Thread.Sleep(3000); this.db1ValsToSnd[0] = 1; this.currentTaskPhase = 0; } switch (this.currentTaskPhase) { case 1: { //给PLC提示,开始扫码 barcodeRW.ClearBarcodesBuf(); this.workerID = string.Empty; this.modID = string.Empty; this.batteryID = string.Empty; this.currentTaskPhase++; currentTaskDescribe = "开始,等待扫码、模组绑定"; break; } case 2: { recvBarcodesBuf = barcodeRW.GetBarcodesBuf(); for (int i = 0; i < recvBarcodesBuf.Count(); i++) { //Console.WriteLine(nodeName + ",扫码:" + recvBarcodesBuf[i]); if (recvBarcodesBuf[i].Length <= 0) { continue; } if (recvBarcodesBuf[i].Substring(0, 1).ToUpper() == "M" && recvBarcodesBuf[i].Length > 15) { //模组码 if (string.IsNullOrWhiteSpace(modID)) { Console.WriteLine(string.Format("{0},扫到模组:{1}", nodeName, recvBarcodesBuf[i])); } this.modID = recvBarcodesBuf[i]; } else if (recvBarcodesBuf[i].Substring(0, 2).ToUpper() == "NB") { if (string.IsNullOrWhiteSpace(workerID)) { Console.WriteLine(string.Format("{0},扫到员工码:{1}", nodeName, recvBarcodesBuf[i])); } this.workerID = recvBarcodesBuf[i]; } else { Console.WriteLine(string.Format("{0},不可识别的条码:{1}", nodeName, recvBarcodesBuf[i])); } } if (string.IsNullOrEmpty(this.workerID)) { break; } if (string.IsNullOrEmpty(this.modID)) { break; } //检查模组是否已经存在 BatteryModuleModel batModule = batModBll.GetModel(this.modID); if (batModule == null) { currentTaskDescribe = string.Format("模组{0},不存在,", this.modID); break; } batModule.topcapOPWorkerID = this.workerID; batModule.curProcessStage = EnumModProcessStage.模组焊接上盖.ToString(); batModBll.Update(batModule); this.db1ValsToSnd[0] = 3; //绑定完成 currentTaskDescribe = string.Format("模组{0}员工号绑定完成", this.modID); //添加生产过程记录 AddProcessRecord(this.modID, EnumModProcessStage.模组焊接上盖.ToString()); this.currentTaskPhase++; break; } case 3: { barcodeRW.ClearBarcodesBuf(); break; } } return(true); }
public override bool ExeBusiness(ref string reStr) { if (db2Vals[0] == 1) { db1ValsToSnd[0] = 1; currentStat.Status = EnumNodeStatus.设备空闲; } else if (db2Vals[0] == 2) { currentStat.Status = EnumNodeStatus.设备使用中; currentStat.StatDescribe = "工作中"; if (Db1ValsToSnd[0] != 2) { string rfidUID = ""; if (SysCfgModel.SimMode) { rfidUID = SimRfidUID; } else { byte[] rfidBytes = new byte[16]; for (int i = 0; i < 16; i++) { rfidBytes[i + 1] = (byte)db2Vals[i + 1]; } rfidUID = System.Text.Encoding.UTF8.GetString(rfidBytes); } if (string.IsNullOrWhiteSpace(rfidUID)) { db1ValsToSnd[0] = 3; currentStat.Status = EnumNodeStatus.无法识别; currentStat.StatDescribe = "RFID无效"; return(true); } string strWhere = string.Format("palletID='{0}' ", rfidUID); List <BatteryModuleModel> batModules = batModBll.GetModelList(strWhere); if (batModules == null || batModules.Count() < 1) { db1ValsToSnd[0] = 4; currentStat.Status = EnumNodeStatus.设备故障; currentStat.StatDescribe = "无绑定数据"; return(true); } string modID = ""; bool weldOPTopCap = true; if (machineSeq == 1 || machineSeq == 5) { modID = batModules[0].batModuleID; weldOPTopCap = true; } else if (machineSeq == 2 || machineSeq == 6) { weldOPTopCap = true; if (batModules.Count > 1) { modID = batModules[1].batModuleID; } } else if (machineSeq == 3 || machineSeq == 7) { modID = batModules[0].batModuleID; weldOPTopCap = false; } else if (machineSeq == 4 || machineSeq == 8) { weldOPTopCap = false; if (batModules.Count > 1) { modID = batModules[1].batModuleID; } } else { db1ValsToSnd[0] = 3; logRecorder.AddDebugLog(nodeName, "焊机ID错误,不可识别的ID," + machineSeq.ToString()); return(false); } string logInfo = string.Format("焊接模组,模组ID:{0},{1}", modID, weldOPTopCap? "上盖" : "下盖"); logRecorder.AddDebugLog(nodeName, logInfo); BatteryModuleModel batMod = batModBll.GetModel(modID); if (weldOPTopCap) { batMod.topcapWelderID = machineSeq; AddProcessRecord(modID, EnumModProcessStage.模组焊接上盖.ToString()); } else { batMod.bottomcapWelderID = machineSeq; AddProcessRecord(modID, EnumModProcessStage.模组焊接下盖.ToString()); } db1ValsToSnd[0] = 2; logRecorder.AddDebugLog(nodeName, "焊接数据绑定完成"); } } return(true); }