//确定扣账操作 protected void Debit_action(object sender, EventArgs e) { try { if (String.IsNullOrWhiteSpace(update_man.Value) == false) { PageUtil.showToast(this, "该条调拨数据已扣账!请重新选择"); return; } //JS通过查询结果,绑定数据 int Exchange_line_id_debit = int.Parse(exchange_line_id_debit.Value); string In_subinventory = in_subinventory.Value; string Out_subinventory = out_subinventory.Value; string Item_name = item_name.Value; int Exchanged_qty = int.Parse(exchanged_qty.Value); //string Out_frame_key = out_frame_key.Value; //string In_frame_key = in_frame_key.Value; //用户手动输入数据 string Datecode_debit = datecode.Value; int Exchanged_qty_debit = int.Parse(exchanged_qty_debit.Value); string Out_frame_key = out_frame_key.Value; string In_frame_key = in_frame_key.Value; if (Exchanged_qty_debit < 0) { PageUtil.showToast(this, "调拨量应大于0"); return; } //检验实际退回量是否大于申请退料量 if (Exchanged_qty_debit != Exchanged_qty) { PageUtil.showToast(this, "调拨数量应等于申请调拨量"); return; } if (invoiceDC.getSubinventoryByFrame(Out_frame_key).Tables[0].Rows[0]["subinventory_name"].ToString() != Out_subinventory) { PageUtil.showToast(this, "请重新输入调出料架,该料架不属于该调出库别下"); return; } if (invoiceDC.getSubinventoryByFrame(In_frame_key).Tables[0].Rows[0]["subinventory_name"].ToString() != In_subinventory) { PageUtil.showToast(this, "请重新输入调入料架,该料架不属于该调入库别下"); return; } //扣账 int flag = invoiceDC.ExchangeDebitAction(DateTime.Now, user, Exchange_line_id_debit, Exchanged_qty_debit, In_subinventory, Out_subinventory, Item_name, Datecode_debit, Out_frame_key, In_frame_key); //扣账成功时 if (flag == 1) { PageUtil.showToast(this, "扣账成功!"); ExchangeHeaderReater.DataSource = null; ExchangeHeaderReater.DataBind(); ExchangeLineReater.DataSource = null; ExchangeLineReater.DataBind(); } else { if (flag == 5) { PageUtil.showAlert(this, "扣账失败,错误产生可能原因:\\n 1、没有对应数据,请检查料号+库别是否在库存总表有对应数据 \\n 2、库存量不够调拨,请检查onhand_quantiy "); return; } if (flag == 6) { PageUtil.showAlert(this, "扣账失败,错误产生可能原因:\\n 1、没有对应数据,请检查料号+料架+datecode是否在库存明细表中有对应数据(一般来说就是datecode输错了)\\n 2、剩余量不够调拨,请检查left_qty "); return; } } } catch (Exception e2) { PageUtil.showToast(this, "扣账失败!"); } }
//确定扣账操作 protected void Debit_action(object sender, EventArgs e) { try { //JS通过查询结果,绑定数据 string Flag = flag_debit.Value; int Issue_line_id_debit = int.Parse(issue_line_id_debit.Value); string Issued_sub = issued_sub.Value; //string Invoice_no = invoice_no.Value; string Item_name = item_name.Value; int Issued_qty = int.Parse(issued_qty.Value); //检验数据完整 if (datecode.Value == "" || issued_qty_debit.Value == "") { PageUtil.showToast(this, "请将数据填写完整"); return; } //用户选择输入数据 string Datecode_debit = datecode.Value; int Issued_qty_debit; string Frame = frame.Value; if (frame.Value == "") { PageUtil.showToast(this, "请输入料架后再操作"); return; } //用户非法输入 try { Issued_qty_debit = int.Parse(issued_qty_debit.Value); } catch (Exception e2) { PageUtil.showToast(this, "领料量请不要输入非数字"); return; } if (Flag == "Y") { PageUtil.showToast(this, "该条领料数据已扣账!请重新选择"); return; } if (Issued_qty_debit < 0) { PageUtil.showToast(this, "领料量应大于0"); return; } //检验实际领料量是否等于申请领料量 if (Issued_qty_debit != Issued_qty) { PageUtil.showToast(this, "领料数量应等于申请领料量"); return; } int status = 1; //默认为工单领料 if (wo_no.Value == "none") //非工单领料 { status = 0; } if (invoiceDC.getSubinventoryByFrame(Frame).Tables[0].Rows[0]["subinventory_name"].ToString() != Issued_sub) { PageUtil.showToast(this, "请重新输入料架,该料架不属于该库别下"); return; } //扣账 int flag = invoiceDC.IssueDebitAction(DateTime.Now, user, Issue_line_id_debit, Issued_qty_debit, Issued_sub, Frame, Item_name, Datecode_debit, status); //扣账执行成功时 if (flag == 1) { PageUtil.showToast(this, "扣账成功!"); IssueHeaderReater.DataSource = null; IssueHeaderReater.DataBind(); IssueLineReater.DataSource = null; IssueLineReater.DataBind(); } //扣账失败时,输出详细错误原因 else { if (flag == 3) { PageUtil.showAlert(this, "扣账失败,错误产生可能原因:\\n 1、没有对应数据,请检查料号+库别是否在库存总表有对应数据 \\n 2、库存量不够领料,请检查onhand_quantiy "); return; } if (flag == 4) { PageUtil.showAlert(this, "扣账失败,错误产生可能原因:\\n 1、没有对应数据,请检查料号+料架+datecode是否在库存明细表中有对应数据(一般来说就是datecode输错了) \\n 2、剩余量不够领料,请检查left_qty "); return; } } } catch (Exception e2) { PageUtil.showToast(this, "扣账失败!"); } }
//确定扣账操作 protected void Debit_action(object sender, EventArgs e) { try { //JS通过查询结果,绑定数据 int Flag = int.Parse(flag_debit.Value); int Return_line_id_debit = int.Parse(return_line_id_debit.Value); string Return_sub_name = return_sub_name.Value; //string Invoice_no = invoice_no.Value; string Item_name = item_name.Value; int Return_qty = int.Parse(return_qty.Value); //string Frame_key = frame_key.Value; //检验数据完整 if (datecode.Value == "") { PageUtil.showToast(this, "请将数据填写完整"); return; } //用户选择输入数据 string Datecode_debit = datecode.Value; int Return_qty_debit = int.Parse(return_qty_debit.Value); //int Frame_key = int.Parse(DropDownList_frame.SelectedValue.ToString()); string Frame_key = frame_key.Value; if (frame_key.Value == "") { PageUtil.showToast(this, "请输入料架再操作"); return; } if (Flag == 1) { PageUtil.showToast(this, "该条退料数据已扣账!请重新选择"); return; } if (Return_qty_debit < 0) { PageUtil.showToast(this, "退料量应大于0"); return; } //检验实际退回量是否等于申请退料量 if (Return_qty_debit != Return_qty) { PageUtil.showToast(this, "退料数量应等于申请退料量"); return; } int status = 1; //默认为工单退料 if (return_wo_no.Value == "none") //非工单退料 { status = 0; } if (invoiceDC.getSubinventoryByFrame(Frame_key).Tables[0].Rows[0]["subinventory_name"].ToString() != Return_sub_name) { PageUtil.showToast(this, "请重新输入料架,该料架不属于该库别下"); return; } //扣账 int flag = invoiceDC.DebitAction(DateTime.Now, user, Return_line_id_debit, Return_qty_debit, Return_sub_name, Frame_key, Item_name, Datecode_debit, status); //扣账成功 if (flag == 1) { PageUtil.showToast(this, "扣账成功!"); ReturnHeaderReater.DataSource = null; ReturnHeaderReater.DataBind(); ReturnLineReater.DataSource = null; ReturnLineReater.DataBind(); } //扣账失败时,输出详细错误原因 else { if (flag == 2) { PageUtil.showAlert(this, "扣账失败,错误产生可能原因:\\n 1、没有对应数据,请检查料号+库别是否在库存总表有对应数据 "); return; } if (flag == 3) { PageUtil.showAlert(this, "扣账失败,错误产生可能原因:\\n 1、没有对应数据,请检查料号+料架+datecode是否在库存明细表中有对应数据(一般来说就是datecode输错了)"); return; } } } catch (Exception e2) { PageUtil.showToast(this, "扣账失败!"); } }