/// <summary> /// 入库处理 /// </summary> /// <param name="stove">炉号</param> /// <param name="num">支数</param> /// <param name="grd">钢种</param> /// <param name="std">执行标准</param> /// <param name="spec">规格</param> /// <param name="matCode">物料编码</param> /// <param name="area">区域</param> /// <param name="loc">库位</param> /// <param name="tier">层</param> /// <param name="shift">班次</param> /// <param name="group">班组</param> /// <param name="slabwhCode">仓库编码</param> /// <returns></returns> public string PutStoreHandler(string stove, int num, string grd, string std, string spec, string matCode, string area, string loc, string tier, string shift, string group, string slabwhCode) { string result = "1"; DataTable dt = dal.GetPutData(stove, num, grd, std, spec, matCode, slabwhCode).Tables[0]; try { TransactionHelper.BeginTransaction(); if (dt == null && dt.Rows.Count == 0) { return("0"); } if (dal.AllotPutUpdateCenter(dt, slabwhCode, area, loc, tier) != num) { TransactionHelper.RollBack(); return("0"); } if (dal.AllotPutUpdateSlab(dt, slabwhCode, area, loc, tier, shift, group) != num) { TransactionHelper.RollBack(); return("0"); } DateTime time = DateTime.Now; foreach (DataRow item in dt.Rows) { Mod_TSC_ALLOT_LOG model = new Mod_TSC_ALLOT_LOG(); model.C_STL_GRD = grd; model.C_SPEC = spec; model.C_STD_CODE = std; model.C_MAT_CODE = matCode; model.C_STOVE = stove; model.C_SLAB_MAIN_ID = item["C_SLAB_MAIN_ID"].ToString(); model.N_TYPE = 2; model.D_MOD_DT = time; model.C_EMP_ID = RV.UI.UserInfo.userID; if (!logDal.Add(model)) { TransactionHelper.RollBack(); return("0"); } } TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); return("0"); } return(result); }
/// <summary> ///撤销调拨处理 /// </summary> /// <returns></returns> public string BackAllotHandler(string staID, string stove, string grd, string spec, string std, string matCode, int num) { string result = "1"; try { TransactionHelper.BeginTransaction(); DataTable billet = new DataTable(); if (dal.BackAllotGrdType(staID, stove, grd, spec, std, matCode, num, out billet) != num) { TransactionHelper.RollBack(); return("0"); } if (dal.BackAllotUpdateCenter(billet) != num) { TransactionHelper.RollBack(); return("0"); } if (billet != null && billet.Rows.Count > 0) { DateTime time = DateTime.Now; foreach (DataRow item in billet.Rows) { Mod_TSC_ALLOT_LOG model = new Mod_TSC_ALLOT_LOG(); model.C_STL_GRD = grd; model.C_SPEC = spec; model.C_STD_CODE = std; model.C_MAT_CODE = matCode; model.C_STOVE = stove; model.C_SLAB_MAIN_ID = item["C_ID"].ToString(); model.C_STA_ID = staID; model.N_TYPE = 3; model.D_MOD_DT = time; model.C_EMP_ID = RV.UI.UserInfo.userID; if (!logDal.Add(model)) { TransactionHelper.RollBack(); return("0"); } } } TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); return("0"); } return(result); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TSC_ALLOT_LOG model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TSC_ALLOT_LOG("); strSql.Append("C_SLAB_MAIN_ID,N_TYPE,D_MOD_DT,C_EMP_ID,C_STA_ID,C_SLABWH_CODE,C_SLABWH_AREA_CODE,C_SLABWH_LOC_CODE,C_SLABWH_TIER_CODE,C_STL_GRD,C_SPEC,C_STD_CODE,C_MAT_CODE,C_MAT_NAME,N_LEN,C_STOVE)"); strSql.Append(" values ("); strSql.Append(":C_SLAB_MAIN_ID,:N_TYPE,:D_MOD_DT,:C_EMP_ID,:C_STA_ID,:C_SLABWH_CODE,:C_SLABWH_AREA_CODE,:C_SLABWH_LOC_CODE,:C_SLABWH_TIER_CODE,:C_STL_GRD,:C_SPEC,:C_STD_CODE,:C_MAT_CODE,:C_MAT_NAME,:N_LEN,:C_STOVE)"); OracleParameter[] parameters = { new OracleParameter(":C_SLAB_MAIN_ID", OracleDbType.Varchar2, 100), new OracleParameter(":N_TYPE", OracleDbType.Decimal, 4), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_STA_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_AREA_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_LOC_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_TIER_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_STL_GRD", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC", OracleDbType.Varchar2, 100), new OracleParameter(":C_STD_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":N_LEN", OracleDbType.Decimal, 5), new OracleParameter(":C_STOVE", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_SLAB_MAIN_ID; parameters[1].Value = model.N_TYPE; parameters[2].Value = model.D_MOD_DT; parameters[3].Value = model.C_EMP_ID; parameters[4].Value = model.C_STA_ID; parameters[5].Value = model.C_SLABWH_CODE; parameters[6].Value = model.C_SLABWH_AREA_CODE; parameters[7].Value = model.C_SLABWH_LOC_CODE; parameters[8].Value = model.C_SLABWH_TIER_CODE; parameters[9].Value = model.C_STL_GRD; parameters[10].Value = model.C_SPEC; parameters[11].Value = model.C_STD_CODE; parameters[12].Value = model.C_MAT_CODE; parameters[13].Value = model.C_MAT_NAME; parameters[14].Value = model.N_LEN; parameters[15].Value = model.C_STOVE; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TSC_ALLOT_LOG DataRowToModel(DataRow row) { Mod_TSC_ALLOT_LOG model = new Mod_TSC_ALLOT_LOG(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_SLAB_MAIN_ID"] != null) { model.C_SLAB_MAIN_ID = row["C_SLAB_MAIN_ID"].ToString(); } if (row["N_TYPE"] != null && row["N_TYPE"].ToString() != "") { model.N_TYPE = decimal.Parse(row["N_TYPE"].ToString()); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["C_STA_ID"] != null) { model.C_STA_ID = row["C_STA_ID"].ToString(); } if (row["C_SLABWH_CODE"] != null) { model.C_SLABWH_CODE = row["C_SLABWH_CODE"].ToString(); } if (row["C_SLABWH_AREA_CODE"] != null) { model.C_SLABWH_AREA_CODE = row["C_SLABWH_AREA_CODE"].ToString(); } if (row["C_SLABWH_LOC_CODE"] != null) { model.C_SLABWH_LOC_CODE = row["C_SLABWH_LOC_CODE"].ToString(); } if (row["C_SLABWH_TIER_CODE"] != null) { model.C_SLABWH_TIER_CODE = row["C_SLABWH_TIER_CODE"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TSC_ALLOT_LOG GetModel(string C_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_SLAB_MAIN_ID,N_TYPE,D_MOD_DT,C_EMP_ID,C_STA_ID,C_SLABWH_CODE,C_SLABWH_AREA_CODE,C_SLABWH_LOC_CODE,C_SLABWH_TIER_CODE from TSC_ALLOT_LOG "); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_ID; Mod_TSC_ALLOT_LOG model = new Mod_TSC_ALLOT_LOG(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TSC_ALLOT_LOG model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TSC_ALLOT_LOG set "); strSql.Append("C_SLAB_MAIN_ID=:C_SLAB_MAIN_ID,"); strSql.Append("N_TYPE=:N_TYPE,"); strSql.Append("D_MOD_DT=:D_MOD_DT,"); strSql.Append("C_EMP_ID=:C_EMP_ID,"); strSql.Append("C_STA_ID=:C_STA_ID,"); strSql.Append("C_SLABWH_CODE=:C_SLABWH_CODE,"); strSql.Append("C_SLABWH_AREA_CODE=:C_SLABWH_AREA_CODE,"); strSql.Append("C_SLABWH_LOC_CODE=:C_SLABWH_LOC_CODE,"); strSql.Append("C_SLABWH_TIER_CODE=:C_SLABWH_TIER_CODE"); strSql.Append("C_STL_GRD=:C_STL_GRD,"); strSql.Append("C_SPEC=:C_SPEC,"); strSql.Append("C_STD_CODE=:C_STD_CODE,"); strSql.Append("C_MAT_CODE=:C_MAT_CODE,"); strSql.Append("C_MAT_NAME=:C_MAT_NAME,"); strSql.Append("N_LEN=:N_LEN"); strSql.Append("C_STOVE=:C_STOVE"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_SLAB_MAIN_ID", OracleDbType.Varchar2, 100), new OracleParameter(":N_TYPE", OracleDbType.Decimal, 4), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_STA_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_AREA_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_LOC_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SLABWH_TIER_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_STL_GRD", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC", OracleDbType.Varchar2, 100), new OracleParameter(":C_STD_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":N_LEN", OracleDbType.Decimal, 5), new OracleParameter(":C_STOVE", OracleDbType.Varchar2, 100), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_SLAB_MAIN_ID; parameters[1].Value = model.N_TYPE; parameters[2].Value = model.D_MOD_DT; parameters[3].Value = model.C_EMP_ID; parameters[4].Value = model.C_STA_ID; parameters[5].Value = model.C_SLABWH_CODE; parameters[6].Value = model.C_SLABWH_AREA_CODE; parameters[7].Value = model.C_SLABWH_LOC_CODE; parameters[8].Value = model.C_SLABWH_TIER_CODE; parameters[9].Value = model.C_STL_GRD; parameters[10].Value = model.C_SPEC; parameters[11].Value = model.C_STD_CODE; parameters[12].Value = model.C_MAT_CODE; parameters[13].Value = model.C_MAT_NAME; parameters[14].Value = model.N_LEN; parameters[15].Value = model.C_STOVE; parameters[16].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TSC_ALLOT_LOG model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TSC_ALLOT_LOG model) { return(dal.Add(model)); }