/// <summary> /// 获取未完工数量 /// </summary> /// <param name="model"></param> /// <returns></returns> public DataTable getTableOtherSur(LineProductMesEntityu.PaintNewspaperBodyOneEntity model) { StringBuilder strSql = new StringBuilder( ); //strSql . AppendFormat ( "SELECT PAO002,PAO003,PAO013,PAO005-SUM(PAO012) PAO FROM MIKPAO WHERE PAO001!='{0}' AND PAO002='{1}' AND PAO003='{2}' GROUP BY PAO002,PAO003,PAO013,PAO005" ,model . PAO001 ,model . PAO002 ,model . PAO003 ); strSql.AppendFormat("SELECT PAO002,PAO003,PAO005-SUM(PAO012) PAO FROM MIKPAO WHERE PAO001!='{0}' AND PAO002='{1}' AND PAO003='{2}' GROUP BY PAO002,PAO003,PAO005", model.PAO001, model.PAO002, model.PAO003); return(SqlHelper.ExecuteDataTable(strSql.ToString( ))); }
void EditBodyOne(Dictionary <object, object> SQLString, LineProductMesEntityu.PaintNewspaperBodyOneEntity model) { StringBuilder strSql = new StringBuilder( ); strSql.Append("update MIKPAO set "); strSql.Append("PAO002=@PAO002,"); strSql.Append("PAO003=@PAO003,"); strSql.Append("PAO004=@PAO004,"); strSql.Append("PAO005=@PAO005,"); strSql.Append("PAO006=@PAO006,"); strSql.Append("PAO007=@PAO007,"); strSql.Append("PAO008=@PAO008,"); strSql.Append("PAO009=@PAO009,"); strSql.Append("PAO010=@PAO010,"); strSql.Append("PAO011=@PAO011,"); strSql.Append("PAO012=@PAO012,"); strSql.Append("PAO013=@PAO013,"); strSql.Append("PAO014=@PAO014 "); strSql.Append(" where idx=@idx"); SqlParameter [] parameters = { new SqlParameter("@PAO003", SqlDbType.NVarChar, 20), new SqlParameter("@PAO004", SqlDbType.NVarChar, 50), new SqlParameter("@PAO005", SqlDbType.Int, 4), new SqlParameter("@PAO006", SqlDbType.Decimal, 9), new SqlParameter("@PAO007", SqlDbType.NVarChar, 5), new SqlParameter("@PAO008", SqlDbType.NVarChar, 20), new SqlParameter("@PAO009", SqlDbType.NVarChar, 20), new SqlParameter("@PAO010", SqlDbType.NVarChar, 20), new SqlParameter("@PAO011", SqlDbType.Decimal, 9), new SqlParameter("@PAO012", SqlDbType.Int, 4), new SqlParameter("@idx", SqlDbType.Int, 4), new SqlParameter("@PAO002", SqlDbType.NVarChar, 20), new SqlParameter("@PAO013", SqlDbType.NVarChar, 10), new SqlParameter("@PAO014", SqlDbType.NVarChar, 100) }; parameters [0].Value = model.PAO003; parameters [1].Value = model.PAO004; parameters [2].Value = model.PAO005; parameters [3].Value = model.PAO006; parameters [4].Value = model.PAO007; parameters [5].Value = model.PAO008; parameters [6].Value = model.PAO009; parameters [7].Value = model.PAO010; parameters [8].Value = model.PAO011; parameters [9].Value = model.PAO012; parameters [10].Value = model.idx; parameters [11].Value = model.PAO002; parameters [12].Value = model.PAO013; parameters [13].Value = model.PAO014; SQLString.Add(strSql, parameters); }
void AddBodyOne(Dictionary <object, object> SQLString, LineProductMesEntityu.PaintNewspaperBodyOneEntity model) { StringBuilder strSql = new StringBuilder( ); strSql.Append("insert into MIKPAO("); strSql.Append("PAO001,PAO002,PAO003,PAO004,PAO005,PAO006,PAO007,PAO008,PAO009,PAO010,PAO011,PAO012,PAO013,PAO014)"); strSql.Append(" values ("); strSql.Append("@PAO001,@PAO002,@PAO003,@PAO004,@PAO005,@PAO006,@PAO007,@PAO008,@PAO009,@PAO010,@PAO011,@PAO012,@PAO013,@PAO014)"); SqlParameter [] parameters = { new SqlParameter("@PAO001", SqlDbType.NVarChar, 20), new SqlParameter("@PAO002", SqlDbType.NVarChar, 20), new SqlParameter("@PAO003", SqlDbType.NVarChar, 20), new SqlParameter("@PAO004", SqlDbType.NVarChar, 50), new SqlParameter("@PAO005", SqlDbType.Int, 4), new SqlParameter("@PAO006", SqlDbType.Decimal, 9), new SqlParameter("@PAO007", SqlDbType.NVarChar, 5), new SqlParameter("@PAO008", SqlDbType.NVarChar, 20), new SqlParameter("@PAO009", SqlDbType.NVarChar, 20), new SqlParameter("@PAO010", SqlDbType.NVarChar, 20), new SqlParameter("@PAO011", SqlDbType.Decimal, 9), new SqlParameter("@PAO012", SqlDbType.Int, 4), new SqlParameter("@PAO013", SqlDbType.NVarChar, 10), new SqlParameter("@PAO014", SqlDbType.NVarChar, 100) }; parameters [0].Value = model.PAO001; parameters [1].Value = model.PAO002; parameters [2].Value = model.PAO003; parameters [3].Value = model.PAO004; parameters [4].Value = model.PAO005; parameters [5].Value = model.PAO006; parameters [6].Value = model.PAO007; parameters [7].Value = model.PAO008; parameters [8].Value = model.PAO009; parameters [9].Value = model.PAO010; parameters [10].Value = model.PAO011; parameters [11].Value = model.PAO012; parameters [12].Value = model.PAO013; parameters [13].Value = model.PAO014; SQLString.Add(strSql, parameters); }
/// <summary> /// 获取未完工数量 /// </summary> /// <param name="model"></param> /// <returns></returns> public DataTable getTableOtherSur(LineProductMesEntityu.PaintNewspaperBodyOneEntity model) { return(dal.getTableOtherSur(model)); }
/// <summary> /// 编辑数据 /// </summary> /// <param name="model"></param> /// <param name="tableViewOne"></param> /// <param name="tableViewTwo"></param> /// <param name="idxListOne"></param> /// <param name="idxListTwo"></param> /// <returns></returns> public bool Edit(LineProductMesEntityu.PaintNewspaperHeaderEntity model, DataTable tableViewOne, DataTable tableViewTwo, List <string> idxListOne, List <string> idxListTwo) { Dictionary <object, object> SQLString = new Dictionary <object, object> ( ); //model . PAN001 = getOddNum ( ); //UserInfoMation . oddNum = model . PAN001; EditHeader(SQLString, model); LineProductMesEntityu.PaintNewspaperBodyOneEntity modelOne = new LineProductMesEntityu.PaintNewspaperBodyOneEntity( ); modelOne.PAO001 = model.PAN001; foreach (DataRow row in tableViewOne.Rows) { modelOne.idx = string.IsNullOrEmpty(row ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(row ["idx"].ToString( )); modelOne.PAO002 = row ["PAO002"].ToString( ); modelOne.PAO003 = row ["PAO003"].ToString( ); modelOne.PAO004 = row ["PAO004"].ToString( ); modelOne.PAO005 = string.IsNullOrEmpty(row ["PAO005"].ToString( )) == true ? 0 : Convert.ToInt32(row ["PAO005"].ToString( )); modelOne.PAO006 = string.IsNullOrEmpty(row ["PAO006"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["PAO006"].ToString( )); modelOne.PAO007 = row ["PAO007"].ToString( ); modelOne.PAO008 = row ["PAO008"].ToString( ); modelOne.PAO009 = row ["PAO009"].ToString( ); modelOne.PAO010 = row ["PAO010"].ToString( ); modelOne.PAO011 = string.IsNullOrEmpty(row ["PAO011"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["PAO011"].ToString( )); modelOne.PAO012 = string.IsNullOrEmpty(row ["PAO012"].ToString( )) == true ? 0 : Convert.ToInt32(row ["PAO012"].ToString( )); modelOne.PAO013 = row ["PAO013"].ToString( ); modelOne.PAO014 = row ["PAO014"].ToString( ); if (modelOne.idx < 1) { AddBodyOne(SQLString, modelOne); } else { EditBodyOne(SQLString, modelOne); } } foreach (string s in idxListOne) { DeleteOne(SQLString, s); } LineProductMesEntityu.PaintNewspaperBodyTwoEntity modelTwo = new LineProductMesEntityu.PaintNewspaperBodyTwoEntity( ); modelTwo.PAP001 = model.PAN001; foreach (DataRow row in tableViewTwo.Rows) { modelTwo.idx = string.IsNullOrEmpty(row ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(row ["idx"].ToString( )); modelTwo.PPA002 = row ["PPA002"].ToString( ); modelTwo.PPA003 = row ["PPA003"].ToString( ); modelTwo.PPA004 = row ["PPA004"].ToString( ); if (row ["PPA005"] == null || row ["PPA005"].ToString( ) == string.Empty) { modelTwo.PPA005 = null; } else { modelTwo.PPA005 = Convert.ToDateTime(row ["PPA005"].ToString( )); } if (row ["PPA006"] == null || row ["PPA006"].ToString( ) == string.Empty) { modelTwo.PPA006 = null; } else { modelTwo.PPA006 = Convert.ToDateTime(row ["PPA006"].ToString( )); } if (row ["PPA007"] == null || row ["PPA007"].ToString( ) == string.Empty) { modelTwo.PPA007 = null; } else { modelTwo.PPA007 = Convert.ToDateTime(row ["PPA007"].ToString( )); } if (row ["PPA008"] == null || row ["PPA008"].ToString( ) == string.Empty) { modelTwo.PPA008 = null; } else { modelTwo.PPA008 = Convert.ToDateTime(row ["PPA008"].ToString( )); } modelTwo.PPA009 = string.IsNullOrEmpty(row ["PPA009"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["PPA009"].ToString( )); modelTwo.PPA010 = row ["PPA010"].ToString( ); modelTwo.PPA011 = row ["PPA011"].ToString( ); modelTwo.PPA012 = string.IsNullOrEmpty(row ["PPA012"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["PPA012"].ToString( )); modelTwo.PPA013 = string.IsNullOrEmpty(row ["PPA013"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["PPA013"].ToString( )); modelTwo.PPA014 = string.IsNullOrEmpty(row ["PPA014"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["PPA014"].ToString( )); modelTwo.PPA015 = row ["PPA015"].ToString( ); if (row ["PPA016"] == null || row ["PPA016"].ToString( ) == string.Empty) { modelTwo.PPA016 = null; } else { modelTwo.PPA016 = Convert.ToDecimal(row ["PPA016"].ToString( )); } if (modelTwo.idx < 1) { AddBodyTwo(SQLString, modelTwo); } else { EditBodyTwo(SQLString, modelTwo); } } foreach (string s in idxListTwo) { DeleteTwo(SQLString, s); } return(SqlHelper.ExecuteSqlTranDic(SQLString)); }