Example #1
0
 /// <summary>
 /// 更新步号
 /// </summary>
 /// <param name="StepNow"></param>
 /// <param name="TrayNO"></param>
 /// <param name="reStr"></param>
 /// <returns></returns>
 public bool UpdateStep(int StepNow, string TrayNO, ref string reStr)
 {
     try
     {
         //先更新本地步号
         palletModel pallet = palletDbBll.GetModel(TrayNO);
         if (pallet == null)
         {
             pallet           = new palletModel();
             pallet.stepNO    = StepNow;
             pallet.palletID  = TrayNO;
             pallet.bind      = true;
             pallet.batchName = "空";
             palletDbBll.Add(pallet);
         }
         else
         {
             pallet.stepNO = StepNow;
             palletDbBll.Update(pallet);
         }
         //再更新MES步号
         if (SysCfg.SysCfgModel.MesOnlineMode)
         {
             throw new NotImplementedException();
         }
         return(true);
     }
     catch (Exception ex)
     {
         reStr = ex.ToString();
         return(false);
     }
 }
Example #2
0
 public bool GetTrayCellLotNO(string trayNo, out string batchName, ref string reStr)
 {
     batchName = "空";
     try
     {
         if (SysCfg.SysCfgModel.MesOnlineMode)
         {
             throw new NotFiniteNumberException();
         }
         else
         {
             palletModel pallet = palletDbBll.GetModel(trayNo);
             if (pallet != null)
             {
                 batchName = pallet.batchName;
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         reStr = ex.ToString();
         return(false);
     }
 }
Example #3
0
 /// <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);
     }
 }
Example #4
0
        public void GetPalletProcessInfo(Pallet pallet)
        {
            palletModel model = bllPallet.GetModel(pallet.PalletID);

            if (model == null)
            {
                this.View.ShowMessage("未找到该编号的托盘", "信息提示");
                return;
            }
            processStepModel stepModel = bllProcessStep.GetModelByStepNo(model.stepNO);

            if (stepModel == null)
            {
                this.View.ShowMessage("未找到编号为" + model.stepNO.ToString() + "托盘的工序信息", "信息提示");
                return;
            }
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("PalletID"));
            dt.Columns.Add(new DataColumn("StepNo"));
            dt.Columns.Add(new DataColumn("ProcessName"));

            DataRow row = dt.NewRow();

            row["PalletID"]    = model.palletID;
            row["StepNo"]      = stepModel.stepNO.ToString();
            row["ProcessName"] = stepModel.processStepName;
            dt.Rows.Add(row);
            this.View.ShowProcessInfo(dt);
        }
Example #5
0
 /// <summary>
 /// 解绑托盘
 /// </summary>
 /// <param name="TrayNo"></param>
 /// <param name="reStr"></param>
 /// <returns></returns>
 public bool UnbindTrayCell(string TrayNO, ref string reStr)
 {
     try
     {
         //先本地解绑
         palletModel pallet = palletDbBll.GetModel(TrayNO);
         if (pallet != null)
         {
             pallet.bind   = false;
             pallet.stepNO = 0;
             palletDbBll.Update(pallet);
         }
         //再解绑MES托盘
         if (SysCfg.SysCfgModel.MesOnlineMode)
         {
             throw new NotImplementedException();
         }
         return(true);
     }
     catch (Exception ex)
     {
         reStr = ex.ToString();
         return(false);
     }
 }
Example #6
0
        public bool UpdateStep(int StepNow, string TrayNo, ref string reStr)
        {
            if (CheckPalletNum(TrayNo, ref reStr) == false)
            {
                return(false);
            }
            palletModel pallet = bllPallet.GetModel(TrayNo);

            if (pallet == null)
            {
                reStr = "托盘不存在!";
                return(false);
            }
            List <batteryModel> palletBindBatterys = bllBattery.GetModelList("palletID = '" + TrayNo + "'");

            if (palletBindBatterys == null || palletBindBatterys.Count == 0)
            {
                reStr = "此托盘从未绑定过电芯!";
                return(false);
            }
            pallet.stepNO = StepNow;
            bllPallet.Update(pallet);
            reStr = "更新工步号成功!";
            return(true);
        }
Example #7
0
        public void GetPalletInfo(Pallet pallet)
        {
            palletModel model = bllPallet.GetModel(pallet.PalletID);

            if (model == null)
            {
                this.View.ShowMessage("未找到该编号的托盘", "信息提示");
                return;
            }
            this.View.ShowPalletInfo(model);
        }
Example #8
0
 /// <summary>
 /// 显示托盘信息
 /// </summary>
 public void ShowPalletInfo(palletModel model)
 {
     if (model == null)
     {
         return;
     }
     ClearPalletInfo();
     this.txtEdit_PalletID2.Text  = model.palletID.ToString();
     this.txtEdit_StepN.Text      = model.stepNO.ToString();
     this.txtEdit_palletCata.Text = model.palletCata.ToString();
     this.txtEdit_bind.Text       = model.bind.ToString();
     this.txtEdit_BatchName.Text  = model.batchName.ToString();
 }
Example #9
0
        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);
        }
Example #10
0
        public bool GetStep(string TrayNO, out int step, ref string reStr)
        {
            step = 0;
            if (CheckPalletNum(TrayNO, ref reStr) == false)
            {
                return(false);
            }
            palletModel pallet = bllPallet.GetModel(TrayNO);

            if (pallet == null)
            {
                reStr = "不存在此托盘信息!";

                return(false);
            }
            step  = pallet.stepNO;
            reStr = "获取工步号成功!";
            return(true);
        }
Example #11
0
        public bool GetTrayCellLotNO(string TrayNo, out string lot, ref string reStr)
        {
            lot = "";
            palletModel pallet = bllPallet.GetModel(TrayNo);

            if (pallet == null)
            {
                reStr = "托盘不存在!";
                return(false);
            }
            //List<batteryModel> palletBindBatterys = bllBattery.GetModelList("palletID = '" + TrayNo + "'");
            //if (palletBindBatterys == null || palletBindBatterys.Count == 0)
            //{
            //    reStr = "此托盘从未绑定过电芯!";
            //    return false;
            //}
            lot   = pallet.batchName;
            reStr = "获取托盘电芯批次号成功!";
            return(true);
        }
Example #12
0
        public bool GetTrayBindingCell(string TrayNo, out string jsonCells, ref string reStr)
        {
            jsonCells = "";
            if (CheckPalletNum(TrayNo, ref reStr) == false)
            {
                return(false);
            }

            palletModel pallet = bllPallet.GetModel(TrayNo);

            if (pallet == null)
            {
                reStr = "不存在次托盘!";
                return(false);
            }
            List <batteryModel> palletBindBatterys = bllBattery.GetModelList("palletID = '" + TrayNo + "'");

            if (palletBindBatterys == null || palletBindBatterys.Count == 0)
            {
                reStr = "绑定电芯数据为空!";
                return(false);
            }

            JObject jsonBatteryObj = new JObject();

            foreach (batteryModel battery in palletBindBatterys)
            {
                string cellName = "Cell" + battery.channel.ToString().Trim();
                jsonBatteryObj[cellName] = battery.batteryID;
            }

            string jsonStr = jsonBatteryObj.ToString();

            jsonCells = jsonStr;

            reStr = "获取绑定信息成功!";
            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);
        }