using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Text; using MESClassLibrary.BLL.Log; using MESClassLibrary.DAL; using MESClassLibrary.DAL.ZPPlan; using MESClassLibrary.EFModel; namespace MESClassLibrary.BLL.ZPPlan { public class ZPStepRecordBLL { BasicBLL db=new BasicBLL(); ZPStepRecordDAL da=new ZPStepRecordDAL(); public bool DelInfoByStation(string station, string barcode) { try { return da.DelInfoByStation(station, barcode); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return false; } } public bool AddInfo(tb_ZPStepRecord md) { try { string sql = @"insert into tb_ZPStepRecord (BarCode,StationID,Step,MouldNo,KeyBarCode,IsOK,CreateTime,PlanID) values (@BarCode,@StationID,@Step,@MouldNo,@KeyBarCode,@IsOK,@CreateTime,@PlanID)"; SqlParameter[] param = new SqlParameter[8]; param[0] = new SqlParameter("@BarCode", SqlDbType.VarChar); param[0].Value = md.BarCode; param[1] = new SqlParameter("@StationID", SqlDbType.VarChar); param[1].Value = md.StationID; param[2] = new SqlParameter("@Step", SqlDbType.Int); param[2].Value = md.Step; param[3] = new SqlParameter("@MouldNo", SqlDbType.VarChar); param[3].Value = md.MouldNo; param[4] = new SqlParameter("@KeyBarCode", SqlDbType.VarChar); param[4].Value = md.KeyBarCode; param[5] = new SqlParameter("@IsOK", SqlDbType.Int); param[5].Value = md.IsOK; param[6] = new SqlParameter("@CreateTime", SqlDbType.DateTime); param[6].Value = md.CreateTime; param[7] = new SqlParameter("@PlanID", SqlDbType.VarChar); param[7].Value = md.PlanID; SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); return true; //return db.AddInfo(md); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return false; } } public DataTable SearchStepByStation(string station, string PlanID,string barCode) { try { return da.SearchStepByStation(station, PlanID, barCode); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } public DataTable SearchBeforStep(string station, int step) { try { return da.SearchBeforStep(station, step); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } public bool UpdateBarCode(string stationID, string barcode, string planID) { try { return da.UpdateBarCode(stationID, barcode,planID); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return false; } } public int CompleteStep(string barcode) { try { return da.CompleteStep(barcode); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return 0; } } public int isScan(string barCode, string stationID, int step) { try { return da.isScan(barCode, stationID, step); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return 0; } } } }