/// <summary> /// 查询步号 /// </summary> /// <param name="TrayNO"></param> /// <param name="step"></param> /// <param name="reStr"></param> /// <returns></returns> public bool GetStep(string TrayNO, out int step, ref string reStr) { step = 0; try { if (SysCfg.SysCfgModel.MesOnlineMode) { //从MES查询 throw new NotImplementedException(); } else { //本地查询 palletModel pallet = palletDbBll.GetModel(TrayNO); if (pallet == null) { pallet = new palletModel(); pallet.stepNO = 0; pallet.palletID = TrayNO; pallet.bind = true; pallet.batchName = "空"; palletDbBll.Add(pallet); } step = pallet.stepNO; } return(true); } catch (Exception ex) { reStr = ex.ToString(); return(false); } }
public bool UploadTrayCellInfo(string TrayNo, string opNO, string jsonCells, ref string reStr) { if (CheckPalletNum(TrayNo, ref reStr) == false) { reStr = "托盘编号不正确"; return(false); } palletModel pallet = bllPallet.GetModel(TrayNo); palletModel insertModel = new palletModel(); insertModel.palletID = TrayNo; insertModel.stepNO = 1;// 装载工位1 insertModel.bind = true; if (pallet == null) { //插入 bllPallet.Add(insertModel); } else { bllPallet.Update(insertModel); //更新 } JObject jsonCellObj = JObject.Parse(jsonCells); string[] objValue = jsonCellObj.Properties().Select(item => item.Name.ToString()).ToArray(); List <batteryModel> palletBindBatterys = new List <batteryModel>(); for (int i = 0; i < objValue.Length; i++) { string batteryId = jsonCellObj[objValue[1]].ToString(); batteryModel insertBattery = new batteryModel(); insertBattery.palletBinded = true; insertBattery.batteryID = batteryId; insertBattery.channel = (i + 1); insertBattery.palletID = pallet.palletID; batteryModel battery = bllBattery.GetModel(batteryId); if (battery == null)//插入 { bllBattery.Add(insertBattery); } else//更新 { bllBattery.Update(insertBattery); } } return(true); }
private bool RecordPalletInfo(string palletID, ref string strCataName, ref string reStr) { string strCata = palletID.Substring(10, 1).ToUpper(); int productCata = 0; int step = 0; strCataName = "正极材料"; if (strCata == "C") { strCataName = "正极材料"; productCata = 1; step = 1; } else if (strCata == "A") { strCataName = "负极材料"; productCata = 3; step = 2; } else if (strCata == "S") { strCataName = "隔膜材料"; productCata = 2; step = 0; } else { if (this.db1ValsToSnd[0] != barcodeFailedStat) { logRecorder.AddDebugLog(nodeName, "不可识别的条码类别:" + this.rfidUID); } return(false); } palletBll palletDBll = new palletBll(); palletModel pallet = palletDBll.GetModel(this.rfidUID); if (pallet == null) { pallet = new palletModel(); pallet.stepNO = step; pallet.bind = true; pallet.palletID = this.rfidUID; pallet.palletCata = productCata.ToString(); if (!palletDBll.Add(pallet)) { logRecorder.AddDebugLog(nodeName, string.Format("物料{0}数据记录到数据库发生错误", this.rfidUID)); return(false); } } else { pallet.bind = true; pallet.palletCata = productCata.ToString(); pallet.stepNO = step; if (!palletDBll.Update(pallet)) { logRecorder.AddDebugLog(nodeName, string.Format("物料{0}数据记录到数据库发生错误", this.rfidUID)); return(false); } } return(true); }