public MandRelDel queryMandRelDelById(string uuid) { MandRelDel mandRelDel = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT uuid,man_no,cus_no,del_matno,bound_type,op_user,create_time,update_user,update_time FROM t_mand_reldel where uuid=@uuid and del_flag is null"); MySqlParameter[] parameters = { new MySqlParameter("@uuid", MySqlDbType.VarChar, 900), }; parameters[0].Value = uuid; DataSet ds = SQLHelper.ExecuteDataset(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { mandRelDel = new MandRelDel(); mandRelDel.Uuid = ds.Tables[0].Rows[0]["uuid"].ToString(); mandRelDel.ManNo = ds.Tables[0].Rows[0]["man_no"].ToString(); mandRelDel.CusNo = ds.Tables[0].Rows[0]["cus_no"].ToString(); mandRelDel.DelMatno = ds.Tables[0].Rows[0]["del_matno"].ToString(); mandRelDel.BoundType = ds.Tables[0].Rows[0]["bound_type"].ToString(); mandRelDel.OpUser = ds.Tables[0].Rows[0]["op_user"].ToString(); mandRelDel.CreateTime = ds.Tables[0].Rows[0]["create_time"].ToString(); mandRelDel.UpdateUser = ds.Tables[0].Rows[0]["update_user"].ToString(); mandRelDel.UpdateTime = ds.Tables[0].Rows[0]["update_time"].ToString(); } return(mandRelDel); }
public List <MandUnionFieldType> queryFieldListByCond(string cusNo, string delMatno, string boudType) { MandRelDel mandRelDel = mandRelDelDao.queryManNoByDel(cusNo, delMatno, boudType); if (mandRelDel != null) { return(manRelFieldTypeDao.queryMandUnionFieldTypeList(mandRelDel.ManNo)); } return(null); }
private void button2_Click(object sender, EventArgs e) { if (this.dataGridView1.CurrentRow == null) { MessageBox.Show("請輸入正確的查詢條件或請選中表中的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Focus(); return; } int index = this.dataGridView1.CurrentRow.Index; string modelNo = this.dataGridView1.Rows[index].Cells["model_no"].Value.ToString(); string cusNo = this.dataGridView1.Rows[index].Cells["cus_no"].Value.ToString(); string delMatno = this.dataGridView1.Rows[index].Cells["del_matno"].Value.ToString(); string filePath = modelInfoService.previewModelFile(modelNo); if (filePath == null) { MessageBox.Show("未找到該客戶出貨料號對應的打印模板信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //查詢打印模板的打印字段 MandRelDel mandRelDel = mandRelDelService.queryManNoByDel(cusNo, delMatno, "1"); if (mandRelDel == null) { MessageBox.Show("未找到該客戶出貨料號對應的打印字段規則信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } List <MandUnionFieldType> mandUnionFieldTypeList = manRelFieldTypeService.queryMandUnionFieldTypeList(mandRelDel.ManNo); if (mandUnionFieldTypeList == null) { MessageBox.Show("未找到該客戶出貨料號對應的打印字段規則信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string cartonNo = this.dataGridView1.Rows[index].Cells["cartonNo"].Value.ToString(); Carton carton = cartonService.queryCartonDetailsByNo(cartonNo); if (carton.CtCodeList != null) { initCTSeq(carton); } bool judgePrint = barPrint.bactchPrintPalletByModel(filePath, cartonToDic(carton, mandUnionFieldTypeList)); if (judgePrint) { //printQ.savePrintRecord(ctcodeEntity); } else { MessageBox.Show("打印失敗請聯係管理員!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
/// <summary> /// 保存字段 /// </summary> /// <param name="MandRelDel"></param> /// <returns></returns> public MandRelDel saveMandRelDel(MandRelDel modelRelMand) { MandRelDel reMandRelDel = null; modelRelMand.Uuid = Auxiliary.Get_UUID(); modelRelMand.OpUser = Auxiliary.loginName; modelRelMand.CreateTime = Auxiliary.Get_CurrentTime(); if (mandRelDelDao.saveMandRelDel(modelRelMand)) { reMandRelDel = mandRelDelDao.queryMandRelDelById(modelRelMand.Uuid); } return(reMandRelDel); }
private void button2_Click(object sender, EventArgs e) { if (this.dataGridView1.CurrentRow == null) { MessageBox.Show("請輸入正確的查詢條件或請選中表中的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Focus(); return; } int index = this.dataGridView1.CurrentRow.Index; string modelNo = this.dataGridView1.Rows[index].Cells["model_no"].Value.ToString(); string cusNo = this.dataGridView1.Rows[index].Cells["cus_no"].Value.ToString(); string delMatno = this.dataGridView1.Rows[index].Cells["del_matno"].Value.ToString(); //下載模板並預覽 1.查询模板是否存在, 若存在不下载 2.若不存在下载模板 string filePath = modelInfoService.previewModelFile(modelNo); if (filePath == null) { MessageBox.Show("未找到該客戶出貨料號對應的打印模板信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //查詢打印模板的打印字段 MandRelDel mandRelDel = mandRelDelService.queryManNoByDel(cusNo, delMatno, "0"); if (mandRelDel == null) { MessageBox.Show("未找到該客戶出貨料號對應的打印字段規則信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } List <MandUnionFieldType> mandUnionFieldTypeList = manRelFieldTypeService.queryMandUnionFieldTypeList(mandRelDel.ManNo); if (mandUnionFieldTypeList == null) { MessageBox.Show("未找到該客戶出貨料號對應的打印字段規則信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string ctcode = this.dataGridView1.Rows[index].Cells["ct_code"].Value.ToString(); CTCode ctcodeEntity = cTCodeService.queryCTCodeByCtcode(ctcode); bool judge = barPrint.bactchPrintPalletByModel(filePath, ctcodeToDic(ctcodeEntity, mandUnionFieldTypeList)); if (judge) { printQ.savePrintRecord(ctcodeEntity); } else { MessageBox.Show("打印失敗請聯係管理員!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
private void button1_Click(object sender, EventArgs e) { if (saveMark) { MessageBox.Show("該模板關係已經保存,請勿重複保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.textBox1.Text == null || this.textBox1.Text.Trim() == "") { MessageBox.Show("维护客户料号信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Focus(); return; } string boundType = this.comboBox3.SelectedValue == null ? "0" : this.comboBox3.SelectedValue.ToString(); MandRelDel mandRelDel = new MandRelDel(); mandRelDel.ManNo = this.comboBox1.SelectedValue.ToString(); mandRelDel.CusNo = this.comboBox2.SelectedValue.ToString().Trim(); mandRelDel.DelMatno = this.textBox1.Text.Trim().ToString().Trim(); mandRelDel.BoundType = boundType; if (mandRelDelService.checkAdd(mandRelDel)) { MessageBox.Show("該客戶和出貨料號的参数字段已經綁定,請勿重複綁定!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Focus(); return; } MandRelDel reMandRelDel = mandRelDelService.saveMandRelDel(mandRelDel); if (reMandRelDel != null) { this.textBox2.Text = reMandRelDel.CreateTime; saveMark = true; MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 查找当前客户和出货料号是否绑定字段 /// </summary> /// <param name="mandRelDel"></param> /// <returns></returns> public bool exists(MandRelDel mandRelDel) { bool repeatJudge = false; StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from t_mand_reldel where cus_no=@CusNo and del_matno=@delMatno and bound_type=@boundType and del_flag is null"); MySqlParameter[] parameters = { new MySqlParameter("@CusNo", MySqlDbType.VarChar, 900), new MySqlParameter("@delMatno", MySqlDbType.VarChar, 900), new MySqlParameter("@boundType", MySqlDbType.VarChar, 900) }; parameters[0].Value = mandRelDel.CusNo; parameters[1].Value = mandRelDel.DelMatno; parameters[2].Value = mandRelDel.BoundType; int rows = int.Parse(SQLHelper.ExecuteScalar(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters).ToString().Trim()); if (rows > 0) { repeatJudge = true; } return(repeatJudge); }
public bool saveMandRelDel(MandRelDel mandRelDel) { bool saveMark = true; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into t_mand_reldel (uuid,man_no,cus_no,del_matno,bound_type,op_user,create_time)"); strSql.Append("values(@uuid,@manNo,@cusNo,@delMatno,@boundType,@opUser,@createTime)"); MySqlParameter[] parameters = { new MySqlParameter("@uuid", MySqlDbType.VarChar, 900), new MySqlParameter("@manNo", MySqlDbType.VarChar, 900), new MySqlParameter("@cusNo", MySqlDbType.VarChar, 900), new MySqlParameter("@delMatno", MySqlDbType.VarChar, 900), new MySqlParameter("@boundType", MySqlDbType.VarChar, 900), new MySqlParameter("@opUser", MySqlDbType.VarChar, 900), new MySqlParameter("@createTime", MySqlDbType.VarChar, 900) }; parameters[0].Value = mandRelDel.Uuid; parameters[1].Value = mandRelDel.ManNo; parameters[2].Value = mandRelDel.CusNo; parameters[3].Value = mandRelDel.DelMatno; parameters[4].Value = mandRelDel.BoundType; parameters[5].Value = mandRelDel.OpUser; parameters[6].Value = mandRelDel.CreateTime; int rows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters); if (rows > 0) { saveMark = true; } else { saveMark = false; } return(saveMark); }
public bool checkAdd(MandRelDel mandRelDel) { return(mandRelDelDao.exists(mandRelDel)); }