protected void Button4_Click(object sender, EventArgs e) { Pickup_mtlDC DC = new Pickup_mtlDC(); string simulate_line_id = simulate_id.Value; DataSet ds = DC.is_issued(simulate_line_id); if (ds.Tables[0].Rows.Count > 0) { int j = DC.issued_qty(simulate_line_id); if (j == 1) { Work_Repeater.DataSource = DC.searchPickupBySimulate(simulate_line_id); Work_Repeater.DataBind(); PageUtil.showToast(this.Page, "发料成功"); } else { PageUtil.showToast(this.Page, "发料失败"); } } else { PageUtil.showToast(this.Page, "没有可以发的料"); } }
/** * * 查询备料信息* * **/ protected void Select(object sender, EventArgs e) { //从前台获取数据 string Simulate_id = simulate_id.Value; //判断备料单号是否为空 if (Simulate_id == "") { PageUtil.showToast(this, "备料单号不能为空!"); return; } //查询备料信息 Pickup_mtlDC pickup = new Pickup_mtlDC(); DataSet ds = new DataSet(); ds = pickup.searchBySimulate(Simulate_id); if (ds == null) { PageUtil.showToast(this, "表中无符合条件的数据!"); GridView1.DataSource = ds; GridView1.DataBind(); } else { GridView1.DataSource = ds; GridView1.DataBind(); Label1.Text = this.GridView1.Rows[0].Cells[2].Text.ToString(); } }
//分页 //protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) //{ // GridView1.PageIndex = e.NewPageIndex; // string SIMULATE_ID = simulate_id.Value; // if (!(Regex.IsMatch(SIMULATE_ID, "^[0-9]*$") || SIMULATE_ID == "")) // { // PageUtil.showAlert(this, "请输入数字!"); // return; // } // Pickup_mtlDC faliao = new Pickup_mtlDC(); // GridView1.DataSource = faliao.searchBySimulate(SIMULATE_ID); // GridView1.DataBind(); //} //备料单号查询 protected void Select(object sender, EventArgs e) { string SIMULATE_ID = simulate_id.Value; if (!(Regex.IsMatch(SIMULATE_ID, "^[0-9]*$") || SIMULATE_ID == "")) { PageUtil.showAlert(this, "请输入数字!"); return; } Pickup_mtlDC faliao = new Pickup_mtlDC(); Work_Repeater.DataSource = faliao.searchPickupBySimulate(SIMULATE_ID); Work_Repeater.DataBind(); }
//显示打印页面中的所有数据 protected void DataView() { Pickup_mtlDC pickup_mtlDC = new Pickup_mtlDC(); try { //绑定Repeater中数据 DataSet dataset = new DataSet(); dataset = pickup_mtlDC.getSomeBySimulate_id(int.Parse(select_text.Value)); printSinglePreparationRepeater.DataSource = dataset; printSinglePreparationRepeater.DataBind(); } catch (Exception e) { PageUtil.showToast(this, "数据库中没有对应数据,请重新输入備料單号"); } }
//发料 protected void Store_issue(object sender, EventArgs e) { Pickup_mtlDC DC = new Pickup_mtlDC(); string SIMULATE = simulate.Value; string ITEM_ID = item_id1.Value; //string PICKUP_QTY = pickup_qty.Value; string ISSUED_QTY = issued_qty.Value; int IQ = int.Parse(ISSUED_QTY); int simulate_id = int.Parse(SIMULATE); int item_id = int.Parse(ITEM_ID); //int PQ=int.Parse(PICKUP_QTY); lock (this) { int num = DC.search_issue_num(simulate_id, item_id); if (num == -1) { PageUtil.showToast(this.Page, "没有符合的数据"); } else if (IQ > num) { PageUtil.showToast(this, "发料失败,发料数量多于剩余的备料数量!"); } else { Pickup_mtlDC faliao1 = new Pickup_mtlDC(); DataSet ds = new DataSet(); ds = faliao1.Issue(simulate_id, IQ, item_id); if (ds == null) { Work_Repeater.DataSource = ds; Work_Repeater.DataBind(); PageUtil.showToast(this.Page, "发料失败"); } else { Work_Repeater.DataSource = ds; Work_Repeater.DataBind(); issued_qty.Value = null; PageUtil.showToast(this, "发料成功"); } } } }
/** * * 备料* * **/ protected void Pickup(object sender, EventArgs e) { //从前台获取数据 string INDC = indc.Value; Pickup_mtlDC pickup = new Pickup_mtlDC(); //判断条码信息是否为空和输入格式是否正确 if (INDC == "") { PageUtil.showToast(this, "条码信息不能为空!"); return; } else if (!Regex.IsMatch(INDC, @"[\w]+.[\w]+#\d+#\d+")) { PageUtil.showToast(this, "格式输入不正确!"); return; } //提取条码信息中的数据 string[] s = INDC.Split(new char[] { '#' }); string Item_id = s[0]; Nu_Leng(Item_id, "料号"); string Number = s[1]; Nu_Leng(Number, "数量"); //判断是否是数字字符串,是则将其转换成整型 if (!Regex.IsMatch(Number, @"\d+")) { PageUtil.showToast(this, "数量应为整型!"); } int number = int.Parse(Number); string Datecode = s[2]; //int item_id = 0; Da_Leng(Datecode, "DateCode"); //try //{ // item_id = int.Parse(Item_id); //} //catch (Exception e2) //{ // PageUtil.showToast(this.Page, "请输入Item_ID#数量#DataCode"); // return; //} //先查询后才能备料 if (Label1.Text == "工单号") { PageUtil.showToast(this, "请先查询!"); return; } //从表格中获取数据 //string Simulate_id = this.GridView1.Rows[0].Cells[1].Text.ToString(); //string ITEM_ID = this.GridView1.Rows[0].Cells[4].Text.ToString(); //string SIMULATED_QTY = this.GridView1.Rows[0].Cells[6].Text.ToString(); //string PICKUP_QTY = this.GridView1.Rows[0].Cells[8].Text.ToString(); //将字符串转换成整型 //int simulated_qty=int.Parse (SIMULATED_QTY); //int pickup_qty = int.Parse(PICKUP_QTY); //int sum = number + pickup_qty; //string Num = sum.ToString(); //判断输入的料号与表格中的料号是否相等 int simulate = 0; if (simulate_id.Value.ToString() != "") { simulate = int.Parse(simulate_id.Value.ToString()); } else { PageUtil.showToast(this.Page, "请先查询备料单号"); return; } if (number < 0) { PageUtil.showToast(this, "备料的数量应该大于0"); return; } else { lock (this) { int[] num = pickup.search_pickup_num(simulate, Item_id, Datecode); if (num == null) { PageUtil.showToast(this.Page, "没有符合的数据,请再次输入"); return; } if (number > num[0]) { PageUtil.showToast(this, "数量超出!"); return; } else { DataSet ds = new DataSet(); ds = pickup.preparation(simulate, Item_id, number, Datecode, num[1]); if (ds == null) { PageUtil.showToast(this.Page, "备料失败"); } else { GridView1.DataSource = ds; GridView1.DataBind(); PageUtil.showToast(this, "备料成功"); } } } } }