bool Save( ) { barCodeDao.Bll.barCodeReportBll _bll = new barCodeDao.Bll.barCodeReportBll( ); barCodeEntity.barCodeReportEntity _mode = new barCodeEntity.barCodeReportEntity( ); _mode.BAR001 = texProduct.Tag.ToString( ).Trim( ); _mode.BAR002 = texProduct.Text; _mode.BAR003 = texType.Text; _mode.BAR004 = texSpec.Text; //_mode . BAR005 = texPack . Text; _mode.BAR005 = string.Empty; _mode.BAR006 = "RHT"; _mode.BAR007 = comboBox1.Text; _mode.BAR012 = "F"; _mode.BAR013 = "F"; _mode.BAR008 = "RHT" + comboBox1.Text + "-" + textBox2.Text; _mode.BAR018 = textBox2.Text; _mode.BAR023 = Convert.ToInt32(textBox1.Text); bool result = false; if (_mode != null) { result = _bll.Save(_mode, Convert.ToInt64(textBox1.Text), textBox2.Text); } return(result); }
private void button4_Click(object sender, EventArgs e) { ProductChoise chPro = new ProductChoise( ); chPro.StartPosition = FormStartPosition.CenterScreen; DialogResult result = chPro.ShowDialog( ); if (result == System.Windows.Forms.DialogResult.OK) { _model = chPro.SelectPerson; if (_model != null) { texbar001.Text = _model.BAR001; texbar002.Text = _model.BAR002; } } }
public FormEdit(barCodeEntity.barCodeReportEntity _model) { InitializeComponent( ); cmbSao.Items.Add("F"); cmbSao.Items.Add("T"); textBox1.Text = _model.BAR009; textBox4.Text = _model.BAR019.ToString( ); textBox5.Text = _model.BAR020.ToString( ); dtTime.Text = _model.BAR024.ToString( ); richBatch.Text = _model.BAR025; this.saoMiao = _model.BAR016; richTextBox1.Text = _model.BAR017; this._model.BAR011 = _model.BAR011; this._model = _model; }
void numOf( ) { barCodeDao.Bll.barCodeReportBll _bll = new barCodeDao.Bll.barCodeReportBll( ); barCodeEntity.barCodeReportEntity _mode = new barCodeEntity.barCodeReportEntity( ); _mode.BAR007 = comboBox1.Text; DateTime dt = _bll.GetTime( ); string x = string.Empty; x = texProduct.Tag.ToString( ).Substring(texProduct.Tag.ToString( ).Length - 4); x = x + " "; foreach (char c in _mode.BAR007) { if (c >= 48 && c <= 57) { x = x + c.ToString( ); } else if (c.ToString( ).Equals("-")) { x = x + " " + 0.ToString( ); } else if (c >= 65 && c <= 90) { x = x + (( int )c).ToString( ); } } _mode.BAR004 = texSpec.Text; string [] str = _mode.BAR004.Split('*'); if (str.Length > 2) { x = x + " "; for (int i = 0; i < 2; i++) { foreach (char c in str[i]) { if (c >= 48 && c <= 57) { x = x + c.ToString( ); } } } } textBox2.Text = x; }
protected override int Query( ) { string strWhere = "1=1"; barCodeEntity.barCodeReportEntity _model = new barCodeEntity.barCodeReportEntity( ); if (!string.IsNullOrEmpty(texbar001.Text)) { _model.BAR001 = texbar001.Text; strWhere += " AND BAR001='" + _model.BAR001 + "'"; } if (!string.IsNullOrEmpty(texbar002.Text)) { _model.BAR002 = texbar002.Text; strWhere += " AND BAR002='" + _model.BAR002 + "'"; } if (!string.IsNullOrEmpty(combar009.Text)) { _model.BAR009 = combar009.Text; strWhere += " AND BAR009='" + _model.BAR009 + "'"; } if (!string.IsNullOrEmpty(combar010.Text)) { _model.BAR010 = combar010.Text; strWhere += " AND BAR010='" + _model.BAR010 + "'"; } if (!string.IsNullOrEmpty(combar011.Text)) { _model.BAR011 = combar011.Text; strWhere += " AND BAR011='" + _model.BAR011 + "'"; } barCodeDao.Bll.barCodeReportBll _bll = new barCodeDao.Bll.barCodeReportBll( ); tableQuery = _bll.GetDataTable(strWhere); tableQuery.Columns.Add("check", typeof(System.Boolean)); gridControl1.DataSource = tableQuery; idxList.Clear( ); DataTable countDt = _bll.GetDataTableCount(strWhere); assignMent(countDt); BAR002.SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Custom, "选中:" + 0.ToString( )); return(0); }
private void button2_Click(object sender, EventArgs e) { CheckProduct chec = new CheckProduct( ); chec.StartPosition = FormStartPosition.CenterScreen; DialogResult result = chec.ShowDialog( ); if (result == System.Windows.Forms.DialogResult.OK) { barCodeEntity.barCodeReportEntity _model = chec.SelectBarcode; if (_model != null) { texProduct.Tag = _model.BAR001; texProduct.Text = _model.BAR002; texType.Text = _model.BAR003; texSpec.Text = _model.BAR004; //texPack . Text = _model . BAR005; } } }
/// <summary> /// 回写入库单号及标志 /// </summary> /// <param name="_modelTre"></param> /// <param name="strSql"></param> /// <returns></returns> public string EditBAR(barCodeEntity.barCodeReportEntity _modelTre, StringBuilder strSql) { //string idxStr = ""; //foreach ( int id in idxList ) //{ // if ( idxStr == "" ) // idxStr = id . ToString ( ); // else // idxStr += "," + id . ToString ( ); //} strSql = new StringBuilder( ); strSql.Append("UPDATE HDTBAR SET "); strSql.AppendFormat("BAR011='{0}',", _modelTre.BAR011); strSql.AppendFormat("BAR012='{0}',", "T"); strSql.AppendFormat("BAR014='{0}',", DateTime.Now.ToString("yyyy-MM-dd")); strSql.AppendFormat("BAR019=BAR019+'{0}',", _modelTre.BAR019); strSql.AppendFormat("BAR023='{0}' ", _modelTre.BAR023); strSql.Append(" WHERE BAR008='" + _modelTre.BAR008 + "'"); return(strSql.ToString( )); }
/// <summary> /// 编辑 /// </summary> /// <param name="idxList"></param> /// <param name="stateOfLibrary">出库</param> /// <param name="stateOfStorage">入库</param> /// <param name="remark">备注</param> /// <returns></returns> public bool Edit(barCodeEntity.barCodeReportEntity _model) { return(_dao.Edit(_model)); }
/// <summary> /// 增加记录 /// </summary> /// <param name="_modelList"></param> /// <returns></returns> public bool Save(barCodeEntity.barCodeReportEntity _model, long num, string serialNum) { return(_dao.Save(_model, num, serialNum)); }
/// <summary> /// 获取数据集 /// </summary> /// <param name="row"></param> /// <returns></returns> public barCodeEntity.barCodeReportEntity GetModel(DataRow row) { barCodeEntity.barCodeReportEntity _model = new barCodeEntity.barCodeReportEntity( ); if (row != null) { if (row ["idx"] != null && row ["idx"].ToString( ) != "") { _model.idx = int.Parse(row ["idx"].ToString( )); } if (row ["BAR001"] != null && row ["BAR001"].ToString( ) != "") { _model.BAR001 = row ["BAR001"].ToString( ); } if (row ["BAR002"] != null && row ["BAR002"].ToString( ) != "") { _model.BAR002 = row ["BAR002"].ToString( ); } if (row ["BAR003"] != null && row ["BAR003"].ToString( ) != "") { _model.BAR003 = row ["BAR003"].ToString( ); } if (row ["BAR004"] != null && row ["BAR004"].ToString( ) != "") { _model.BAR004 = row ["BAR004"].ToString( ); } if (row ["BAR005"] != null && row ["BAR005"].ToString( ) != "") { _model.BAR005 = row ["BAR005"].ToString( ); } if (row ["BAR006"] != null && row ["BAR006"].ToString( ) != "") { _model.BAR006 = row ["BAR006"].ToString( ); } if (row ["BAR007"] != null && row ["BAR007"].ToString( ) != "") { _model.BAR007 = row ["BAR007"].ToString( ); } if (row ["BAR008"] != null && row ["BAR008"].ToString( ) != "") { _model.BAR008 = row ["BAR008"].ToString( ); } if (row ["BAR009"] != null && row ["BAR009"].ToString( ) != "") { _model.BAR009 = row ["BAR009"].ToString( ); } if (row ["BAR010"] != null && row ["BAR010"].ToString( ) != "") { _model.BAR010 = row ["BAR010"].ToString( ); } if (row ["BAR011"] != null && row ["BAR011"].ToString( ) != "") { _model.BAR011 = row ["BAR011"].ToString( ); } if (row ["BAR012"] != null && row ["BAR012"].ToString( ) != "") { _model.BAR012 = row ["BAR012"].ToString( ); } if (row ["BAR013"] != null && row ["BAR013"].ToString( ) != "") { _model.BAR013 = row ["BAR013"].ToString( ); } if (row ["BAR014"] != null && row ["BAR014"].ToString( ) != "") { _model.BAR014 = DateTime.Parse(row ["BAR014"].ToString( )); } if (row ["BAR015"] != null && row ["BAR015"].ToString( ) != "") { _model.BAR015 = DateTime.Parse(row ["BAR015"].ToString( )); } if (row ["BAR016"] != null && row ["BAR016"].ToString( ) != "") { _model.BAR016 = row ["BAR016"].ToString( ); } if (row ["BAR017"] != null && row ["BAR017"].ToString( ) != "") { _model.BAR017 = row ["BAR017"].ToString( ); } } return(_model); }
/// <summary> /// 生成入库记录 /// </summary> /// <param name="idxList"></param> /// <param name="documentType"></param> /// <returns></returns> public bool InsertToLibrary(List <int> idxList, string rklx, DataTable table) { if (idxList.Count < 1) { return(false); } StringBuilder strSql = new StringBuilder( ); ArrayList SQLString = new ArrayList( ); DataTable dt = LibraryDa(idxList, strSql); if (dt != null && dt.Rows.Count > 0) { barCodeEntity.JSKLHA _modelOne = new barCodeEntity.JSKLHA( ); barCodeEntity.JSKLHB _modelTwo = new barCodeEntity.JSKLHB( ); barCodeEntity.barCodeReportEntity _modelTre = new barCodeEntity.barCodeReportEntity( ); barCodeEntity.TPADEH _modelDHE = new barCodeEntity.TPADEH( ); _modelTre.BAR019 = 0; _modelOne.LHA002 = "条码"; _modelOne.LHA004 = rklx; _modelOne.LHA001 = _modelTwo.LHB001 = _modelTre.BAR011 = LibraryOrderOddNum( ); _modelOne.LHA003 = DateTime.Now.ToString("yyyyMMdd"); _modelOne.LHA012 = "F"; SQLString.Add(InsertLHA(_modelOne, strSql)); List <string> strList = new List <string> ( ); for (int i = 0; i < dt.Rows.Count; i++) { if (strList.Count < 1) { _modelTwo.LHB002 = "001"; } else { _modelTwo.LHB002 = maxStrList(strList).ToString( ); if (Convert.ToInt32(_modelTwo.LHB002) < 9) { _modelTwo.LHB002 = "00" + (Convert.ToInt32(_modelTwo.LHB002) + 1).ToString( ); } else if (Convert.ToInt32(_modelTwo.LHB002) >= 9 && Convert.ToInt32(_modelTwo.LHB002) < 99) { _modelTwo.LHB002 = "0" + (Convert.ToInt32(_modelTwo.LHB002) + 1).ToString( ); } else { _modelTwo.LHB002 = (Convert.ToInt32(_modelTwo.LHB002) + 1).ToString( ); } } strList.Add(_modelTwo.LHB002); _modelTre.BAR008 = dt.Rows [i] ["BAR008"].ToString( ); if (table.Select("BAR008='" + _modelTre.BAR008 + "'").Length > 0) { _modelTre.BAR019 = Convert.ToInt32(table.Select("BAR008='" + _modelTre.BAR008 + "'") [0] ["BAR023"].ToString( )); } _modelTre.BAR023 = 0; SQLString.Add(EditBAR(_modelTre, strSql)); _modelTwo.LHB003 = _modelDHE.Dhe001 = dt.Rows [i] ["BAR001"].ToString( ); _modelTwo.LHB004 = dt.Rows [i] ["BAR002"].ToString( ); _modelTwo.LHB005 = dt.Rows [i] ["DEA003"].ToString( ); _modelTwo.LHB006 = dt.Rows [i] ["DDA001"].ToString( ); _modelTwo.LHB007 = 1; _modelTwo.LHB008 = /*string . IsNullOrEmpty ( dt . Rows [ i ] [ "COUN" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( dt . Rows [ i ] [ "COUN" ] . ToString ( ) );*/ _modelTre.BAR019; _modelTwo.LHB011 = "F"; _modelTwo.LHB019 = _modelDHE.Dhe002 = dt.Rows [i] ["BAR007"].ToString( ); _modelTwo.LHB020 = 1; _modelTwo.LHB021 = 1; _modelTwo.LHB022 = dt.Rows [i] ["DEA003"].ToString( ); _modelTwo.LHB023 = _modelTwo.LHB008; _modelTwo.LHB024 = dt.Rows [i] ["BAR004"].ToString( ); _modelTwo.LHB960 = dt.Rows [i] ["BAR007"].ToString( ); _modelTwo.LHB980 = Math.Round(acreage(dt.Rows [i] ["DEA057"].ToString( )) * _modelTwo.LHB008, 2); _modelTwo.LHB961 = dt.Rows [i] ["DEA961"].ToString( ); _modelDHE.Dhe003 = dt.Rows [i] ["BAR025"].ToString( ); SQLString.Add(InsertLHB(_modelTwo, strSql)); if (ExistsDEH(_modelDHE)) { SQLString.Add(UpdateDEH(_modelDHE, strSql)); } else { SQLString.Add(InsertDEH(_modelDHE, strSql)); } } //if ( !string . IsNullOrEmpty ( _modelOne . LHA001 ) ) //{ // SQLString . Add ( EditBAR ( _modelTre ,strSql ,idxList ) ); //} return(SqlHelper.ExecuteSqlTran(SQLString)); } else { return(false); } }
/// <summary> /// 增加记录 /// </summary> /// <param name="_modelList"></param> /// <returns></returns> public bool Save(barCodeEntity.barCodeReportEntity _model, long num, string serialNum) { Hashtable SQLString = new Hashtable( ); if (_model != null) { StringBuilder strSql = new StringBuilder( ); SqlParameter [] parameter = null; if (Exists(_model.BAR018) == false) { strSql.Append("INSERT INTO HDTBAR ("); strSql.Append("BAR001,BAR002,BAR003,BAR004,BAR005,BAR006,BAR007,BAR008,BAR012,BAR013,BAR016,BAR018,BAR019,BAR020,BAR022,BAR023)"); strSql.Append(" VALUES ("); strSql.Append("@BAR001,@BAR002,@BAR003,@BAR004,@BAR005,@BAR006,@BAR007,@BAR008,@BAR012,@BAR013,@BAR016,@BAR018,0,0,GETDATE(),@BAR023)"); //strSql . Append ( "SELECT SCOPE_IDENTITY();" ); parameter = new SqlParameter [] { new SqlParameter("@BAR001", SqlDbType.NVarChar, 40), new SqlParameter("@BAR002", SqlDbType.NVarChar, 40), new SqlParameter("@BAR003", SqlDbType.NVarChar, 40), new SqlParameter("@BAR004", SqlDbType.NVarChar, 40), new SqlParameter("@BAR005", SqlDbType.NVarChar, 40), new SqlParameter("@BAR006", SqlDbType.NVarChar, 40), new SqlParameter("@BAR007", SqlDbType.NVarChar, 40), new SqlParameter("@BAR008", SqlDbType.NVarChar, 60), new SqlParameter("@BAR012", SqlDbType.NChar, 10), new SqlParameter("@BAR013", SqlDbType.NChar, 10), new SqlParameter("@BAR016", SqlDbType.NChar, 10), new SqlParameter("@BAR018", SqlDbType.NVarChar, 40), new SqlParameter("@BAR023", SqlDbType.Int, 4) }; parameter [0].Value = _model.BAR001; parameter [1].Value = _model.BAR002; parameter [2].Value = _model.BAR003; parameter [3].Value = _model.BAR004; parameter [4].Value = _model.BAR005; parameter [5].Value = _model.BAR006; parameter [6].Value = _model.BAR007; parameter [7].Value = _model.BAR008; parameter [8].Value = "F"; parameter [9].Value = "F"; parameter [10].Value = "F"; parameter [11].Value = _model.BAR018; parameter [12].Value = _model.BAR023; SQLString.Add(strSql, parameter); } else { strSql = new StringBuilder( ); strSql.Append("UPDATE HDTBAR SET "); strSql.Append("BAR022=GETDATE(),"); strSql.AppendFormat("BAR023=BAR023+{0}", _model.BAR023); strSql.Append("WHERE BAR018=@BAR018"); parameter = new SqlParameter [] { new SqlParameter("@BAR018", SqlDbType.NVarChar, 40) }; parameter [0].Value = _model.BAR018; SQLString.Add(strSql, parameter); } } else { return(false); } return(SqlHelper.ExecuteSqlTran(SQLString)); }
/// <summary> /// 编辑 /// </summary> /// <param name="idxList"></param> /// <param name="stateOfLibrary">出库</param> /// <param name="stateOfStorage">入库</param> /// <param name="remark">备注</param> /// <returns></returns> public bool Edit(barCodeEntity.barCodeReportEntity _model) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); strSql.Append("UPDATE HDTBAR SET "); strSql.Append("BAR016=@BAR016,"); strSql.Append("BAR017=@BAR017,"); strSql.Append("BAR009=@BAR009,"); strSql.Append("BAR019=@BAR019,"); strSql.Append("BAR020=@BAR020,"); strSql.Append("BAR024=@BAR024,"); strSql.Append("BAR025=@BAR025 "); strSql.Append(" WHERE idx=@idx"); SqlParameter [] parameter = { new SqlParameter("@BAR017", SqlDbType.NVarChar, 200), new SqlParameter("@BAR009", SqlDbType.NVarChar, 20), new SqlParameter("@BAR016", SqlDbType.NChar, 10), new SqlParameter("@BAR019", SqlDbType.Int, 4), new SqlParameter("@BAR020", SqlDbType.Int, 4), new SqlParameter("@BAR024", SqlDbType.Date, 3), new SqlParameter("@BAR025", SqlDbType.NVarChar, 255), new SqlParameter("@idx", SqlDbType.Int) }; parameter[0].Value = _model.BAR017; parameter[1].Value = _model.BAR009; parameter[2].Value = _model.BAR016; parameter[3].Value = _model.BAR019; parameter[4].Value = _model.BAR020; parameter[5].Value = _model.BAR024; parameter[6].Value = _model.BAR025; parameter[7].Value = _model.idx; SQLString.Add(strSql, parameter); strSql = new StringBuilder( ); strSql.Append("UPDATE JSKLHB SET "); strSql.Append("LHB025=@LHB025,"); strSql.Append("LHB962=@LHB962"); strSql.Append(" WHERE LHB001=@LHB001 AND "); strSql.Append("LHB003=@LHB003 AND "); strSql.Append("LHB019=@LHB019"); SqlParameter[] para = { new SqlParameter("@LHB025", SqlDbType.VarChar, 255), new SqlParameter("@LHB962", SqlDbType.VarChar, 60), new SqlParameter("@LHB001", SqlDbType.VarChar, 20), new SqlParameter("@LHB003", SqlDbType.VarChar, 20), new SqlParameter("@LHB019", SqlDbType.VarChar, 20) }; para[0].Value = _model.BAR025; para[1].Value = _model.BAR017; para[2].Value = _model.BAR011; para[3].Value = _model.BAR001; para[4].Value = _model.BAR007; SQLString.Add(strSql, para); //strSql = new StringBuilder ( ); //strSql . AppendFormat ( "UPDATE TPADEH SET DEH003='{0}' FROM JSKLHB WHERE DEH001=LHB003 AND DEH002=LHB019 AND LHB001='{1}' AND LHB003='{2}' AND LHB019='{3}'" , _model . BAR025 , _model . BAR011 , _model . BAR001 , _model . BAR007 ); //SQLString . Add ( strSql , null ); return(SqlHelper.ExecuteSqlTran(SQLString)); }