//提交退料单单头 protected void Return_Header_Commit(object sender, EventArgs e) { try { //注:主表不插工单号 string Invoice_no = invoice_no.Value; string Flex_value = DropDownList_Flax_value.SelectedValue.ToString(); string Description = DropDownList_description.SelectedValue.ToString(); string Return_type = Request.Form["return_type"]; string Remark = remark.Value; if (Flex_value == "--选择部门代码--" || Description == "--选择部门名称--" || Return_type == "") { PageUtil.showToast(this, "请将信息填写完全(可不填退料原因)"); return; } if (string.IsNullOrWhiteSpace(Invoice_no)) { PageUtil.showToast(this, "请生成单据号或填写单据号再操作"); return; } if (invoiceDC.getReturnHeaderBySome(Invoice_no, "", "") != null) { PageUtil.showToast(this, "单据号已存在,请重新生成"); return; } //对单据号的判断,防止乱输入单据号 @是将不能转义的字符转义 Regex r = new Regex(@"^[F][1-9]\d{8}$"); Match m = r.Match(Invoice_no.Trim()); if (m.Success == false) { PageUtil.showToast(this, "请按规则输入单据号"); return; } bool flag = invoiceDC.insertReturn_header(Invoice_no, Return_type, Flex_value, Description, Remark); if (flag == true) { PageUtil.showToast(this, "生成退料单单头成功"); DropDownList_Flax_value.SelectedValue = "--选择部门代码--"; DropDownList_description.SelectedValue = "--选择部门名称--"; remark.Value = ""; } else { PageUtil.showToast(this, "插入失败"); } } catch (Exception e1) { PageUtil.showToast(this, "插入失败"); } }