/// <summary> /// 审核 /// </summary> /// <param name="oddNum"></param> /// <param name="result"></param> /// <returns></returns> public bool Exanmie(LineProductMesEntityu.LEDNewsHeaderEntity model) { Dictionary <object, object> SQLString = new Dictionary <object, object> ( ); StringBuilder strSql = new StringBuilder( ); strSql.Append("UPDATE MIKLEF SET LEF017=@LEF017 WHERE LEF001=@LEF001"); SqlParameter [] parameter = { new SqlParameter("@LEF001", SqlDbType.NVarChar, 20), new SqlParameter("@LEF017", SqlDbType.Bit) }; parameter [0].Value = model.LEF001; parameter [1].Value = model.LEF017; SQLString.Add(strSql, parameter); if (model.LEF017) { strSql = new StringBuilder( ); strSql.AppendFormat("SELECT LEH002 ANN002,LEH003 ANN003,LEH005 ANN005,LEH009 ANN009,DDA001 FROM MIKLEH A LEFT JOIN TPADEA B ON A.LEH003=B.DEA001 INNER JOIN TPADDA C ON B.DEA008=C.DDA001 WHERE LEH001='{0}'", model.LEF001); GenerateSGMRCACB.GenerateSGM(SQLString, strSql, model.LEF001, model.LEF011); } return(SqlHelper.ExecuteSqlTranDic(SQLString)); }
/// <summary> /// 总完工数量是否大于工单数量 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Exists(LineProductMesEntityu.LEDNewsHeaderEntity model) { StringBuilder strSql = new StringBuilder( ); strSql.AppendFormat("SELECT SUM(LEF014) LEF014 FROM MIKLEF WHERE LEF001!='{0}' AND LEF002='{1}' AND LEF018=0", model.LEF001, model.LEF002); DataTable table = SqlHelper.ExecuteDataTable(strSql.ToString( )); if (table == null || table.Rows.Count < 1) { return(true); } else { decimal result = string.IsNullOrEmpty(table.Rows [0] ["LEF014"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [0] ["LEF014"].ToString( )); if (result + model.LEF014 > model.LEF007) { return(false); } else { return(true); } } }
void AddHeader(Dictionary <object, object> SQLString, LineProductMesEntityu.LEDNewsHeaderEntity model) { StringBuilder strSql = new StringBuilder( ); strSql.Append("insert into MIKLEF("); strSql.Append("LEF001,LEF009,LEF010,LEF011,LEF012,LEF013,LEF015,LEF016,LEF017,LEF018,LEF019,LEF020,LEF021,LEF022,LEF023,LEF024,LEF025,LEF026,LEF027)"); strSql.Append(" values ("); strSql.Append("@LEF001,@LEF009,@LEF010,@LEF011,@LEF012,@LEF013,@LEF015,@LEF016,@LEF017,@LEF018,@LEF019,@LEF020,@LEF021,@LEF022,@LEF023,@LEF024,@LEF025,@LEF026,@LEF027)"); SqlParameter [] parameters = { new SqlParameter("@LEF001", SqlDbType.NVarChar, 20), new SqlParameter("@LEF009", SqlDbType.NVarChar, 20), new SqlParameter("@LEF010", SqlDbType.NVarChar, 20), new SqlParameter("@LEF011", SqlDbType.NVarChar, 20), new SqlParameter("@LEF012", SqlDbType.NVarChar, 20), new SqlParameter("@LEF013", SqlDbType.Date, 3), new SqlParameter("@LEF015", SqlDbType.NVarChar, 100), new SqlParameter("@LEF016", SqlDbType.NVarChar, 100), new SqlParameter("@LEF017", SqlDbType.Bit, 1), new SqlParameter("@LEF018", SqlDbType.Bit, 1), new SqlParameter("@LEF019", SqlDbType.Decimal), new SqlParameter("@LEF020", SqlDbType.Decimal), new SqlParameter("@LEF021", SqlDbType.NVarChar, 20), new SqlParameter("@LEF022", SqlDbType.NVarChar, 20), new SqlParameter("@LEF023", SqlDbType.DateTime), new SqlParameter("@LEF024", SqlDbType.DateTime), new SqlParameter("@LEF025", SqlDbType.Decimal), new SqlParameter("@LEF026", SqlDbType.Decimal), new SqlParameter("@LEF027", SqlDbType.Decimal) }; parameters [0].Value = model.LEF001; parameters [1].Value = model.LEF009; parameters [2].Value = model.LEF010; parameters [3].Value = model.LEF011; parameters [4].Value = model.LEF012; parameters [5].Value = model.LEF013; parameters [6].Value = model.LEF015; parameters [7].Value = model.LEF016; parameters [8].Value = model.LEF017; parameters [9].Value = model.LEF018; parameters [10].Value = model.LEF019; parameters [11].Value = model.LEF020; parameters [12].Value = model.LEF021; parameters [13].Value = model.LEF022; parameters [14].Value = model.LEF023; parameters [15].Value = model.LEF024; parameters [16].Value = model.LEF025; parameters [17].Value = model.LEF026; parameters [18].Value = model.LEF027; SQLString.Add(strSql, parameters); }
/// <summary> /// 审核 /// </summary> /// <param name="oddNum"></param> /// <param name="result"></param> /// <returns></returns> public bool Exanmie(LineProductMesEntityu.LEDNewsHeaderEntity model) { return(dal.Exanmie(model)); }
/// <summary> /// 编辑数据 /// </summary> /// <param name="model"></param> /// <param name="tableView"></param> /// <param name="idxList"></param> /// <returns></returns> public bool Edit(LineProductMesEntityu.LEDNewsHeaderEntity model, DataTable tableView, DataTable tableViewTwo, List <string> idxList, List <string> idxListOne) { return(dal.Edit(model, tableView, tableViewTwo, idxList, idxListOne)); }
/// <summary> /// 新增数据 /// </summary> /// <param name="model"></param> /// <param name="tableView"></param> /// <returns></returns> public bool Save(LineProductMesEntityu.LEDNewsHeaderEntity model, DataTable tableView, DataTable tableViewTwo) { return(dal.Save(model, tableView, tableViewTwo)); }
public LineProductMesEntityu.LEDNewsHeaderEntity getModel(DataRow row) { LineProductMesEntityu.LEDNewsHeaderEntity model = new LineProductMesEntityu.LEDNewsHeaderEntity( ); if (row != null) { if (row ["idx"] != null && row ["idx"].ToString( ) != "") { model.idx = int.Parse(row ["idx"].ToString( )); } if (row ["LEF001"] != null) { model.LEF001 = row ["LEF001"].ToString( ); } if (row ["LEF002"] != null) { model.LEF002 = row ["LEF002"].ToString( ); } if (row ["LEF003"] != null) { model.LEF003 = row ["LEF003"].ToString( ); } if (row ["LEF004"] != null) { model.LEF004 = row ["LEF004"].ToString( ); } if (row ["LEF005"] != null) { model.LEF005 = row ["LEF005"].ToString( ); } if (row ["LEF006"] != null) { model.LEF006 = row ["LEF006"].ToString( ); } if (row ["LEF007"] != null && row ["LEF007"].ToString( ) != "") { model.LEF007 = int.Parse(row ["LEF007"].ToString( )); } if (row ["LEF008"] != null && row ["LEF008"].ToString( ) != "") { model.LEF008 = decimal.Parse(row ["LEF008"].ToString( )); } if (row ["LEF009"] != null) { model.LEF009 = row ["LEF009"].ToString( ); } if (row ["LEF010"] != null) { model.LEF010 = row ["LEF010"].ToString( ); } if (row ["LEF011"] != null) { model.LEF011 = row ["LEF011"].ToString( ); } if (row ["LEF012"] != null) { model.LEF012 = row ["LEF012"].ToString( ); } if (row ["LEF013"] != null && row ["LEF013"].ToString( ) != "") { model.LEF013 = DateTime.Parse(row ["LEF013"].ToString( )); } if (row ["LEF014"] != null && row ["LEF014"].ToString( ) != "") { model.LEF014 = int.Parse(row ["LEF014"].ToString( )); } if (row ["LEF015"] != null) { model.LEF015 = row ["LEF015"].ToString( ); } if (row ["LEF016"] != null) { model.LEF016 = row ["LEF016"].ToString( ); } if (row ["LEF017"] != null && row ["LEF017"].ToString( ) != "") { if ((row ["LEF017"].ToString( ) == "1") || (row ["LEF017"].ToString( ).ToLower( ) == "true")) { model.LEF017 = true; } else { model.LEF017 = false; } } if (row ["LEF018"] != null && row ["LEF018"].ToString( ) != "") { if ((row ["LEF018"].ToString( ) == "1") || (row ["LEF018"].ToString( ).ToLower( ) == "true")) { model.LEF018 = true; } else { model.LEF018 = false; } } if (row ["LEF019"] != null && row ["LEF019"].ToString( ) != "") { model.LEF019 = decimal.Parse(row ["LEF019"].ToString( )); } if (row ["LEF020"] != null && row ["LEF020"].ToString( ) != "") { model.LEF020 = decimal.Parse(row ["LEF020"].ToString( )); } if (row ["LEF021"] != null && row ["LEF021"].ToString( ) != "") { model.LEF021 = row ["LEF021"].ToString( ); } if (row ["LEF022"] != null && row ["LEF022"].ToString( ) != "") { model.LEF022 = row ["LEF022"].ToString( ); } if (row ["LEF023"] != null && row ["LEF023"].ToString( ) != "") { model.LEF023 = DateTime.Parse(row ["LEF023"].ToString( )); } if (row ["LEF024"] != null && row ["LEF024"].ToString( ) != "") { model.LEF024 = DateTime.Parse(row ["LEF024"].ToString( )); } if (row ["LEF025"] != null && row ["LEF025"].ToString( ) != "") { model.LEF025 = decimal.Parse(row ["LEF025"].ToString( )); } if (row ["LEF026"] != null && row ["LEF026"].ToString( ) != "") { model.LEF026 = decimal.Parse(row ["LEF026"].ToString( )); } if (row ["LEF027"] != null && row ["LEF027"].ToString( ) != "") { model.LEF027 = decimal.Parse(row ["LEF027"].ToString( )); } } return(model); }
void EditHeader(Dictionary <object, object> SQLString, LineProductMesEntityu.LEDNewsHeaderEntity model) { StringBuilder strSql = new StringBuilder( ); strSql.Append("update MIKLEF set "); strSql.Append("LEF009=@LEF009,"); strSql.Append("LEF010=@LEF010,"); strSql.Append("LEF011=@LEF011,"); strSql.Append("LEF012=@LEF012,"); strSql.Append("LEF013=@LEF013,"); //strSql . Append ( "LEF014=@LEF014," ); strSql.Append("LEF015=@LEF015,"); strSql.Append("LEF016=@LEF016,"); strSql.Append("LEF017=@LEF017,"); strSql.Append("LEF018=@LEF018,"); strSql.Append("LEF019=@LEF019,"); strSql.Append("LEF020=@LEF020,"); strSql.Append("LEF021=@LEF021,"); strSql.Append("LEF023=@LEF023,"); strSql.Append("LEF024=@LEF024,"); strSql.Append("LEF025=@LEF025,"); strSql.Append("LEF026=@LEF026,"); strSql.Append("LEF027=@LEF027 "); strSql.Append(" where idx=@idx"); SqlParameter [] parameters = { new SqlParameter("@LEF009", SqlDbType.NVarChar, 20), new SqlParameter("@LEF010", SqlDbType.NVarChar, 20), new SqlParameter("@LEF011", SqlDbType.NVarChar, 20), new SqlParameter("@LEF012", SqlDbType.NVarChar, 20), new SqlParameter("@LEF013", SqlDbType.Date, 3), //new SqlParameter("@LEF014", SqlDbType.Int,4), new SqlParameter("@LEF015", SqlDbType.NVarChar, 100), new SqlParameter("@LEF016", SqlDbType.NVarChar, 100), new SqlParameter("@LEF017", SqlDbType.Bit, 1), new SqlParameter("@LEF018", SqlDbType.Bit, 1), new SqlParameter("@LEF019", SqlDbType.Decimal), new SqlParameter("@LEF020", SqlDbType.Decimal), new SqlParameter("@idx", SqlDbType.Int, 4), new SqlParameter("@LEF021", SqlDbType.NVarChar, 20), new SqlParameter("@LEF023", SqlDbType.DateTime), new SqlParameter("@LEF024", SqlDbType.DateTime), new SqlParameter("@LEF025", SqlDbType.Decimal), new SqlParameter("@LEF026", SqlDbType.Decimal), new SqlParameter("@LEF027", SqlDbType.Decimal) }; parameters [0].Value = model.LEF009; parameters [1].Value = model.LEF010; parameters [2].Value = model.LEF011; parameters [3].Value = model.LEF012; parameters [4].Value = model.LEF013; parameters [5].Value = model.LEF015; parameters [6].Value = model.LEF016; parameters [7].Value = model.LEF017; parameters [8].Value = model.LEF018; parameters [9].Value = model.LEF019; parameters [10].Value = model.LEF020; parameters [11].Value = model.idx; parameters [12].Value = model.LEF021; parameters [13].Value = model.LEF023; parameters [14].Value = model.LEF024; parameters [15].Value = model.LEF025; parameters [16].Value = model.LEF026; parameters [17].Value = model.LEF027; SQLString.Add(strSql, parameters); }
/// <summary> /// 编辑数据 /// </summary> /// <param name="model"></param> /// <param name="tableView"></param> /// <param name="idxList"></param> /// <returns></returns> public bool Edit(LineProductMesEntityu.LEDNewsHeaderEntity model, DataTable tableView, DataTable tableViewTwo, List <string> idxList, List <string> idxListOne) { Dictionary <object, object> SQLString = new Dictionary <object, object> ( ); EditHeader(SQLString, model); LineProductMesEntityu.LEDNewsBodyEntity modelBody = new LineProductMesEntityu.LEDNewsBodyEntity( ); modelBody.LEG001 = model.LEF001; foreach (DataRow row in tableView.Rows) { modelBody.idx = string.IsNullOrEmpty(row ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(row ["idx"].ToString( )); modelBody.LEG002 = row ["LEG002"].ToString( ); modelBody.LEG003 = row ["LEG003"].ToString( ); modelBody.LEG004 = row ["LEG004"].ToString( ); if (row ["LEG005"] == null || row ["LEG005"].ToString( ) == string.Empty) { modelBody.LEG005 = null; } else { modelBody.LEG005 = Convert.ToDateTime(row ["LEG005"].ToString( )); } if (row ["LEG006"] == null || row ["LEG006"].ToString( ) == string.Empty) { modelBody.LEG006 = null; } else { modelBody.LEG006 = Convert.ToDateTime(row ["LEG006"].ToString( )); } modelBody.LEG007 = string.IsNullOrEmpty(row ["LEG007"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG007"].ToString( )); if (row ["LEG008"] == null || row ["LEG008"].ToString( ) == string.Empty) { modelBody.LEG008 = null; } else { modelBody.LEG008 = Convert.ToDateTime(row ["LEG008"].ToString( )); } if (row ["LEG009"] == null || row ["LEG009"].ToString( ) == string.Empty) { modelBody.LEG009 = null; } else { modelBody.LEG009 = Convert.ToDateTime(row ["LEG009"].ToString( )); } modelBody.LEG010 = string.IsNullOrEmpty(row ["LEG010"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG010"].ToString( )); modelBody.LEG011 = row ["LEG011"].ToString( ); modelBody.LEG012 = row ["LEG012"].ToString( ); modelBody.LEG013 = row ["LEG013"].ToString( ); modelBody.LEG014 = string.IsNullOrEmpty(row ["LEG014"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG014"].ToString( )); modelBody.LEG015 = string.IsNullOrEmpty(row ["LEG015"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG015"].ToString( )); modelBody.LEG016 = string.IsNullOrEmpty(row ["LEG016"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG016"].ToString( )); if (row ["LEG017"] == null || row ["LEG017"].ToString( ) == string.Empty) { modelBody.LEG017 = null; } else { modelBody.LEG017 = Convert.ToDecimal(row ["LEG017"].ToString( )); } if (modelBody.idx < 1) { AddBody(SQLString, modelBody); } else { EditBody(SQLString, modelBody); } } foreach (string s in idxList) { Delete(SQLString, s); } LineProductMesEntityu.LEHNewsBodyEntity body = new LineProductMesEntityu.LEHNewsBodyEntity( ); body.LEH001 = model.LEF001; foreach (DataRow row in tableViewTwo.Rows) { body.LEH002 = row ["LEH002"].ToString( ); body.LEH003 = row ["LEH003"].ToString( ); body.LEH004 = row ["LEH004"].ToString( ); body.LEH005 = row ["LEH005"].ToString( ); body.LEH006 = row ["LEH006"].ToString( ); body.LEH007 = string.IsNullOrEmpty(row ["LEH007"].ToString( )) == true ? 0 : Convert.ToInt32(row ["LEH007"].ToString( )); body.LEH008 = string.IsNullOrEmpty(row ["LEH008"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEH008"].ToString( )); body.LEH009 = string.IsNullOrEmpty(row ["LEH009"].ToString( )) == true ? 0 : Convert.ToInt32(row ["LEH009"].ToString( )); body.idx = string.IsNullOrEmpty(row ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(row ["idx"].ToString( )); body.LEH010 = row ["LEH010"].ToString( ); if (body.idx < 1) { AddBodyOne(SQLString, body); } else { EidtBodyOne(SQLString, body); } } foreach (string s in idxListOne) { DeleteOne(SQLString, s); } return(SqlHelper.ExecuteSqlTranDic(SQLString)); }
/// <summary> /// 新增数据 /// </summary> /// <param name="model"></param> /// <param name="tableView"></param> /// <returns></returns> public bool Save(LineProductMesEntityu.LEDNewsHeaderEntity model, DataTable tableView, DataTable tableViewTwo) { Dictionary <object, object> SQLString = new Dictionary <object, object> ( ); model.LEF001 = getOddNum( ); model.LEF022 = UserInfoMation.userName; UserInfoMation.oddNum = model.LEF001; AddHeader(SQLString, model); LineProductMesEntityu.LEDNewsBodyEntity modelBody = new LineProductMesEntityu.LEDNewsBodyEntity( ); modelBody.LEG001 = model.LEF001; foreach (DataRow row in tableView.Rows) { modelBody.LEG002 = row ["LEG002"].ToString( ); modelBody.LEG003 = row ["LEG003"].ToString( ); modelBody.LEG004 = row ["LEG004"].ToString( ); if (row ["LEG005"] == null || row ["LEG005"].ToString( ) == string.Empty) { modelBody.LEG005 = null; } else { modelBody.LEG005 = Convert.ToDateTime(row ["LEG005"].ToString( )); } if (row ["LEG006"] == null || row ["LEG006"].ToString( ) == string.Empty) { modelBody.LEG006 = null; } else { modelBody.LEG006 = Convert.ToDateTime(row ["LEG006"].ToString( )); } modelBody.LEG007 = string.IsNullOrEmpty(row ["LEG007"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG007"].ToString( )); if (row ["LEG008"] == null || row ["LEG008"].ToString( ) == string.Empty) { modelBody.LEG008 = null; } else { modelBody.LEG008 = Convert.ToDateTime(row ["LEG008"].ToString( )); } if (row ["LEG009"] == null || row ["LEG009"].ToString( ) == string.Empty) { modelBody.LEG009 = null; } else { modelBody.LEG009 = Convert.ToDateTime(row ["LEG009"].ToString( )); } modelBody.LEG010 = string.IsNullOrEmpty(row ["LEG010"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG010"].ToString( )); modelBody.LEG011 = row ["LEG011"].ToString( ); modelBody.LEG012 = row ["LEG012"].ToString( ); modelBody.LEG013 = row ["LEG013"].ToString( ); modelBody.LEG014 = string.IsNullOrEmpty(row ["LEG014"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG014"].ToString( )); modelBody.LEG015 = string.IsNullOrEmpty(row ["LEG015"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG015"].ToString( )); modelBody.LEG016 = string.IsNullOrEmpty(row ["LEG016"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEG016"].ToString( )); if (row ["LEG017"] == null || row ["LEG017"].ToString( ) == string.Empty) { modelBody.LEG017 = null; } else { modelBody.LEG017 = Convert.ToDecimal(row ["LEG017"].ToString( )); } AddBody(SQLString, modelBody); } LineProductMesEntityu.LEHNewsBodyEntity body = new LineProductMesEntityu.LEHNewsBodyEntity( ); body.LEH001 = model.LEF001; foreach (DataRow row in tableViewTwo.Rows) { body.LEH002 = row ["LEH002"].ToString( ); body.LEH003 = row ["LEH003"].ToString( ); body.LEH004 = row ["LEH004"].ToString( ); body.LEH005 = row ["LEH005"].ToString( ); body.LEH006 = row ["LEH006"].ToString( ); body.LEH007 = string.IsNullOrEmpty(row ["LEH007"].ToString( )) == true ? 0 : Convert.ToInt32(row ["LEH007"].ToString( )); body.LEH008 = string.IsNullOrEmpty(row ["LEH008"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["LEH008"].ToString( )); body.LEH009 = string.IsNullOrEmpty(row ["LEH009"].ToString( )) == true ? 0 : Convert.ToInt32(row ["LEH009"].ToString( )); body.LEH010 = row ["LEH010"].ToString( ); AddBodyOne(SQLString, body); } return(SqlHelper.ExecuteSqlTranDic(SQLString)); }