/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { //时间正则表达式 string reg = @"^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$"; string regs =@"^(((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-)) (20|21|22|23|[0-1]?\d):[0-5]?\d:[0-5]?\d)$"; var name =Convert.ToInt32(gh); tsuhan_scgl_yh yh = yhbll.GetModel(gh); var sgdh1 = this.tbSGDXH.Text + this.tbDXH1.Text; var str1 = sgdh1.Substring(sgdh1.Length - 1, 1); #region 判断不合格数量是否正确 //if (yh.机构 == "全部") //{ #region 备料 if (this.tbyy10Sl.Text == "") { this.tbyy10Sl.Text = "0"; } if (this.tbyy9.Text == "") { this.tbyy9.Text = "0"; } if (this.tbyy8.Text == "") { this.tbyy8.Text = "0"; } if (this.tbyy7.Text == "") { this.tbyy7.Text = "0"; } if (this.tbyy6.Text == "") { this.tbyy6.Text = "0"; } if (this.tbyy5.Text == "") { this.tbyy5.Text = "0"; } if (this.tbyy4.Text == "") { this.tbyy4.Text = "0"; } if (this.tbyy3.Text == "") { this.tbyy3.Text = "0"; } if (this.tbyy2.Text == "") { this.tbyy2.Text = "0"; } if (this.tbyy1.Text == "") { this.tbyy1.Text = "0"; } if (this.tbbhgsl.Text == "") { this.tbbhgsl.Text = "0"; } var allnum = int.Parse(this.tbyy1.Text) + int.Parse(this.tbyy2.Text) + int.Parse(this.tbyy3.Text) + int.Parse(this.tbyy4.Text) + int.Parse(this.tbyy5.Text) + int.Parse(this.tbyy6.Text) + int.Parse(this.tbyy7.Text) + int.Parse(this.tbyy8.Text) + int.Parse(this.tbyy9.Text) + int.Parse(this.tbyy10Sl.Text); if (this.tbbhgsl.Text != Convert.ToString(allnum)) { MessageBox.Show("备料不合格总数错误", "提示"); return; } #endregion #region LD耦合焊接 if (this.tbyy20sl.Text == "") { this.tbyy20sl.Text = "0"; } if (this.tbyy19.Text == "") { this.tbyy19.Text = "0"; } if (this.tbyy18.Text == "") { this.tbyy18.Text = "0"; } if (this.tbyy17.Text == "") { this.tbyy17.Text = "0"; } if (this.tbyy16.Text == "") { this.tbyy16.Text = "0"; } if (this.tbyy15.Text == "") { this.tbyy15.Text = "0"; } if (this.tbyy14.Text == "") { this.tbyy14.Text = "0"; } if (this.tbyy13.Text == "") { this.tbyy13.Text = "0"; } if (this.tbyy12.Text == "") { this.tbyy12.Text = "0"; } if (this.tbyy11.Text == "") { this.tbyy11.Text = "0"; } if (this.tbjzsl1.Text == "") { this.tbjzsl1.Text = "0"; } if (this.tbbhksl1.Text == "") { this.tbbhksl1.Text = "0"; } var allnum1 = int.Parse(this.tbyy11.Text) + int.Parse(this.tbyy12.Text) + int.Parse(this.tbyy13.Text) + int.Parse(this.tbyy14.Text) + int.Parse(this.tbyy15.Text) + int.Parse(this.tbyy16.Text) + int.Parse(this.tbyy17.Text) + int.Parse(this.tbyy18.Text) + int.Parse(this.tbyy19.Text) + int.Parse(this.tbyy20sl.Text); var num = int.Parse(this.tbbhksl1.Text) + int.Parse(this.tbjzsl1.Text); var all = num + int.Parse(this.tbxcsl1.Text); if (Convert.ToString(num) != Convert.ToString(allnum1)) { MessageBox.Show("LD耦合焊接不合格总数错误", "提示"); return; } else if (Convert.ToString(all) != this.tbsjsl1.Text) { MessageBox.Show("下传数量与上接数量不符", "提示"); return; } #endregion #region PT耦合固化 if (this.tbyy30sl.Text == "") { this.tbyy30sl.Text = "0"; } if (this.tbyy29.Text == "") { this.tbyy29.Text = "0"; } if (this.tbyy28.Text == "") { this.tbyy28.Text = "0"; } if (this.tbyy27.Text == "") { this.tbyy27.Text = "0"; } if (this.tbyy26.Text == "") { this.tbyy26.Text = "0"; } if (this.tbyy25.Text == "") { this.tbyy25.Text = "0"; } if (this.tbyy24.Text == "") { this.tbyy24.Text = "0"; } if (this.tbyy23.Text == "") { this.tbyy23.Text = "0"; } if (this.tbyy22.Text == "") { this.tbyy22.Text = "0"; } if (this.tbyy21.Text == "") { this.tbyy21.Text = "0"; } if (this.textBox100.Text == "") { this.textBox100.Text = "0"; } var allnum2 = int.Parse(this.tbyy21.Text) + int.Parse(this.tbyy22.Text) + int.Parse(this.tbyy23.Text) + int.Parse(this.tbyy24.Text) + int.Parse(this.tbyy25.Text) + int.Parse(this.tbyy26.Text) + int.Parse(this.tbyy27.Text) + int.Parse(this.tbyy28.Text) + int.Parse(this.tbyy29.Text) + int.Parse(this.tbyy30sl.Text); var all2 = allnum2 + int.Parse(this.tbxcsl2.Text); if (this.textBox100.Text != Convert.ToString(allnum2)) { MessageBox.Show("PT耦合固化不合格总数错误", "提示"); return; } else if (Convert.ToString(all2) != this.tbsjsl2.Text) { MessageBox.Show("数量与上接数量不符", "提示"); return; } #endregion #region 测试 if (this.tbyy39sl.Text == "") { this.tbyy39sl.Text = "0"; } if (this.tbyy38.Text == "") { this.tbyy38.Text = "0"; } if (this.tbyy37.Text == "") { this.tbyy37.Text = "0"; } if (this.tbyy36.Text == "") { this.tbyy36.Text = "0"; } if (this.tbyy35.Text == "") { this.tbyy35.Text = "0"; } if (this.tbyy34.Text == "") { this.tbyy34.Text = "0"; } if (this.tbyy33.Text == "") { this.tbyy33.Text = "0"; } if (this.tbyy32.Text == "") { this.tbyy32.Text = "0"; } if (this.tbyy31.Text == "") { this.tbyy31.Text = "0"; } if (this.tbbhgsl2.Text == "") { this.tbbhgsl2.Text = "0"; } var allnum3 = int.Parse(this.tbyy31.Text) + int.Parse(this.tbyy32.Text) + int.Parse(this.tbyy33.Text) + int.Parse(this.tbyy34.Text) + int.Parse(this.tbyy35.Text) + int.Parse(this.tbyy36.Text) + int.Parse(this.tbyy37.Text) + int.Parse(this.tbyy38.Text) + int.Parse(this.tbyy39sl.Text); var all3 = allnum3 + int.Parse(tbxcsl4.Text); if (this.tbbhgsl2.Text != Convert.ToString(allnum3)) { MessageBox.Show("测试不合格总数错误", "提示"); return; } else if (Convert.ToString(all3) != this.tbsjsl4.Text) { MessageBox.Show("数量与上接数量不符", "提示"); return; } #endregion #region 清洗 if (this.tbyy40.Text == "") { this.tbyy40.Text = "0"; } if (this.tbyy41sl.Text == "") { this.tbyy41sl.Text = "0"; } if (this.tbbhgsl3.Text == "") { this.tbbhgsl3.Text = "0"; } var allnum4 = int.Parse(this.tbyy40.Text) + int.Parse(this.tbyy41sl.Text); var all4 = allnum4 + int.Parse(this.tbxcsl5.Text); if (this.tbbhgsl3.Text != Convert.ToString(allnum4)) { MessageBox.Show("清洗不合格总数错误", "提示"); return; } else if (Convert.ToString(all4) != this.tbsjsl5.Text) { MessageBox.Show("数量与上接数量不符", "提示"); return; } #endregion #region 包装 if (this.tbyy42.Text == "") { this.tbyy42.Text = "0"; } if (this.tbyy43sl.Text == "") { this.tbyy43sl.Text = "0"; } if (this.tbbhgsl4.Text == "") { this.tbbhgsl4.Text = "0"; } var allnum5 = int.Parse(this.tbyy42.Text) + int.Parse(this.tbyy43sl.Text); var all5 = allnum5 + int.Parse(this.tbxcsl6.Text); if (this.tbbhgsl4.Text != Convert.ToString(allnum5)) { MessageBox.Show("包装不合格总数错误", "提示"); return; } else if (Convert.ToString(all5) != this.tbsjsl6.Text) { MessageBox.Show("数量与上接数量不符", "提示"); return; } #endregion #region // } // else if (yh.机构 == "备料") // { // #region // //if (this.tbyy10Sl.Text == "") // //{ // // this.tbyy10Sl.Text = "0"; // //} // //if (this.tbyy9.Text == "") // //{ // // this.tbyy9.Text = "0"; // //} // //if (this.tbyy8.Text == "") // //{ // // this.tbyy8.Text = "0"; // //} // //if (this.tbyy7.Text == "") // //{ // // this.tbyy7.Text = "0"; // //} // //if (this.tbyy6.Text == "") // //{ // // this.tbyy6.Text = "0"; // //} // //if (this.tbyy5.Text == "") // //{ // // this.tbyy5.Text = "0"; // //} // //if (this.tbyy4.Text == "") // //{ // // this.tbyy4.Text = "0"; // //} // //if (this.tbyy3.Text == "") // //{ // // this.tbyy3.Text = "0"; // //} // //if (this.tbyy2.Text == "") // //{ // // this.tbyy2.Text = "0"; // //} // //if (this.tbyy1.Text == "") // //{ // // this.tbyy1.Text = "0"; // //} // //if (this.tbbhgsl.Text == "") // //{ // // this.tbbhgsl.Text = "0"; // //} // //var allnum = int.Parse(this.tbyy1.Text) + int.Parse(this.tbyy2.Text) + int.Parse(this.tbyy3.Text) + int.Parse(this.tbyy4.Text) + int.Parse(this.tbyy5.Text) + int.Parse(this.tbyy6.Text) + int.Parse(this.tbyy7.Text) + int.Parse(this.tbyy8.Text) + int.Parse(this.tbyy9.Text) + int.Parse(this.tbyy10Sl.Text); // //if (this.tbbhgsl.Text != Convert.ToString(allnum)) // //{ // // MessageBox.Show("不合格总数错误", "提示"); // // return; // //} // #endregion // } // else if (yh.机构 == "LD耦合焊接") // { // #region // if (this.tbyy20sl.Text == "") // { // this.tbyy20sl.Text = "0"; // } // if (this.tbyy19.Text == "") // { // this.tbyy19.Text = "0"; // } // if (this.tbyy18.Text == "") // { // this.tbyy18.Text = "0"; // } // if (this.tbyy17.Text == "") // { // this.tbyy17.Text = "0"; // } // if (this.tbyy16.Text == "") // { // this.tbyy16.Text = "0"; // } // if (this.tbyy15.Text == "") // { // this.tbyy15.Text = "0"; // } // if (this.tbyy14.Text == "") // { // this.tbyy14.Text = "0"; // } // if (this.tbyy13.Text == "") // { // this.tbyy13.Text = "0"; // } // if (this.tbyy12.Text == "") // { // this.tbyy12.Text = "0"; // } // if (this.tbyy11.Text == "") // { // this.tbyy11.Text = "0"; // } // if (this.tbjzsl1.Text == "") // { // this.tbjzsl1.Text = "0"; // } // if (this.tbbhksl1.Text == "") // { // this.tbbhksl1.Text = "0"; // } // var allnum1 = int.Parse(this.tbyy11.Text) + int.Parse(this.tbyy12.Text) + int.Parse(this.tbyy13.Text) + int.Parse(this.tbyy14.Text) + int.Parse(this.tbyy15.Text) + int.Parse(this.tbyy16.Text) + int.Parse(this.tbyy17.Text) + int.Parse(this.tbyy18.Text) + int.Parse(this.tbyy19.Text) + int.Parse(this.tbyy20sl.Text); // var num = int.Parse(this.tbbhksl1.Text) + int.Parse(this.tbjzsl1.Text); // if (this.tbxcsl1.Text == "") // { // this.tbxcsl1.Text = "0"; // } // var all = num + int.Parse(this.tbxcsl1.Text); // if (Convert.ToString(num) != Convert.ToString(allnum1)) // { // MessageBox.Show("不合格总数错误", "提示"); // return; // } // else if (Convert.ToString(all) != this.tbsjsl1.Text) // { // MessageBox.Show("数量与上接数量不符", "提示"); // return; // } // #endregion // } // else if (yh.机构 == "PT耦合固化") // { // #region PT耦合固化 // if (this.tbyy30sl.Text == "") // { // this.tbyy30sl.Text = "0"; // } // if (this.tbyy29.Text == "") // { // this.tbyy29.Text = "0"; // } // if (this.tbyy28.Text == "") // { // this.tbyy28.Text = "0"; // } // if (this.tbyy27.Text == "") // { // this.tbyy27.Text = "0"; // } // if (this.tbyy26.Text == "") // { // this.tbyy26.Text = "0"; // } // if (this.tbyy25.Text == "") // { // this.tbyy25.Text = "0"; // } // if (this.tbyy24.Text == "") // { // this.tbyy24.Text = "0"; // } // if (this.tbyy23.Text == "") // { // this.tbyy23.Text = "0"; // } // if (this.tbyy22.Text == "") // { // this.tbyy22.Text = "0"; // } // if (this.tbyy21.Text == "") // { // this.tbyy21.Text = "0"; // } // if (this.textBox100.Text == "") // { // this.textBox100.Text = "0"; // } // var allnum2 = int.Parse(this.tbyy21.Text) + int.Parse(this.tbyy22.Text) + int.Parse(this.tbyy23.Text) + int.Parse(this.tbyy24.Text) + int.Parse(this.tbyy25.Text) + int.Parse(this.tbyy26.Text) + int.Parse(this.tbyy27.Text) + int.Parse(this.tbyy28.Text) + int.Parse(this.tbyy29.Text) + int.Parse(this.tbyy30sl.Text); // if (this.tbxcsl2.Text == "") // { // this.tbxcsl2.Text = "0"; // } // var all = allnum2 + int.Parse(this.tbxcsl2.Text); // if (this.textBox100.Text != Convert.ToString(allnum2)) // { // MessageBox.Show("不合格总数错误", "提示"); // return; // } // else if (Convert.ToString(all) != this.tbsjsl2.Text) // { // MessageBox.Show("数量与上接数量不符", "提示"); // return; // } // #endregion // } // else if (yh.机构 == "测试") // { // #region 测试 // if (this.tbyy39sl.Text == "") // { // this.tbyy39sl.Text = "0"; // } // if (this.tbyy38.Text == "") // { // this.tbyy38.Text = "0"; // } // if (this.tbyy37.Text == "") // { // this.tbyy37.Text = "0"; // } // if (this.tbyy36.Text == "") // { // this.tbyy36.Text = "0"; // } // if (this.tbyy35.Text == "") // { // this.tbyy35.Text = "0"; // } // if (this.tbyy34.Text == "") // { // this.tbyy34.Text = "0"; // } // if (this.tbyy33.Text == "") // { // this.tbyy33.Text = "0"; // } // if (this.tbyy32.Text == "") // { // this.tbyy32.Text = "0"; // } // if (this.tbyy31.Text == "") // { // this.tbyy31.Text = "0"; // } // if (this.tbbhgsl2.Text == "") // { // this.tbbhgsl2.Text = "0"; // } // var allnum3 = int.Parse(this.tbyy31.Text) + int.Parse(this.tbyy32.Text) + int.Parse(this.tbyy33.Text) + int.Parse(this.tbyy34.Text) + int.Parse(this.tbyy35.Text) + int.Parse(this.tbyy36.Text) + int.Parse(this.tbyy37.Text) + int.Parse(this.tbyy38.Text) + int.Parse(this.tbyy39sl.Text); // if (tbxcsl4.Text == "") // { // tbxcsl4.Text = "0"; // } // var all = int.Parse(this.tbbhgsl2.Text) + int.Parse(tbxcsl4.Text); // if (this.tbbhgsl2.Text != Convert.ToString(allnum3)) // { // MessageBox.Show("不合格总数错误", "提示"); // return; // } // else if (Convert.ToString(all) != this.tbsjsl4.Text) // { // MessageBox.Show("数量与上接数量不符", "提示"); // return; // } // #endregion // } // else if (yh.机构 == "清洗") // { // #region 清洗 // if (this.tbyy40.Text == "") // { // this.tbyy40.Text = "0"; // } // if (this.tbyy41sl.Text == "") // { // this.tbyy41sl.Text = "0"; // } // if (this.tbbhgsl3.Text == "") // { // this.tbbhgsl3.Text = "0"; // } // var allnum4 = int.Parse(this.tbyy40.Text) + int.Parse(this.tbyy41sl.Text); // if (this.tbxcsl5.Text == "") // { // this.tbxcsl5.Text = "0"; // } // var all = allnum4 + int.Parse(this.tbxcsl5.Text); // if (this.tbbhgsl3.Text != Convert.ToString(allnum4)) // { // MessageBox.Show("不合格总数错误", "提示"); // return; // } // else if (Convert.ToString(all) != this.tbsjsl5.Text) // { // MessageBox.Show("数量与上接数量不符", "提示"); // return; // } // #endregion // } // else if (yh.机构 == "包装") // { // #region 包装 // if (this.tbyy42.Text == "") // { // this.tbyy42.Text = "0"; // } // if (this.tbyy43sl.Text == "") // { // this.tbyy43sl.Text = "0"; // } // if (this.tbbhgsl4.Text == "") // { // this.tbbhgsl4.Text = "0"; // } // var allnum5 = int.Parse(this.tbyy42.Text) + int.Parse(this.tbyy43sl.Text); // if (this.tbxcsl6.Text == "") // { // this.tbxcsl6.Text = ""; // } // var all = allnum5 + int.Parse(this.tbxcsl6.Text); // if (this.tbbhgsl4.Text != Convert.ToString(allnum5)) // { // MessageBox.Show("不合格总数错误", "提示"); // return; // } // else if (Convert.ToString(all) != this.tbsjsl6.Text) // { // MessageBox.Show("下传数量与上接数量不符", "提示"); // return; // } // #endregion // } #endregion //} #endregion DialogResult dr = MessageBox.Show("确定要修改吗???","提示",MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { var sgd = this.tbSGDXH.Text; if (sgd != "") { tsuhan_sg_tx bhd = new tsuhan_sg_tx(); tsuhan_sg_bhd bh = new tsuhan_sg_bhd(); var sgdh = this.tbSGDXH.Text + this.tbDXH1.Text; var str = sgdh.Substring(sgdh.Length - 1, 1); bhd.随工单号 =sgdh ; var tx = txbll.QueryByXuhao(sgdh); bhd.id = tx.id; //if (str == "R") //{ #region 判断时间格式 //if (yh.机构 == "全部") //{ var time = this.dtpxcTime.Text; Match m1 = Regex.Match(dtpxcTime.Text, reg); Match m2 = Regex.Match(dtp1.Text, reg); Match m3 = Regex.Match(dtptime2.Text, reg); Match m4 = Regex.Match(dtpfrtime1.Text, regs); Match m5 = Regex.Match(dtpqcTime1.Text, regs); Match m6 = Regex.Match(dtpxtime3.Text, reg); Match m7 = Regex.Match(dtpxctime3.Text, reg); Match m8 = Regex.Match(dtpxctime4.Text, reg); if (m1.Success == false) { MessageBox.Show("备料时间格式输入错误.如[2015-5-5]", "提示"); return; } else if (m2.Success == false) { MessageBox.Show("LD耦合焊接时间格式输入错误.如[2015-5-5]", "提示"); return; } else if (m3.Success == false) { MessageBox.Show("PT耦合固化时间格式输入错误.如[2015-5-5]", "提示"); return; } else if (m4.Success == false) { MessageBox.Show("温循前时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); return; } else if (m5.Success == false) { MessageBox.Show("温循后时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); return; } else if (m6.Success == false) { MessageBox.Show("测试时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); return; } else if (m7.Success == false) { MessageBox.Show("清洗时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); return; } else if (m8.Success == false) { MessageBox.Show("包装时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); return; } else { BeiLiaoBind(bhd); LDHanJieBind(bhd); PTGuHuaBind(bhd); WenXunQianBind(bhd); WenXunHouBind(bhd); CeShiBind(bhd); QingXiBind(bhd); BaoZhuangBind(bhd); } //} //else if (yh.机构 == "备料") //{ // if (tx.bl_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxcTime.Text; // Match m = Regex.Match(dtpxcTime.Text, reg); // if (m.Success == false) // { // MessageBox.Show("备料时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // } // } //} //else if (yh.机构 == "LD耦合焊接") //{ // if (tx.LD_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtp1.Text; // Match m = Regex.Match(dtp1.Text, reg); // if (m.Success == false) // { // MessageBox.Show("LD耦合焊接时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // //if (this.tbsjsl1.Text != Convert.ToString(tx.bl_xcsl)) // //{ // // MessageBox.Show("LD耦合焊接上接数量与备料下传数量不符", "提示"); // // return; // //} // } // } //} //else if (yh.机构 == "PT耦合固化") //{ // if (tx.PT_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtptime2.Text; // Match m = Regex.Match(dtptime2.Text, reg); // if (m.Success == false) // { // MessageBox.Show("PT耦合固化时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // //if (this.tbsjsl2.Text != Convert.ToString(tx.LD_xcsl)) // //{ // // MessageBox.Show("PT耦合固化上接数量与LD耦合焊接下传数量不符", "提示"); // // return; // //} // } // } //} //else if (yh.机构 == "温循前") //{ // if (tx.WXQ_frsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpfrtime1.Text; // Match m = Regex.Match(dtpfrtime1.Text, regs); // if (m.Success == false) // { // MessageBox.Show("温循前时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // //if (this.tbsjsl3.Text != Convert.ToString(tx.PT_xcsl)) // //{ // // MessageBox.Show("温循前上接数量与PT耦合固化下传数量不符", "提示"); // // return; // //} // } // } //} //else if (yh.机构 == "温循后") //{ // if (tx.WXH_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpqcTime1.Text; // Match m = Regex.Match(dtpqcTime1.Text, regs); // if (m.Success == false) // { // MessageBox.Show("温循后时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // //if (this.tbqcsl1.Text != Convert.ToString(tx.WXQ_frsl)) // //{ // // MessageBox.Show("温循后上接数量与温循前放入数量不符", "提示"); // // return; // //} // } // } //} //else if (yh.机构 == "测试") //{ // if (tx.CS_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxtime3.Text; // Match m = Regex.Match(dtpxtime3.Text, reg); // if (m.Success == false) // { // MessageBox.Show("测试时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // CeShiBind(bhd); // //if (this.tbsjsl4.Text != Convert.ToString(tx.WXH_qcsl)) // //{ // // MessageBox.Show("测试上接数量与温循后下传数量不符", "提示"); // // return; // //} // } // } //} //else if (yh.机构 == "清洗") //{ // if (tx.QX_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxctime3.Text; // Match m = Regex.Match(dtpxctime3.Text, reg); // if (m.Success == false) // { // MessageBox.Show("清洗时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // CeShiBind(bhd); // QingXiBind(bhd); // //if (this.tbsjsl5.Text != Convert.ToString(tx.CS_xcsl)) // //{ // // MessageBox.Show("清洗上接数量与测试下传数量不符", "提示"); // // return; // //} // } // } //} //else if (yh.机构 == "包装") //{ // if (tx.BZ_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxctime4.Text; // Match m = Regex.Match(dtpxctime4.Text, reg); // if (m.Success == false) // { // MessageBox.Show("包装时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // CeShiBind(bhd); // QingXiBind(bhd); // BaoZhuangBind(bhd); // //if (this.tbsjsl6.Text != Convert.ToString(tx.QX_xcsl)) // //{ // // MessageBox.Show("包装上接数量与清洗下传数量不符", "提示"); // // return; // //} // } //} //} #endregion #region //} //else //{ // #region 判断时间格式 // if (yh.机构 == "全部") // { // var time = this.dtpxcTime.Text; // Match m1 = Regex.Match(dtpxcTime.Text, reg); // Match m2 = Regex.Match(dtp1.Text, reg); // Match m3 = Regex.Match(dtptime2.Text, reg); // Match m4 = Regex.Match(dtpfrtime1.Text, regs); // Match m5 = Regex.Match(dtpqcTime1.Text, regs); // Match m6 = Regex.Match(dtpxtime3.Text, reg); // Match m7 = Regex.Match(dtpxctime3.Text, reg); // Match m8 = Regex.Match(dtpxctime4.Text, reg); // if (m1.Success == false) // { // MessageBox.Show("备料时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else if (m2.Success == false) // { // MessageBox.Show("LD耦合焊接时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else if (m3.Success == false) // { // MessageBox.Show("PT耦合固化时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else if (m4.Success == false) // { // MessageBox.Show("温循前时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else if (m5.Success == false) // { // MessageBox.Show("温循后时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else if (m6.Success == false) // { // MessageBox.Show("测试时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else if (m7.Success == false) // { // MessageBox.Show("清洗时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else if (m8.Success == false) // { // MessageBox.Show("包装时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // CeShiBind(bhd); // QingXiBind(bhd); // BaoZhuangBind(bhd); // } // } // else if (yh.机构 == "备料") // { // if (tx.bl_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxcTime.Text; // Match m = Regex.Match(dtpxcTime.Text, reg); // if (m.Success == false) // { // MessageBox.Show("备料时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // } // } // } // else if (yh.机构 == "LD耦合焊接") // { // if (tx.LD_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtp1.Text; // Match m = Regex.Match(dtp1.Text, reg); // if (m.Success == false) // { // MessageBox.Show("LD耦合焊接时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // if (this.tbsjsl1.Text != Convert.ToString(tx.bl_xcsl)) // { // MessageBox.Show("LD耦合焊接上接数量与备料下传数量不符", "提示"); // return; // } // } // } // } // else if (yh.机构 == "PT耦合固化") // { // if (tx.PT_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtptime2.Text; // Match m = Regex.Match(dtptime2.Text, reg); // if (m.Success == false) // { // MessageBox.Show("PT耦合固化时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // if (this.tbsjsl2.Text != Convert.ToString(tx.LD_xcsl)) // { // MessageBox.Show("PT耦合固化上接数量与LD耦合焊接下传数量不符", "提示"); // return; // } // } // } // } // else if (yh.机构 == "温循前") // { // if (tx.WXQ_frsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpfrtime1.Text; // Match m = Regex.Match(dtpfrtime1.Text, regs); // if (m.Success == false) // { // MessageBox.Show("温循前时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // if (this.tbsjsl3.Text != Convert.ToString(tx.PT_xcsl)) // { // MessageBox.Show("温循前上接数量与PT耦合固化下传数量不符", "提示"); // return; // } // } // } // } // else if (yh.机构 == "温循后") // { // if (tx.WXH_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpqcTime1.Text; // Match m = Regex.Match(dtpqcTime1.Text, regs); // if (m.Success == false) // { // MessageBox.Show("温循后时间格式输入错误.如[2015-5-5 00:00:00]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // if (this.tbqcsl1.Text != Convert.ToString(tx.WXQ_frsl)) // { // MessageBox.Show("温循后上接数量与温循前放入数量不符", "提示"); // return; // } // } // } // } // else if (yh.机构 == "测试") // { // if (tx.CS_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxtime3.Text; // Match m = Regex.Match(dtpxtime3.Text, reg); // if (m.Success == false) // { // MessageBox.Show("测试时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // CeShiBind(bhd); // if (this.tbsjsl4.Text != Convert.ToString(tx.WXH_qcsl)) // { // MessageBox.Show("测试上接数量与温循后下传数量不符", "提示"); // return; // } // } // } // } // else if (yh.机构 == "清洗") // { // if (tx.QX_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxctime3.Text; // Match m = Regex.Match(dtpxctime3.Text, reg); // if (m.Success == false) // { // MessageBox.Show("清洗时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // CeShiBind(bhd); // QingXiBind(bhd); // if (this.tbsjsl5.Text != Convert.ToString(tx.CS_xcsl)) // { // MessageBox.Show("清洗上接数量与测试下传数量不符", "提示"); // return; // } // } // } // } // else if (yh.机构 == "包装") // { // if (tx.BZ_xcsl != null) // { // MessageBox.Show("此单你已经提交过了,不能再修改", "提示"); // return; // } // else // { // var time = this.dtpxctime4.Text; // Match m = Regex.Match(dtpxctime4.Text, reg); // if (m.Success == false) // { // MessageBox.Show("包装时间格式输入错误.如[2015-5-5]", "提示"); // return; // } // else // { // BeiLiaoBind(bhd); // LDHanJieBind(bhd); // PTGuHuaBind(bhd); // WenXunQianBind(bhd); // WenXunHouBind(bhd); // CeShiBind(bhd); // QingXiBind(bhd); // BaoZhuangBind(bhd); // if (this.tbsjsl6.Text != Convert.ToString(tx.QX_xcsl)) // { // MessageBox.Show("包装上接数量与清洗下传数量不符", "提示"); // return; // } // } // } // } // #endregion //} #endregion bhd.lsh1 = this.tbLSH1.Text; bhd.lsh2 = this.tbLSH2.Text; bhd.lsh3 = this.tbLSH3.Text; bhd.case1 = this.tbCASE1.Text; bhd.case2 = this.tbCASE2.Text; bhd.case3 = this.tbCASE3.Text; bhd.ld1 = this.tbLDP1.Text; bhd.ld2 = this.tbLDP2.Text; bhd.ld3 = this.tbLDP3.Text; bhd.pd1 = this.tbPDP1.Text; bhd.pd2 = this.tbPDP2.Text; bhd.pd3 = this.tbPDP3.Text; bhd.ldj1 = this.tbLDN1.Text; bhd.ldj2 = this.tbLDN2.Text; bhd.ldj3 = this.tbLDN3.Text; if (this.tbJC1.Text=="") { this.tbJC1.Text = "0"; } bhd.jc1 = Convert.ToDecimal(this.tbJC1.Text); if (this.tbJC2.Text == "") { this.tbJC2.Text = "0"; } bhd.jc2 = Convert.ToDecimal(this.tbJC2.Text); if (this.tbJC3.Text == "") { this.tbJC3.Text = "0"; } bhd.jc3 = Convert.ToDecimal(this.tbJC3.Text); bhd.oxl1 = this.tbAXL1.Text; bhd.oxl2 = this.tbAXL2.Text; bhd.oxl3 = this.tbAXL3.Text; bhd.ldxp_xinpianjj = this.tbjj.Text; bhd.ldxp_jianyanry = this.tbjyry.Text; bhd.ldxp_jianyansb = this.tbjysb.Text; bhd.备注 = this.rtbremark.Text; bhd.LD_xh = this.textBox34.Text; bhd.LD_name = this.textBox35.Text; bhd.LD_sjdh = this.textBox36.Text; bhd.PT_xh = this.textBox39.Text; bhd.PT_name = this.textBox38.Text; bhd.PT_sjdh = this.textBox37.Text; bhd.KT_xh = this.textBox42.Text; bhd.KT_name = this.textBox41.Text; bhd.KT_sjdh = this.textBox40.Text; bhd.NBP_xh0 = this.textBox45.Text; bhd.NBP_name0 = this.textBox44.Text; bhd.NBP_sjdh0 = this.textBox43.Text; bhd.NBP_xh45 = this.textBox51.Text; bhd.NBP_name45 = this.textBox50.Text; bhd.NBP_sjdh45 = this.textBox49.Text; bhd.JK_xh = this.textBox48.Text; bhd.JK_name = this.textBox47.Text; bhd.JK_sjdh = this.textBox46.Text; // bool result3 = bhdbll.Add(bh); bool result = false; //bool result1 = false; result= txbll.Update(bhd); //result1 = bhdbll.Update(bh); if (result == true) { MessageBox.Show("修改成功!", "提示"); this.btnUpdate.Enabled = false; } else { MessageBox.Show("修改失败!", "提示"); } } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(tsuhan_sg_bhd model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tsuhan_sg_bhd set "); strSql.Append("LD_lx=@LD_lx,"); strSql.Append("LD_xh=@LD_xh,"); strSql.Append("LD_name=@LD_name,"); strSql.Append("LD_sjdh=@LD_sjdh,"); strSql.Append("LD_remark=@LD_remark,"); strSql.Append("PT_lx=@PT_lx,"); strSql.Append("PT_xh=@PT_xh,"); strSql.Append("PT_name=@PT_name,"); strSql.Append("PT_sjdh=@PT_sjdh,"); strSql.Append("PT_remark=@PT_remark,"); strSql.Append("KT_lx=@KT_lx,"); strSql.Append("KT_xh=@KT_xh,"); strSql.Append("KT_name=@KT_name,"); strSql.Append("KT_sjdh=@KT_sjdh,"); strSql.Append("KT_remark=@KT_remark,"); strSql.Append("NBP_lx0=@NBP_lx0,"); strSql.Append("NBP_xh0=@NBP_xh0,"); strSql.Append("NBP_name0=@NBP_name0,"); strSql.Append("NBP_sjdh0=@NBP_sjdh0,"); strSql.Append("NBP_remark0=@NBP_remark0,"); strSql.Append("NBP_lx45=@NBP_lx45,"); strSql.Append("NBP_xh45=@NBP_xh45,"); strSql.Append("NBP_name45=@NBP_name45,"); strSql.Append("NBP_sjdh45=@NBP_sjdh45,"); strSql.Append("NBP_remark45=@NBP_remark45,"); strSql.Append("JK_lx=@JK_lx,"); strSql.Append("JK_xh=@JK_xh,"); strSql.Append("JK_name=@JK_name,"); strSql.Append("JK_sjdh=@JK_sjdh,"); strSql.Append("JK_remark=@JK_remark"); strSql.Append(" where 备货单号=@备货单号 "); SqlParameter[] parameters = { new SqlParameter("@LD_lx", SqlDbType.NVarChar,30), new SqlParameter("@LD_xh", SqlDbType.NVarChar,20), new SqlParameter("@LD_name", SqlDbType.NVarChar,30), new SqlParameter("@LD_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@LD_remark", SqlDbType.NVarChar,50), new SqlParameter("@PT_lx", SqlDbType.NVarChar,30), new SqlParameter("@PT_xh", SqlDbType.NVarChar,20), new SqlParameter("@PT_name", SqlDbType.NVarChar,30), new SqlParameter("@PT_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@PT_remark", SqlDbType.NVarChar,50), new SqlParameter("@KT_lx", SqlDbType.NVarChar,30), new SqlParameter("@KT_xh", SqlDbType.NVarChar,20), new SqlParameter("@KT_name", SqlDbType.NVarChar,30), new SqlParameter("@KT_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@KT_remark", SqlDbType.NVarChar,50), new SqlParameter("@NBP_lx0", SqlDbType.NVarChar,30), new SqlParameter("@NBP_xh0", SqlDbType.NVarChar,20), new SqlParameter("@NBP_name0", SqlDbType.NVarChar,30), new SqlParameter("@NBP_sjdh0", SqlDbType.NVarChar,20), new SqlParameter("@NBP_remark0", SqlDbType.NVarChar,50), new SqlParameter("@NBP_lx45", SqlDbType.NVarChar,30), new SqlParameter("@NBP_xh45", SqlDbType.NVarChar,20), new SqlParameter("@NBP_name45", SqlDbType.NVarChar,30), new SqlParameter("@NBP_sjdh45", SqlDbType.NVarChar,20), new SqlParameter("@NBP_remark45", SqlDbType.NVarChar,50), new SqlParameter("@JK_lx", SqlDbType.NVarChar,30), new SqlParameter("@JK_xh", SqlDbType.NVarChar,20), new SqlParameter("@JK_name", SqlDbType.NVarChar,30), new SqlParameter("@JK_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@JK_remark", SqlDbType.NVarChar,50), new SqlParameter("@备货单号", SqlDbType.NVarChar,30)}; parameters[0].Value = model.LD_lx; parameters[1].Value = model.LD_xh; parameters[2].Value = model.LD_name; parameters[3].Value = model.LD_sjdh; parameters[4].Value = model.LD_remark; parameters[5].Value = model.PT_lx; parameters[6].Value = model.PT_xh; parameters[7].Value = model.PT_name; parameters[8].Value = model.PT_sjdh; parameters[9].Value = model.PT_remark; parameters[10].Value = model.KT_lx; parameters[11].Value = model.KT_xh; parameters[12].Value = model.KT_name; parameters[13].Value = model.KT_sjdh; parameters[14].Value = model.KT_remark; parameters[15].Value = model.NBP_lx0; parameters[16].Value = model.NBP_xh0; parameters[17].Value = model.NBP_name0; parameters[18].Value = model.NBP_sjdh0; parameters[19].Value = model.NBP_remark0; parameters[20].Value = model.NBP_lx45; parameters[21].Value = model.NBP_xh45; parameters[22].Value = model.NBP_name45; parameters[23].Value = model.NBP_sjdh45; parameters[24].Value = model.NBP_remark45; parameters[25].Value = model.JK_lx; parameters[26].Value = model.JK_xh; parameters[27].Value = model.JK_name; parameters[28].Value = model.JK_sjdh; parameters[29].Value = model.JK_remark; parameters[30].Value = model.备货单号; int rows = dbhelper1.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.tsuhan_sg_bhd DataRowToModel(DataRow row) { Maticsoft.Model.tsuhan_sg_bhd model = new Maticsoft.Model.tsuhan_sg_bhd(); if (row != null) { if (row["备货单号"] != null) { model.备货单号 = row["备货单号"].ToString(); } if (row["LD_lx"] != null) { model.LD_lx = row["LD_lx"].ToString(); } if (row["LD_xh"] != null) { model.LD_xh = row["LD_xh"].ToString(); } if (row["LD_name"] != null) { model.LD_name = row["LD_name"].ToString(); } if (row["LD_sjdh"] != null) { model.LD_sjdh = row["LD_sjdh"].ToString(); } if (row["LD_remark"] != null) { model.LD_remark = row["LD_remark"].ToString(); } if (row["PT_lx"] != null) { model.PT_lx = row["PT_lx"].ToString(); } if (row["PT_xh"] != null) { model.PT_xh = row["PT_xh"].ToString(); } if (row["PT_name"] != null) { model.PT_name = row["PT_name"].ToString(); } if (row["PT_sjdh"] != null) { model.PT_sjdh = row["PT_sjdh"].ToString(); } if (row["PT_remark"] != null) { model.PT_remark = row["PT_remark"].ToString(); } if (row["KT_lx"] != null) { model.KT_lx = row["KT_lx"].ToString(); } if (row["KT_xh"] != null) { model.KT_xh = row["KT_xh"].ToString(); } if (row["KT_name"] != null) { model.KT_name = row["KT_name"].ToString(); } if (row["KT_sjdh"] != null) { model.KT_sjdh = row["KT_sjdh"].ToString(); } if (row["KT_remark"] != null) { model.KT_remark = row["KT_remark"].ToString(); } if (row["NBP_lx0"] != null) { model.NBP_lx0 = row["NBP_lx0"].ToString(); } if (row["NBP_xh0"] != null) { model.NBP_xh0 = row["NBP_xh0"].ToString(); } if (row["NBP_name0"] != null) { model.NBP_name0 = row["NBP_name0"].ToString(); } if (row["NBP_sjdh0"] != null) { model.NBP_sjdh0 = row["NBP_sjdh0"].ToString(); } if (row["NBP_remark0"] != null) { model.NBP_remark0 = row["NBP_remark0"].ToString(); } if (row["NBP_lx45"] != null) { model.NBP_lx45 = row["NBP_lx45"].ToString(); } if (row["NBP_xh45"] != null) { model.NBP_xh45 = row["NBP_xh45"].ToString(); } if (row["NBP_name45"] != null) { model.NBP_name45 = row["NBP_name45"].ToString(); } if (row["NBP_sjdh45"] != null) { model.NBP_sjdh45 = row["NBP_sjdh45"].ToString(); } if (row["NBP_remark45"] != null) { model.NBP_remark45 = row["NBP_remark45"].ToString(); } if (row["JK_lx"] != null) { model.JK_lx = row["JK_lx"].ToString(); } if (row["JK_xh"] != null) { model.JK_xh = row["JK_xh"].ToString(); } if (row["JK_name"] != null) { model.JK_name = row["JK_name"].ToString(); } if (row["JK_sjdh"] != null) { model.JK_sjdh = row["JK_sjdh"].ToString(); } if (row["JK_remark"] != null) { model.JK_remark = row["JK_remark"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(tsuhan_sg_bhd model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tsuhan_sg_bhd("); strSql.Append("备货单号,LD_lx,LD_xh,LD_name,LD_sjdh,LD_remark,PT_lx,PT_xh,PT_name,PT_sjdh,PT_remark,KT_lx,KT_xh,KT_name,KT_sjdh,KT_remark,NBP_lx0,NBP_xh0,NBP_name0,NBP_sjdh0,NBP_remark0,NBP_lx45,NBP_xh45,NBP_name45,NBP_sjdh45,NBP_remark45,JK_lx,JK_xh,JK_name,JK_sjdh,JK_remark)"); strSql.Append(" values ("); strSql.Append("@备货单号,@LD_lx,@LD_xh,@LD_name,@LD_sjdh,@LD_remark,@PT_lx,@PT_xh,@PT_name,@PT_sjdh,@PT_remark,@KT_lx,@KT_xh,@KT_name,@KT_sjdh,@KT_remark,@NBP_lx0,@NBP_xh0,@NBP_name0,@NBP_sjdh0,@NBP_remark0,@NBP_lx45,@NBP_xh45,@NBP_name45,@NBP_sjdh45,@NBP_remark45,@JK_lx,@JK_xh,@JK_name,@JK_sjdh,@JK_remark)"); SqlParameter[] parameters = { new SqlParameter("@备货单号", SqlDbType.NVarChar,30), new SqlParameter("@LD_lx", SqlDbType.NVarChar,30), new SqlParameter("@LD_xh", SqlDbType.NVarChar,20), new SqlParameter("@LD_name", SqlDbType.NVarChar,30), new SqlParameter("@LD_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@LD_remark", SqlDbType.NVarChar,50), new SqlParameter("@PT_lx", SqlDbType.NVarChar,30), new SqlParameter("@PT_xh", SqlDbType.NVarChar,20), new SqlParameter("@PT_name", SqlDbType.NVarChar,30), new SqlParameter("@PT_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@PT_remark", SqlDbType.NVarChar,50), new SqlParameter("@KT_lx", SqlDbType.NVarChar,30), new SqlParameter("@KT_xh", SqlDbType.NVarChar,20), new SqlParameter("@KT_name", SqlDbType.NVarChar,30), new SqlParameter("@KT_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@KT_remark", SqlDbType.NVarChar,50), new SqlParameter("@NBP_lx0", SqlDbType.NVarChar,30), new SqlParameter("@NBP_xh0", SqlDbType.NVarChar,20), new SqlParameter("@NBP_name0", SqlDbType.NVarChar,30), new SqlParameter("@NBP_sjdh0", SqlDbType.NVarChar,20), new SqlParameter("@NBP_remark0", SqlDbType.NVarChar,50), new SqlParameter("@NBP_lx45", SqlDbType.NVarChar,30), new SqlParameter("@NBP_xh45", SqlDbType.NVarChar,20), new SqlParameter("@NBP_name45", SqlDbType.NVarChar,30), new SqlParameter("@NBP_sjdh45", SqlDbType.NVarChar,20), new SqlParameter("@NBP_remark45", SqlDbType.NVarChar,50), new SqlParameter("@JK_lx", SqlDbType.NVarChar,30), new SqlParameter("@JK_xh", SqlDbType.NVarChar,20), new SqlParameter("@JK_name", SqlDbType.NVarChar,30), new SqlParameter("@JK_sjdh", SqlDbType.NVarChar,20), new SqlParameter("@JK_remark", SqlDbType.NVarChar,50)}; parameters[0].Value = model.备货单号; parameters[1].Value = model.LD_lx; parameters[2].Value = model.LD_xh; parameters[3].Value = model.LD_name; parameters[4].Value = model.LD_sjdh; parameters[5].Value = model.LD_remark; parameters[6].Value = model.PT_lx; parameters[7].Value = model.PT_xh; parameters[8].Value = model.PT_name; parameters[9].Value = model.PT_sjdh; parameters[10].Value = model.PT_remark; parameters[11].Value = model.KT_lx; parameters[12].Value = model.KT_xh; parameters[13].Value = model.KT_name; parameters[14].Value = model.KT_sjdh; parameters[15].Value = model.KT_remark; parameters[16].Value = model.NBP_lx0; parameters[17].Value = model.NBP_xh0; parameters[18].Value = model.NBP_name0; parameters[19].Value = model.NBP_sjdh0; parameters[20].Value = model.NBP_remark0; parameters[21].Value = model.NBP_lx45; parameters[22].Value = model.NBP_xh45; parameters[23].Value = model.NBP_name45; parameters[24].Value = model.NBP_sjdh45; parameters[25].Value = model.NBP_remark45; parameters[26].Value = model.JK_lx; parameters[27].Value = model.JK_xh; parameters[28].Value = model.JK_name; parameters[29].Value = model.JK_sjdh; parameters[30].Value = model.JK_remark; int rows = dbhelper1.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
/// <summary> /// 根据备货单号查询材料清单 /// </summary> /// <param name="beiHuo"></param> /// <returns></returns> public tsuhan_sg_bhd QueryByBei(string beiHuo) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from tsuhan_sg_bhd where "); strSql.Append("备货单号 = @beiHuo"); SqlParameter[] parameters ={ new SqlParameter("@beiHuo",SqlDbType.NVarChar,30) }; parameters[0].Value = beiHuo; tsuhan_sg_bhd model = new tsuhan_sg_bhd(); DataSet ds = dbhelper1.Query(strSql.ToString(),parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.tsuhan_sg_bhd DataRowToModel(DataRow row) { Maticsoft.Model.tsuhan_sg_bhd model = new Maticsoft.Model.tsuhan_sg_bhd(); if (row != null) { if (row["备货单号"] != null) { model.备货单号 = row["备货单号"].ToString(); } if (row["LD_lx"] != null) { model.LD_lx = row["LD_lx"].ToString(); } if (row["LD_xh"] != null) { model.LD_xh = row["LD_xh"].ToString(); } if (row["LD_name"] != null) { model.LD_name = row["LD_name"].ToString(); } if (row["LD_sjdh"] != null) { model.LD_sjdh = row["LD_sjdh"].ToString(); } if (row["LD_remark"] != null) { model.LD_remark = row["LD_remark"].ToString(); } if (row["PT_lx"] != null) { model.PT_lx = row["PT_lx"].ToString(); } if (row["PT_xh"] != null) { model.PT_xh = row["PT_xh"].ToString(); } if (row["PT_name"] != null) { model.PT_name = row["PT_name"].ToString(); } if (row["PT_sjdh"] != null) { model.PT_sjdh = row["PT_sjdh"].ToString(); } if (row["PT_remark"] != null) { model.PT_remark = row["PT_remark"].ToString(); } if (row["KT_lx"] != null) { model.KT_lx = row["KT_lx"].ToString(); } if (row["KT_xh"] != null) { model.KT_xh = row["KT_xh"].ToString(); } if (row["KT_name"] != null) { model.KT_name = row["KT_name"].ToString(); } if (row["KT_sjdh"] != null) { model.KT_sjdh = row["KT_sjdh"].ToString(); } if (row["KT_remark"] != null) { model.KT_remark = row["KT_remark"].ToString(); } if (row["NBP_lx0"] != null) { model.NBP_lx0 = row["NBP_lx0"].ToString(); } if (row["NBP_xh0"] != null) { model.NBP_xh0 = row["NBP_xh0"].ToString(); } if (row["NBP_name0"] != null) { model.NBP_name0 = row["NBP_name0"].ToString(); } if (row["NBP_sjdh0"] != null) { model.NBP_sjdh0 = row["NBP_sjdh0"].ToString(); } if (row["NBP_remark0"] != null) { model.NBP_remark0 = row["NBP_remark0"].ToString(); } if (row["NBP_lx45"] != null) { model.NBP_lx45 = row["NBP_lx45"].ToString(); } if (row["NBP_xh45"] != null) { model.NBP_xh45 = row["NBP_xh45"].ToString(); } if (row["NBP_name45"] != null) { model.NBP_name45 = row["NBP_name45"].ToString(); } if (row["NBP_sjdh45"] != null) { model.NBP_sjdh45 = row["NBP_sjdh45"].ToString(); } if (row["NBP_remark45"] != null) { model.NBP_remark45 = row["NBP_remark45"].ToString(); } if (row["JK_lx"] != null) { model.JK_lx = row["JK_lx"].ToString(); } if (row["JK_xh"] != null) { model.JK_xh = row["JK_xh"].ToString(); } if (row["JK_name"] != null) { model.JK_name = row["JK_name"].ToString(); } if (row["JK_sjdh"] != null) { model.JK_sjdh = row["JK_sjdh"].ToString(); } if (row["JK_remark"] != null) { model.JK_remark = row["JK_remark"].ToString(); } } return model; }
/// <summary> /// 更新 /// </summary> /// <param name="bh"></param> /// <returns></returns> public bool Update(tsuhan_sg_bhd bh) { return dal.Update(bh); }
/// <summary> /// 新增 /// </summary> /// <param name="bh"></param> /// <returns></returns> public bool Add(tsuhan_sg_bhd bh) { return dal.Add(bh); ; }