//确定扣账操作 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, "扣账失败!"); } }