//领料工单号改变时 protected void DropDownList_issue_wo_no_SelectedIndexChanged(object sender, EventArgs e) { //领料工单号与料号的的二级联动 try { DropDownList_item_name.Items.Clear(); string text = DropDownList_issue_wo_no.SelectedValue.ToString(); DataSet ds_item_name = invoiceDC.getItem_nameByIssue_wo_no(text); if (ds_item_name != null) { DropDownList_item_name.DataSource = ds_item_name.Tables[0].DefaultView; DropDownList_item_name.DataValueField = "item_name"; DropDownList_item_name.DataTextField = "item_name"; DropDownList_item_name.DataBind(); } DropDownList_item_name.Items.Insert(0, "--选择小料号--"); DropDownList_item_name.SelectedIndex = 1; } catch (Exception e2) { PageUtil.showToast(this, "领料工单号与小料号二级联动失败,请检查工单物料需求表"); return; } //根据工单号,和料号。拿需求量和发料量 try { if (invoice_no.Value == "") { PageUtil.showToast(this, "请输入领料单号再操作"); return; } //检测是否为工单领料,如果是,则需求量,发料量从工单物料需求表中带出 DataSet ds = invoiceDC.getIssueHeaderBySome(invoice_no.Value, "", ""); if (ds == null) { PageUtil.showToast(this, "该领料单号不存在,请重新输入(确保已经申请成功)"); return; } if (ds.Tables[0].Rows[0]["issue_type"].ToString() == "工单领料") { DataSet ds2 = invoiceDC.getRequirement(DropDownList_issue_wo_no.SelectedValue.ToString(), DropDownList_item_name.SelectedValue.ToString()); required_qty.Value = ds2.Tables[0].Rows[0]["required_qty"].ToString(); simulated_qty.Value = ds2.Tables[0].Rows[0]["issued_qty"].ToString(); } else { required_qty.Value = "0"; simulated_qty.Value = "0"; } } catch (Exception ex) { PageUtil.showToast(this, "获取需求量,发料量失败,请检查工单物料需求表"); return; } ////料号与料架的二级联动,去库存明细表中找有此料号的料架 //try //{ // DropDownList_frame_key.Items.Clear(); // string text = DropDownList_item_name.SelectedValue.ToString(); // DataSet ds_frame_key = invoiceDC.getFrameByItem_name(text); // if (ds_frame_key != null) // { // DropDownList_frame_key.DataSource = ds_frame_key.Tables[0].DefaultView; // DropDownList_frame_key.DataValueField = "frame_name"; // DropDownList_frame_key.DataTextField = "frame_name"; // DropDownList_frame_key.DataBind(); // } // DropDownList_frame_key.Items.Insert(0, "--选择料架--"); // DropDownList_frame_key.SelectedIndex = 1; //} //catch (Exception e2) //{ // PageUtil.showToast(this, "小料号与料架二级联动失败,请检查库存明细表"); // return; //} ////料架与库别的二级联动 //try //{ // DropDownList_issue_sub_key.Items.Clear(); // string text = DropDownList_frame_key.SelectedValue.ToString(); // DataSet ds_issue_sub_key = invoiceDC.getSubinventoryByFrame(text); // if (ds_issue_sub_key != null) // { // DropDownList_issue_sub_key.DataSource = ds_issue_sub_key.Tables[0].DefaultView; // DropDownList_issue_sub_key.DataValueField = "subinventory_name"; // DropDownList_issue_sub_key.DataTextField = "subinventory_name"; // DropDownList_issue_sub_key.DataBind(); // } // DropDownList_issue_sub_key.Items.Insert(0, "--选择库别--"); // DropDownList_issue_sub_key.SelectedIndex = 1; //} //catch (Exception e2) //{ // PageUtil.showToast(this, "料架与库别二级联动失败,请检查是否有关联数据"); // return; //} //料号与库别的二级联动,去库存总表中找有此料号的库别 try { DropDownList_issue_sub_key.Items.Clear(); string text = DropDownList_item_name.SelectedValue.ToString(); DataSet ds_issue_sub_key = invoiceDC.getSubinventoryByItem_name(text); if (ds_issue_sub_key != null) { DropDownList_issue_sub_key.DataSource = ds_issue_sub_key.Tables[0].DefaultView; DropDownList_issue_sub_key.DataValueField = "subinventory"; DropDownList_issue_sub_key.DataTextField = "subinventory"; DropDownList_issue_sub_key.DataBind(); DropDownList_issue_sub_key.Items.Insert(0, "--选择库别--"); DropDownList_issue_sub_key.SelectedIndex = 1; } else { PageUtil.showToast(this, "料号与库别二级联动失败,请检查库存总表"); return; } } catch (Exception e2) { PageUtil.showToast(this, "料号与库别二级联动失败,请检查库存总表"); return; } }
//选择退料工单号时触发 protected void DropDownList_return_wo_no_SelectedIndexChanged(object sender, EventArgs e) { //退料工单号与料号的二级联动,从工单物料需求表中带出料号 try { DropDownList_item_name.Items.Clear(); string text = DropDownList_return_wo_no.SelectedValue.ToString(); DataSet ds_item_name = invoiceDC.getItem_nameByReturn_wo_no(text); if (ds_item_name != null) { DropDownList_item_name.DataSource = ds_item_name.Tables[0].DefaultView; DropDownList_item_name.DataValueField = "item_name"; DropDownList_item_name.DataTextField = "item_name"; DropDownList_item_name.DataBind(); } DropDownList_item_name.Items.Insert(0, "--选择料号--"); DropDownList_item_name.SelectedIndex = 1; } catch (Exception e2) { PageUtil.showToast(this, "退料工单号与料号二级联动失败,请检查工单物料需求表是否有关联数据"); return; } //根据工单号和料号,从工单物料需求表中带出发料量+领料量 try { if (invoice_no.Value == "") { PageUtil.showToast(this, "请输入退料单号再做操作"); return; } DataSet ds = invoiceDC.getReturnHeaderBySome(invoice_no.Value, "", ""); if (ds == null) { PageUtil.showToast(this, "该退料单不存在,请重新输入(请确保申请成功)"); return; } //检测是否为工单退料,如果是,则退料上限为发料量+领料量从工单物料需求表中带出 if (ds.Tables[0].Rows[0]["return_type"].ToString() == "工单退料") { DataSet ds2 = invoiceDC.getRequirement(DropDownList_return_wo_no.SelectedValue.ToString(), DropDownList_item_name.SelectedValue.ToString()); Limit_return = int.Parse(ds2.Tables[0].Rows[0]["issue_invoice_qty"].ToString()) + int.Parse(ds2.Tables[0].Rows[0]["issued_qty"].ToString()); return_limit.Value = Limit_return.ToString(); } else { return_limit.Value = "none"; } } catch (Exception ex) { PageUtil.showToast(this, "获取领料量,发料量失败,请检查是否工单物料需求表有关联数据"); return; } ////料号与料架的二级联动,去库存明细表中找有此料号的料架 //try //{ // DropDownList_frame_key.Items.Clear(); // string text = DropDownList_item_name.SelectedValue.ToString(); // DataSet ds_frame_key = invoiceDC.getFrameByItem_name(text); // if (ds_frame_key != null) // { // DropDownList_frame_key.DataSource = ds_frame_key.Tables[0].DefaultView; // DropDownList_frame_key.DataValueField = "frame_name"; // DropDownList_frame_key.DataTextField = "frame_name"; // DropDownList_frame_key.DataBind(); // } // DropDownList_frame_key.Items.Insert(0, "--选择料架--"); // DropDownList_frame_key.SelectedIndex = 1; //} //catch (Exception e2) //{ // PageUtil.showToast(this, "料号与料架二级联动失败,请检查库存明细表是否有关联数据"); // return; //} ////料架与库别的二级联动 //try //{ // DropDownList_return_sub_key.Items.Clear(); // string text = DropDownList_frame_key.SelectedValue.ToString(); // DataSet ds_return_sub_key = invoiceDC.getSubinventoryByFrame(text); // if (ds_return_sub_key != null) // { // DropDownList_return_sub_key.DataSource = ds_return_sub_key.Tables[0].DefaultView; // DropDownList_return_sub_key.DataValueField = "subinventory_key"; // DropDownList_return_sub_key.DataTextField = "subinventory_name"; // DropDownList_return_sub_key.DataBind(); // } // DropDownList_return_sub_key.Items.Insert(0, "--选择库别--"); // DropDownList_return_sub_key.SelectedIndex = 1; //} //catch (Exception e2) //{ // PageUtil.showToast(this, "料架与库别二级联动失败,请检查是否有关联数据"); // return; //} }