void addWain(FishEntity.WainAllEntity model, Hashtable SQLString) { StringBuilder strSql = new StringBuilder( ); strSql.Append("insert into t_warnAll( "); strSql.Append("proId,state,count) "); strSql.Append("values ("); strSql.Append("@proId,@state,@count) "); MySqlParameter [] parameter = { new MySqlParameter("@proId", MySqlDbType.VarChar, 45), new MySqlParameter("@state", MySqlDbType.VarChar, 45), new MySqlParameter("@count", MySqlDbType.Int32, 4) }; parameter [0].Value = model.ProId; parameter [1].Value = model.State; parameter [2].Value = model.Count; SQLString.Add(strSql, parameter); }
//把得到的提醒事项写入表中 public DataTable getWarnInfo(int id, Dictionary <string, string> proManager) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); strSql.AppendFormat("delete from t_warnAll", id); int rows = MySqlHelper.ExecuteSql(strSql.ToString( )); FishEntity.WainAllEntity model = new FishEntity.WainAllEntity( ); DataTable table = null; Dictionary <string, string> proDic = dicPower(id, proManager); if (proDic != null && proDic.Count > 0) { #region /* * #region 采购申请单有单据时,提示审核 t_purchaseApplication:采购申请单(FormPurchaseApplication) * if ( proDic . ContainsKey ( "FormPurchaseApplication" ) ) * { * table = table12 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 采购申请单已录入有单据时,提醒录入采购合同 t_purchasecontract:采购合同(FormPurcurementContract) * if ( proDic . ContainsKey ( "FormPurcurementContract" ) ) * { * table = table13 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 采购合同录入之后,提示采购合同审核 * if ( proDic . ContainsKey ( "FormPurcurementContract" ) ) * { * table = table1 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 付款申请单有数据时,提醒付款申请单审核,一直付款申请单审核完 t_paymentrequisition:付款申请单(FormPaymentRequisition) * if ( proDic . ContainsKey ( "FormPaymentRequisition" ) ) * { * table = table2 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 销售申请单录入之后,提醒销售申请单审核 t_salesorder:销售申请单(FormSalesRequisition) * if ( proDic . ContainsKey ( "FormSalesRequisition" ) ) * { * table = table14 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 销售申请单已录入有单据时,提醒录入销售合同 t_salesrcontract:销售合同(FormSalesRContract) * if ( proDic . ContainsKey ( "FormSalesRContract" ) ) * { * table = table15 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 销售合同录入完之后,提醒销售合同审核 * if ( proDic . ContainsKey ( "FormSalesRContract" ) ) * { * table = table3 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 付款申请单审核之后,提醒提货单录入,每审核一次就要增加一个提醒,付款申请单已审核数据等于提货单数据 t_billoflading:提货单(FormBilloflading) * if ( proDic . ContainsKey ( "FormBilloflading" ) ) * { * table = table5 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 提货单录入之后,提醒磅单录入 t_poundsalone:磅单(FormOnepound) * if ( proDic . ContainsKey ( "FormOnepound" ) ) * { * table = table6 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 磅单录入之后提醒货物反馈单录入,磅单与货物反馈单一对一 t_CargoFeedbackSheet:货物反馈单(FormCargoFeedbackSheet) * if ( proDic . ContainsKey ( "FormCargoFeedbackSheet" ) ) * { * table = table7 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 货物反馈单录入之后,提醒 货物反馈单审核,一直到货物反馈单全部审核 * if ( proDic . ContainsKey ( "FormCargoFeedbackSheet" ) ) * { * table = table16 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 货物反馈单审核之后,提醒问题反馈单录入 t_theproblemsheet:问题反馈单(FormTheproblemsheet) * if ( proDic . ContainsKey ( "FormTheproblemsheet" ) ) * { * table = table8 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 问题反馈单录入之后,提醒问题反馈单审核,一直到问题反馈单单据全部审核 * if ( proDic . ContainsKey ( "FormTheproblemsheet" ) ) * { * table = table17 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 销售申请单回款时间小于当天收款记录单的时间并且收款总金额与应收总金额不符且小与应收总金额提醒录入 t_ReceiptRecord:收款记录单(FormReceiptRecord) * if ( proDic . ContainsKey ( "FormReceiptRecord" ) ) * { * table = table9 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 收款记录单录入之后,提醒收款记录单审核,一直到收款记录单单据全部审核 * if ( proDic . ContainsKey ( "FormReceiptRecord" ) ) * { * table = table18 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "0"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * #region 出库单录入之后,提醒磅单录入 t_OutboundOrder:出库单(FormOutboundOrder) * if ( proDic . ContainsKey ( "FormOutboundOrder" ) ) * { * table = table10 ( ); * if ( table != null && table . Rows . Count > 0 ) * { * model . State = "1"; * model . UserId = id . ToString ( ); * foreach ( DataRow row in table . Rows ) * { * model . ProId = row [ "programId" ] . ToString ( ); * model . Count = string . IsNullOrEmpty ( row [ "coun" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( row [ "coun" ] . ToString ( ) ); * addWain ( model ,SQLString ); * } * } * } #endregion * */ #endregion table = tableAll( ); if (table != null && table.Rows.Count > 0) { model.UserId = id.ToString( ); foreach (DataRow row in table.Rows) { model.State = row ["state"].ToString( ); model.ProId = row ["programId"].ToString( ); model.Count = string.IsNullOrEmpty(row ["coun"].ToString( )) == true ? 0 : Convert.ToInt32(row ["coun"].ToString( )); addWain(model, SQLString); } } } //从表中查询并显示 MySqlHelper.ExecuteSqlTran(SQLString); strSql = new StringBuilder( ); //查询非审核提醒 strSql.Append("select programId,sum(count) coun from ("); strSql.Append("select proId programId,sum(count) count from t_warnAll where state='1' group by proId "); strSql.Append(" union all "); strSql.AppendFormat("select distinct proId,count from t_warn a inner join t_warnAll b on a.orderNum=b.proId where state='0' and examineUserNum='{0}') a where count!=0 group by programId", id); return(MySqlHelper.Query(strSql.ToString( )).Tables [0]); }