/// <summary> /// 添加发运单 /// </summary> /// <returns></returns> private bool InsertFyd() { decimal fyzs = 0; decimal fywgt = 0; string sendcode = randomnumber.CreateDispID(); //发运单据号 #region //表体 List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>(); for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单主键 HtmlInputText txtfyzs = (HtmlInputText)rptList.Items[i].FindControl("txtfyzs"); //发运支数 HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputHidden hidC_CGID = (HtmlInputHidden)rptList.Items[i].FindControl("hidC_CGID"); //收货单位 HtmlInputHidden hidshdq = (HtmlInputHidden)rptList.Items[i].FindControl("hidshdq"); //收货地区 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 DropDownList dropshdz = (DropDownList)rptList.Items[i].FindControl("dropshdz"); //收货地址 Literal ltlpkplan = (Literal)rptList.Items[i].FindControl("ltlpkplan"); //日计划主键 Literal ltlcustno = (Literal)rptList.Items[i].FindControl("ltlcustno"); //客户编码 HtmlInputHidden hidckid = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid"); //仓库ID HtmlInputText txtckname = (HtmlInputText)rptList.Items[i].FindControl("txtckname"); //仓库名称 HtmlInputText txtqtyq = (HtmlInputText)rptList.Items[i].FindControl("txtqtyq"); //其他要求 HtmlInputText txtremark = (HtmlInputText)rptList.Items[i].FindControl("txtremark"); //行备注 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 TextBox txtC_FREE1 = (TextBox)rptList.Items[i].FindControl("txtC_FREE1"); //自由项1 TextBox txtC_FREE2 = (TextBox)rptList.Items[i].FindControl("txtC_FREE2"); //自由项2 Mod_TMO_ORDER modOrder = tmo_order.GetModel(chkOrder.Value); if (modOrder != null) { fyzs += Convert.ToDecimal(txtfyzs.Value ?? "0"); fywgt += Convert.ToDecimal(txtjhfyl.Value ?? "0"); Mod_TMD_DISPATCHDETAILS modfyditem = new Mod_TMD_DISPATCHDETAILS(); modfyditem.C_DISPATCH_ID = sendcode; //发运单单据号 modfyditem.C_MAT_CODE = modOrder.C_MAT_CODE; //物料编码 modfyditem.C_MAT_NAME = modOrder.C_MAT_NAME; //物料名称 modfyditem.C_SPEC = modOrder.C_SPEC; //规格 modfyditem.C_STL_GRD = modOrder.C_STL_GRD; //钢种 modfyditem.C_QUALIRY_LEV = dropzldj.SelectedItem.Value; //质量等级主键-发运单 modfyditem.C_JUDGE_LEV_ZH = dropzldj.SelectedItem.Text; //质量等级编码 modfyditem.C_FREE_TERM = txtC_FREE1.Text; //自由项 modfyditem.C_FREE_TERM2 = txtC_FREE2.Text; //自由项 modfyditem.C_PACK = txtPack_Code.Text; //包装要求 modfyditem.C_STD_CODE = txtStd_Code.Text; //执行标准 modfyditem.C_ELSENEED = txtqtyq.Value; //其他要求? modfyditem.C_REMARK = txtremark.Value; //行备注***** modfyditem.N_COM_AMOUNT_WGT = modOrder.N_FNUM; //原始订单辅数量 modfyditem.N_WGT = modOrder.N_WGT; //原始订单数量 modfyditem.C_EQUATION_FACTOR = modOrder.N_HSL.ToString(); //换算率 modfyditem.C_UNITIS = modOrder.C_UNITID; //主计量单位ID modfyditem.C_ORGO_CUST = modOrder.C_CUST_NAME; //订货客户 modfyditem.C_CGC = hidC_CGID.Value; //收货单位-发运单 modfyditem.C_ORDER_TYPE = modOrder.N_TYPE.ToString() == "8" ? "805" : modOrder.N_TYPE.ToString(); //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyditem.C_SEND_AREA = hidshdq.Value; //到货地区-发运单 modfyditem.C_AREA = dropshdz.SelectedItem?.Value ?? ""; //到货地址-发运单 modfyditem.C_EMP_ID = ltlempid.Text; modfyditem.C_EMP_NAME = ltlempname.Text; modfyditem.C_CON_NO = modOrder.C_CON_NO; //合同号 modfyditem.C_PLAN_ID = ltlpkplan.Text; //日计划主键 modfyditem.C_NO = modOrder.C_ORDER_NO; //订单号 modfyditem.C_ORDERPK = modOrder.C_ID; //订单主键 modfyditem.C_CUSTNO = ltlcustno.Text; //客户编码 modfyditem.N_FYZS = Convert.ToDecimal(txtfyzs.Value == "" ? "0" : txtfyzs.Value); //发运支数 modfyditem.N_FYWGT = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value); //发运数量 modfyditem.C_SEND_STOCK = txtckname.Value; //发运仓库名称 modfyditem.C_SEND_STOCK_PK = hidckid.Value; //发运仓库ID modfyditem.C_PRODUCT_ID = ""; //库存产品ID modfyditem.C_AU_UNITIS = modOrder.C_FUNITID; //辅单位 modfyditem.N_PRICE = 0; //到货地点费用 item.Add(modfyditem); } } #endregion #region//表头 Mod_TMD_DISPATCH modfyd = new Mod_TMD_DISPATCH(); modfyd.C_ID = sendcode; //发运单单据号 modfyd.C_GPS_NO = txtgps.Text; //GPS号 modfyd.D_DISP_DT = Convert.ToDateTime(txtfydt.Text); //发运日期 modfyd.C_SHIPVIA = dropfyfs.SelectedItem.Value; //发运方式 modfyd.C_COMCAR = dropcys.SelectedItem.Value; //承运商 modfyd.C_IS_WIRESALE = dropsfxc.SelectedItem.Text; //汉字是否线材 modfyd.C_IS_WIRESALE_ID = dropsfxc.SelectedItem.Value; //是否线材主键 modfyd.C_LIC_PLA_NO = txtcph.Text; //车牌号 modfyd.C_ATSTATION = txtdz.Text; //到站 modfyd.C_CREATE_ID = ltlempid.Text; //制单人 modfyd.C_EMP_ID = ltlempid.Text; //修改人ID modfyd.C_EMP_NAME = ltlempname.Text; //修改人 modfyd.C_EXTEND5 = ltltype.Text; //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyd.C_CUSTNAME = ltlcustname.Text; //客户 modfyd.C_CON_NO = ltlcon_no.Text; //合同号 modfyd.N_QUA = fyzs; //发运支数 modfyd.N_WGT = fywgt; //发运量 modfyd.N_IS_EXPORT = 0; //是否包到价 modfyd.C_EXTEND2 = txtcph.Text; //虚拟车号 Mod_TMO_CON modCon = tmo_con.GetModel(ltlcon_no.Text); if (modCon != null) { modfyd.C_BUSINESS_DEPT = modCon.C_DEPTID; //业务部门 modfyd.C_BUSINESS_ID = modCon.C_EMPLOYEEID; //业务员 } #endregion if (tmd_dispatch.InsertFYD(modfyd, item)) { txtsendcode.Text = sendcode; return(true); } else { return(false); } }
/// <summary> /// 添加发运单 /// </summary> /// <returns></returns> private bool InsertFyd() { decimal fyzs = 0; decimal fywgt = 0; string sendcode = randomnumber.CreateDispID(); //发运单据号 #region //表体 List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>(); //发运明显 List <Mod_TMC_TRAIN_ITEM> trainList = new List <Mod_TMC_TRAIN_ITEM>(); //火运计划申请明显 for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单主键 HtmlInputText txtfyzs = (HtmlInputText)rptList.Items[i].FindControl("txtfyzs"); //发运支数 HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputHidden hidC_CGID = (HtmlInputHidden)rptList.Items[i].FindControl("hidC_CGID"); //收货单位 HtmlInputHidden hidshdq = (HtmlInputHidden)rptList.Items[i].FindControl("hidshdq"); //收货地区 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 DropDownList dropshdz = (DropDownList)rptList.Items[i].FindControl("dropshdz"); //收货地址 Literal ltlpkplan = (Literal)rptList.Items[i].FindControl("ltlpkplan"); //日计划主键 Literal ltlcustno = (Literal)rptList.Items[i].FindControl("ltlcustno"); //客户编码 HtmlInputHidden hidckid = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid"); //仓库ID HtmlInputText txtckname = (HtmlInputText)rptList.Items[i].FindControl("txtckname"); //仓库名称 HtmlInputText txtqtyq = (HtmlInputText)rptList.Items[i].FindControl("txtqtyq"); //其他要求 HtmlInputText txtremark = (HtmlInputText)rptList.Items[i].FindControl("txtremark"); //行备注 HtmlInputText txtaddr = (HtmlInputText)rptList.Items[i].FindControl("txtaddr"); //到货地点 HtmlInputText txtprice = (HtmlInputText)rptList.Items[i].FindControl("txtprice"); //费用 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 TextBox txtC_FREE1 = (TextBox)rptList.Items[i].FindControl("txtC_FREE1"); //自由项1 TextBox txtC_FREE2 = (TextBox)rptList.Items[i].FindControl("txtC_FREE2"); //自由项2 Mod_TMO_ORDER modOrder = tmo_order.GetModel(chkOrder.Value); if (modOrder != null) { fyzs += Convert.ToDecimal(txtfyzs.Value ?? "0"); fywgt += Convert.ToDecimal(txtjhfyl.Value ?? "0"); Mod_TMD_DISPATCHDETAILS modfyditem = new Mod_TMD_DISPATCHDETAILS(); modfyditem.C_DISPATCH_ID = sendcode; //发运单单据号 modfyditem.C_MAT_CODE = modOrder.C_MAT_CODE; //物料编码 modfyditem.C_MAT_NAME = modOrder.C_MAT_NAME; //物料名称 modfyditem.C_SPEC = modOrder.C_SPEC; //规格 modfyditem.C_STL_GRD = modOrder.C_STL_GRD; //钢种 modfyditem.C_QUALIRY_LEV = dropzldj.SelectedItem.Value; //质量等级主键-发运单 modfyditem.C_JUDGE_LEV_ZH = dropzldj.SelectedItem.Text; //质量等级编码 modfyditem.C_FREE_TERM = txtC_FREE1.Text; //自由项 modfyditem.C_FREE_TERM2 = txtC_FREE2.Text; //自由项 modfyditem.C_PACK = txtPack_Code.Text; //包装要求 modfyditem.C_STD_CODE = txtStd_Code.Text; //执行标准 modfyditem.C_ELSENEED = txtqtyq.Value; //其他要求? modfyditem.C_REMARK = txtremark.Value; //行备注***** modfyditem.N_COM_AMOUNT_WGT = modOrder.N_FNUM; //原始订单辅数量 modfyditem.N_WGT = modOrder.N_WGT; //原始订单数量 modfyditem.C_EQUATION_FACTOR = modOrder.N_HSL.ToString(); //换算率 modfyditem.C_UNITIS = modOrder.C_UNITID; //主计量单位ID modfyditem.C_ORGO_CUST = modOrder.C_CUST_NAME; //订货客户 modfyditem.C_CGC = hidC_CGID.Value; //收货单位-发运单 modfyditem.C_ORDER_TYPE = modOrder.N_TYPE.ToString(); //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyditem.C_SEND_AREA = hidshdq.Value; //到货地区-发运单 modfyditem.C_AREA = dropshdz.SelectedItem?.Value ?? ""; //到货地址-发运单 modfyditem.C_EMP_ID = ltlempid.Text; modfyditem.C_EMP_NAME = ltlempname.Text; modfyditem.C_CON_NO = modOrder.C_CON_NO; //合同号 modfyditem.C_PLAN_ID = ltlpkplan.Text; //日计划主键 modfyditem.C_NO = modOrder.C_ORDER_NO; //订单号 modfyditem.C_ORDERPK = modOrder.C_ID; //订单主键 modfyditem.C_CUSTNO = ltlcustno.Text; //客户编码 modfyditem.N_FYZS = Convert.ToDecimal(txtfyzs.Value == "" ? "0" : txtfyzs.Value); //发运支数 modfyditem.N_FYWGT = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value); //发运数量 modfyditem.C_SEND_STOCK = txtckname.Value; //发运仓库名称 modfyditem.C_SEND_STOCK_PK = hidckid.Value; //发运仓库ID modfyditem.C_PRODUCT_ID = ""; //库存产品ID modfyditem.C_AU_UNITIS = modOrder.C_FUNITID; //辅单位 modfyditem.C_AOG_SITE = txtaddr.Value; //到货地点 modfyditem.N_PRICE = Convert.ToDecimal(txtprice.Value == "" ? "0" : txtprice.Value); //到货地点费用 item.Add(modfyditem); #region //火运计划明细 Mod_TS_CUSTFILE modCustInfo = ts_custfile.GetCustInfo(txtkpdwcode.Text == "" ? modOrder.C_CUST_NO : txtkpdwcode.Text); var modTrainItem = new Mod_TMC_TRAIN_ITEM() { C_EMPNAME = ltlempname.Text, //提报人 C_PKID = sendcode, //发运单号 C_AREA = modOrder.C_AREA, //区域 C_CONNO = modOrder.C_CON_NO, //合同号 C_DH_COMPANY = modOrder.C_CUST_NAME, //订货单位 C_SH_COMPANY = txtshdw.Text == "" ? modOrder.C_CUST_NAME : txtshdw.Text, //收货单位 C_CUSTNO = modCustInfo.C_NO, //客户编码 C_CUSTNAME = modCustInfo.C_NAME, //客户名称 C_KH_BANK = modCustInfo.C_EXTEND1, //开户行 C_TAXNO = modCustInfo.C_TAXPAYERNO, //税号 C_ADDRESS = modCustInfo.C_EXTEND3, //地址 C_TEL = modCustInfo.C_EXTEND4, //电话 C_ACCOUNT = modCustInfo.C_EXTEND2, //账号 C_FLAG = "1", C_BILLCODE = modOrder.C_ORDER_NO, //订单号 C_SPEC = modOrder.C_SPEC, //规格 C_STL_GRD = modOrder.C_STL_GRD, //钢种 N_WGT = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value), //发运量 C_REMARK = txtremark.Value //行备注 }; trainList.Add(modTrainItem); #endregion } } #endregion #region//发运表头 Mod_TMD_DISPATCH modfyd = new Mod_TMD_DISPATCH(); modfyd.C_ID = sendcode; //发运单单据号 modfyd.C_GPS_NO = txtgps.Text; //GPS号 modfyd.D_DISP_DT = Convert.ToDateTime(txtfydt.Text); //发运日期 modfyd.C_SHIPVIA = dropfyfs.SelectedItem.Value; //发运方式 modfyd.C_COMCAR = dropcys.SelectedItem.Value; //承运商 modfyd.C_IS_WIRESALE = dropsfxc.SelectedItem.Text; //汉字是否线材 modfyd.C_IS_WIRESALE_ID = dropsfxc.SelectedItem.Value; //是否线材主键 modfyd.C_LIC_PLA_NO = txtcph.Text; //车牌号 modfyd.C_ATSTATION = txtdz.Text; //到站 modfyd.C_CREATE_ID = ltlempid.Text; //制单人 modfyd.C_EMP_ID = ltlempid.Text; //修改人ID modfyd.C_EMP_NAME = ltlempname.Text; //修改人 modfyd.C_EXTEND5 = ltltype.Text; //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyd.C_CUSTNAME = ltlcustname.Text; //客户 modfyd.C_CON_NO = ltlcon_no.Text; //合同号 modfyd.N_QUA = fyzs; //发运支数 modfyd.N_WGT = fywgt; //发运量 //0001NC10000000003ILQ-火运代垫,0001NC10000000003ILR-汽运代垫,0001NC10000000003ILV-自提运输 modfyd.N_IS_EXPORT = dropfyfs.SelectedValue == "0001NC10000000003ILQ" ? 1 : Convert.ToDecimal(dropsfbdj.SelectedValue); //是否包到价 modfyd.C_EXTEND2 = txtxnch.Text == "" ? txtcph.Text : txtxnch.Text; //虚拟车号 modfyd.C_EXTEND4 = txtcust_tel.Text; //客户姓名/电话 modfyd.C_EXTEND3 = txtsjtel.Text; //司机姓名/电话 Mod_TMO_CON modCon = tmo_con.GetModel(ltlcon_no.Text); if (modCon != null) { modfyd.C_BUSINESS_DEPT = modCon.C_DEPTID; //业务部门 modfyd.C_BUSINESS_ID = modCon.C_EMPLOYEEID; //业务员 } #endregion #region //火运计划表头 string fyfalg = ts_dic.GetDicFlag("ShipVia", dropfyfs.SelectedItem.Text); //获取是否下发审核(泰翔)Y/N var modtrain = new Mod_TMC_TRAIN_MAIN() { C_ID = sendcode, C_EMPID = modfyd.C_CREATE_ID, C_EMPNAME = modfyd.C_EMP_NAME, C_STATION = modfyd.C_ATSTATION, C_PLANNO = txtplanno.Text, C_LINE = txtline.Text, C_REMARK = txtshdw.Text, N_TRAIN_NUM = 1, C_SHIPVIA = dropfyfs.SelectedItem.Text, C_ISCHECK = fyfalg == "N" ? "Y" : "N"//Y通过/N未通过 }; #endregion if (tmd_dispatch.InsertFYD(modfyd, item)) { txtsendcode.Text = sendcode; //汽运代垫自动生成汽运计划/火运计划 if (dropfyfs.SelectedValue == "0001NC10000000003ILR" || cbx_sftrain.Checked == true) { #region //自动生成火运/汽运日计划申请 try { tmd_dispatch.AddTrainPlan(modtrain, trainList); } catch (Exception) { return(true); } #endregion } return(true); } else { return(false); } }