//保存 protected void btnsave_Click(object sender, EventArgs e) { if (rptList.Items.Count > 0) { bool result = true; //判断当前发运数量已超出可发运量 bool result2 = true; //计划发运量是否超出原订单量 bool result3 = true; //计划发运量是否超出当日发运总指标 int row = 0; //行号 for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单ID HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputText txtarea = (HtmlInputText)rptList.Items[i].FindControl("txtarea"); //区域 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 Literal ltlmatcode = (Literal)rptList.Items[i].FindControl("ltlmatcode"); //物料编码 Literal ltlorderwgt = (Literal)rptList.Items[i].FindControl("ltlorderwgt"); //订单量 //订单可超出量 decimal orderwgt = (Convert.ToDecimal(ltlorderwgt.Text) * Convert.ToDecimal(hidsfwgt.Value ?? "0")) + Convert.ToDecimal(ltlorderwgt.Text); //订单已出库量+订单在途量+在做计划量 decimal fysumwgt = tmo_order.GetYLX_YFWGT(chkOrder.Value) + Convert.ToDecimal(txtjhfyl.Value ?? "0"); //判断当前区域发运量是否超出当日发运总指标 if (tmd_dispatch.GetAreaFyZb(txtarea.Value, Convert.ToDecimal(txtjhfyl.Value ?? "0"))) { //判断当前计划发运量是否超出原订单量 if (fysumwgt > orderwgt) { row = i + 1; result2 = false; break; } else { //判断当前发运数量已超出可发运量 if (!tmo_order.IsFy(Convert.ToDecimal(txtjhfyl.Value ?? "0"), ltlmatcode.Text, txtStd_Code.Text, txtarea.Value, txtPack_Code.Text, dropzldj.SelectedItem.Text)) { result = false; } } } else { row = i + 1; result3 = false; break; } } if (result3) //计划发运量是否超出当日发运总指标 { if (result2) //计划发运量是否超出原订单量 { if (result) //判断当前发运数量已超出可发运量 { if (InsertFyd()) { WebMsg.MessageBox("保存成功", "fydEdit.aspx?ID=" + txtsendcode.Text); } } else { WebMsg.MessageBox("当前发运数量已超出可发运量"); } } else { decimal pl = Convert.ToDecimal(hidsfwgt.Value) * 100; WebMsg.MessageBox("当前第" + row + "行,计划发运数量已超出订单数量" + pl + "%"); } } else { WebMsg.MessageBox("当前第" + row + "行,计划发运数量已超出发运指标,请联系相关负责人进行处理!"); } } else { WebMsg.MessageBox("请添加发运明细"); } }
//保存 protected void btnsave_Click(object sender, EventArgs e) { if (ltlempid.Text == ltlzdrID.Text) { Bll_TMD_CAR_NUMBER tmd_car_number = new Bll_TMD_CAR_NUMBER(); bool result6 = tmd_car_number.Exists(txtcph.Text.Trim());//判断车号禁止发运 if (result6) { WebMsg.MessageBox("该车号已经连续3次未接受GPS任务,已被禁止制作发运单"); } else { bool result = true; bool result2 = true; //计划发运量是否超出原订单量 bool sfxc = dropsfxc.SelectedItem.Text == "是" ? true : false; //是否线材销售 int row = 0; //行号 #region //数据操作 for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单ID HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputText txtarea = (HtmlInputText)rptList.Items[i].FindControl("txtarea"); //区域 HtmlInputText txtflag = (HtmlInputText)rptList.Items[i].FindControl("txtflag"); //标识Y/N 原订单/新订单 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 Literal ltlmatcode = (Literal)rptList.Items[i].FindControl("ltlmatcode"); //物料编码 Literal ltloldfyl = (Literal)rptList.Items[i].FindControl("ltloldfyl"); //原发运计划量 Literal ltlorderwgt = (Literal)rptList.Items[i].FindControl("ltlorderwgt"); //订单量 //订单可超出量 decimal orderwgt = (Convert.ToDecimal(ltlorderwgt.Text) * Convert.ToDecimal(hidsf.Value)) + Convert.ToDecimal(ltlorderwgt.Text); //订单已出库量+订单在途量+在做计划量 decimal fysumwgt = tmo_order.GetYLX_YFWGT(chkOrder.Value) + Convert.ToDecimal(txtjhfyl.Value ?? "0"); if (fysumwgt > orderwgt) { row = i + 1; result2 = false; break; } else { if (sfxc)//线材 { if (!tmo_order.IsFy_Edit(Convert.ToDecimal(txtjhfyl.Value ?? "0"), Convert.ToDecimal(ltloldfyl.Text == "" ? "0" : ltloldfyl.Text), ltlmatcode.Text, txtStd_Code.Text, txtarea.Value, txtPack_Code.Text, dropzldj.SelectedItem.Text)) { result = false; } } } } #endregion if (result2) { if (sfxc)//线材 { if (result) { if (UpdateFyd()) { WebMsg.MessageBox("保存成功"); BindList(); } } else { WebMsg.MessageBox("当前发运数量已超出可发运量"); } } else { if (UpdateFyd()) { WebMsg.MessageBox("保存成功"); BindList(); } } } else { decimal pl = Convert.ToDecimal(hidsf.Value) * 100; WebMsg.MessageBox("当前第" + row + "行,计划发运数量已超出订单数量" + pl + "%"); } } } else { WebMsg.MessageBox("当前用户与发运制单人不符,无权限操作!"); } }
//保存 protected void btnsave_Click(object sender, EventArgs e) { Bll_TMD_CAR_NUMBER tmd_car_number = new Bll_TMD_CAR_NUMBER(); Session["DT" + ltlempid.Text] = null; bool result6 = tmd_car_number.Exists(txtcph.Text.Trim());//判断车号禁止发运 if (result6) { WebMsg.MessageBox("该车号已经连续3次未接受GPS任务,已被禁止制作发运单"); } else { if (rptList.Items.Count > 0) { bool result = true; //判断当前发运数量已超出可发运量 bool result2 = true; //计划发运量是否超出原订单量 bool result3 = true; //计划发运量是否超出当日发运总指标 bool result4 = true; //钢坯发运 bool result5 = true; //是否GPS bool result7 = true; //是包到价,到货地点必须 bool sfxc = dropsfxc.SelectedItem.Text == "是" ? true : false; //是否线材销售 int row = 0; //行号 for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单ID HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputText txtarea = (HtmlInputText)rptList.Items[i].FindControl("txtarea"); //区域 HtmlInputHidden hidckid = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid"); //仓库主键 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 Literal ltlmatcode = (Literal)rptList.Items[i].FindControl("ltlmatcode"); //物料编码 Literal ltlorderwgt = (Literal)rptList.Items[i].FindControl("ltlorderwgt"); //订单量 Literal ltlcustno = (Literal)rptList.Items[i].FindControl("ltlcustno"); //客户编码 Literal ltlC_CON_NO = (Literal)rptList.Items[i].FindControl("ltlC_CON_NO"); //合同号 Literal ltlC_CUST_NAME = (Literal)rptList.Items[i].FindControl("ltlC_CUST_NAME"); //客户信息 HtmlInputText txtaddr = (HtmlInputText)rptList.Items[i].FindControl("txtaddr"); //到货地点费用 if (dropsfbdj.SelectedValue == "0") //判定是否包到价 { //校验是否GPS if (bllgps.GpsFyd(ltlcustno.Text, dropfyfs.SelectedValue, txtarea.Value, ltlmatcode.Text)) { if (string.IsNullOrEmpty(txtgps.Text)) { result5 = false; break; } } } else { if (string.IsNullOrEmpty(txtaddr.Value)) { result7 = false; break; } } //订单原始量+订单可超出量合计数 decimal orderwgt = (Convert.ToDecimal(ltlorderwgt.Text) * Convert.ToDecimal(hidsfwgt.Value ?? "0")) + Convert.ToDecimal(ltlorderwgt.Text); //订单已出库量+订单在途量+在做计划量 decimal fysumwgt = tmo_order.GetYLX_YFWGT(chkOrder.Value) + Convert.ToDecimal(txtjhfyl.Value ?? "0"); if (sfxc) //钢坯发运 { if (!string.IsNullOrEmpty(hidckid.Value)) //仓库不能为空 { row = i + 1; result4 = false; break; } } //判断当前区域发运量是否超出当日发运总指标 if (tmd_dispatch.GetAreaFyZb(txtarea.Value, Convert.ToDecimal(txtjhfyl.Value ?? "0"))) { //判断当前计划发运量是否超出原订单量 if (fysumwgt > orderwgt) { row = i + 1; result2 = false; break; } else { if (sfxc) //是否线材销售 { string areafalg = ts_dic.GetAreaFlag(txtarea.Value); //获取区域是否按客户发运Y/N if (areafalg == "N") { //判断当前发运数量已超出可发运量 if (!tmo_order.IsFy(Convert.ToDecimal(txtjhfyl.Value ?? "0"), ltlmatcode.Text, txtStd_Code.Text, txtarea.Value, txtPack_Code.Text, dropzldj.SelectedItem.Text)) { result = false; break; } } else//按区域客户控制发运 { //判断当前发运数量已超出可发运量 if (!tmo_order.IsFy(Convert.ToDecimal(txtjhfyl.Value ?? "0"), ltlmatcode.Text, txtStd_Code.Text, txtarea.Value, txtPack_Code.Text, dropzldj.SelectedItem.Text, ltlC_CUST_NAME.Text, ltlC_CON_NO.Text)) { result = false; break; } } } } } else { row = i + 1; result3 = false; break; } } if (result7) //是包到价,到货地点必须 { if (result5) //校验是否GPS { if (result4) //判定是否钢坯发运 { if (result3) //计划发运量是否超出当日发运总指标 { if (result2) //计划发运量是否超出原订单量 { if (sfxc) //是否线材销售 { if (result) //判断当前发运数量已超出可发运量 { if (InsertFyd()) { WebMsg.MessageBox("保存成功", "fydEdit.aspx?ID=" + txtsendcode.Text); } } else { WebMsg.MessageBox("当前发运数量已超出可发运量"); } } else { if (InsertFyd()) { WebMsg.MessageBox("保存成功", "fydEdit.aspx?ID=" + txtsendcode.Text); } } } else { decimal pl = Convert.ToDecimal(hidsfwgt.Value) * 100; WebMsg.MessageBox("当前第" + row + "行,计划发运数量已超出订单数量" + pl + "%"); } } else { WebMsg.MessageBox("当前第" + row + "行,计划发运数量已超出发运指标,请联系相关负责人进行处理!"); } } else { WebMsg.MessageBox("当前第" + row + "行,仓库不能为空!"); } } else { WebMsg.MessageBox("GPS号或到站不能为空!"); } } else { WebMsg.MessageBox("表体行到货地点不能为空"); } } else { WebMsg.MessageBox("请添加发运明细"); } } }