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); }