Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //获取用户所属公司名称
                var vUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (vUser != null)
                {
                    ltluserID.Text   = vUser.Id;
                    ltluserName.Text = vUser.Name;

                    Mod_TS_CUSTFILE mod = ts_custfile.GetModel(vUser.CustId);
                    if (mod != null)
                    {
                        ltlCustNo.Text   = mod.C_NO;
                        ltlCustName.Text = mod.C_NAME;
                    }

                    GetList();
                }
                else
                {
                    WebMsg.CheckUserLogin();
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 加载客户默认地址与开票单位
        /// </summary>
        private void BindUserInfo()
        {
            var BaseUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];

            if (BaseUser != null)
            {
                //客户档案
                Mod_TS_CUSTFILE mod = custfile.GetModel(BaseUser.CustId);
                if (mod != null)
                {
                    hidCustNO.Value   = mod.C_NO;
                    hidCustName.Value = mod.C_NAME;
                    hidCustLEV.Value  = mod.N_LEVEL.ToString();
                    hidCustType.Value = mod.N_TYPE.ToString() == "1" ? "经销" : "直销";
                }

                //默认收货单位
                DataTable dt = custaddr.GetAddrList(BaseUser.CustId, "1").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    txtAddress.Value = dt.Rows[0]["C_CGC"].ToString();
                    hidAddrID.Value  = dt.Rows[0]["C_ID"].ToString();
                }
                //默认开票单位
                DataTable dtc = custcompany.GetList(BaseUser.CustId).Tables[0];
                if (dtc.Rows.Count > 0)
                {
                    txtOTCompany.Value = dtc.Rows[0]["C_OTCOMPANY"].ToString();
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取客户基本信息
        /// </summary>
        /// <param name="CustID">客户ID</param>
        private void GetCustInfo(string CustID)
        {
            Mod_TS_CUSTFILE mod = ts_custfile.GetModel(CustID);

            if (mod != null)
            {
                txtConName.Text = DateTime.Now.ToString("MM.dd") + mod.C_SHORNAME;

                hidC_CGID.Value  = mod.C_NC_M_ID; //收货单位
                hidC_OTCID.Value = mod.C_NC_M_ID; //开票单位
                txtCust.Value    = mod.C_NAME;
                txtC_CGC.Value   = mod.C_NAME;
                txtC_OTC.Value   = mod.C_NAME;
                txtCustName.Text = mod.C_NAME;    //客户名称
                hidCustID.Value  = mod.C_NC_M_ID; //客户NC主键
                hidCustNO.Value  = mod.C_NO;      //客户编码
                ltlCustLEV.Text  = mod.N_LEVEL.ToString();
                ltlCustType.Text = mod.N_TYPE.ToString() == "1" ? "经销商" : "直销商";

                //收货地址
                DataTable dtaddr = ts_custaddr.GetAddr(CustID, "", "", "", "1").Tables[0];
                if (dtaddr.Rows.Count > 0)
                {
                    txtAddr.Value = dtaddr.Rows[0]["C_CGAREA"].ToString();
                }
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //获取用户所属公司名称
                var BaseUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (BaseUser != null)
                {
                    ltlUserID.Text   = BaseUser.Id;
                    ltlUserName.Text = BaseUser.Name;

                    //获取客户信息
                    if (!string.IsNullOrEmpty(BaseUser.CustId))
                    {
                        Mod_TS_CUSTFILE mod = ts_custfile.GetModel(BaseUser.CustId);
                        ltlCustNo.Text = mod.C_NO;
                        txtCust.Value  = mod.C_NAME;
                    }


                    GetQuestion();
                }
                else
                {
                    WebMsg.CheckUserLogin();
                }
            }
        }
Beispiel #5
0
        public AjaxResult GetOrderTail([FromBody] dynamic Json)
        {
            #region                            //参数
            string ConNO     = Json.ConNO;     //合同号
            string StartDate = Json.StartDate; //开始时间
            string EndDate   = Json.EndDate;   //结束时间
            #endregion

            #region //数据操作
            AjaxResult result = new AjaxResult();

            Mod_TS_USER modUser = GetUserID();
            if (modUser != null)
            {
                Mod_TS_CUSTFILE mod = ts_custfile.GetModel(modUser.C_CUST_ID);
                result.Code   = DoResult.Success;
                result.Result = SerializationHelper.Dtb2Json(tmo_order.GetOrderJL(ConNO, StartDate, EndDate, mod.C_NO).Tables[0]);
            }

            #endregion

            return(result);
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //获取用户所属公司名称
                var BaseUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (BaseUser != null)
                {
                    try
                    {
                        ltlUserID.Text   = BaseUser.Id;
                        ltlUserName.Text = BaseUser.Name;
                        //获取客户信息
                        if (!string.IsNullOrEmpty(BaseUser.CustId))
                        {
                            Mod_TS_CUSTFILE mod = ts_custfile.GetModel(BaseUser.CustId);
                            ltlCustNo.Text = mod.C_NO;
                            txtcust.Text   = mod.C_NAME;
                        }

                        GetQuestion();

                        if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                        {
                            ltlID.Text = Request.QueryString["ID"];
                            Mod_TMC_TECH_CONSULT mod = tmc_tech_consult.GetModel(ltlID.Text);
                            if (mod != null)
                            {
                                dropQuest.SelectedIndex = dropQuest.Items.IndexOf(dropQuest.Items.FindByText(mod.C_QUEST_ID));
                                txtgrd.Text             = mod.C_STL_GRD;
                                txtUseDesc.Value        = mod.C_USE_DESC;
                                txtRemark.Value         = mod.C_REMARK;
                                horderNO.Value          = mod.C_ORDER_NO;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        WebMsg.MessageBox(ex.Message);
                    }
                }
                else
                {
                    WebMsg.CheckUserLogin();
                }
            }
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取用户所属公司名称
                var BaseUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (BaseUser != null)
                {
                    //初始化日期
                    txtDate.Value = Convert.ToDateTime(DateTime.Now).ToString("yyy-MM-dd");

                    DateTime dt = DateTime.Now;
                    txtStart.Value = Convert.ToDateTime(dt).ToString("yyy-MM-dd");
                    txtEnd.Value   = Convert.ToDateTime(dt.AddDays(10)).ToString("yyy-MM-dd");

                    BindCurrency();
                    BindContractType();
                    BindShipVia();
                    BindArea();

                    ltlCustName.Text = BaseUser.Name;

                    Mod_TS_CUSTFILE mod = custFile.GetModel(BaseUser.CustId);
                    if (mod != null)
                    {
                        txtCustName.Text = mod.C_NAME;
                        ltlCUST_NO.Text  = mod.C_NO;
                        ltlCustLEV.Text  = mod.N_LEVEL.ToString() == "1" ? "普通" : "优先";
                    }


                    if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                    {
                        txtConNO.Text = Request.QueryString["ID"];
                        BindConInfo();
                    }
                }
                else
                {
                    WebMsg.CheckUserLogin();
                }
            }
        }
        /// <summary>
        /// 提交
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool    result = false;
            decimal wgt    = 0;

            foreach (RepeaterItem rpt in rptList.Items)
            {
                HtmlInputCheckBox chkID   = (HtmlInputCheckBox)rpt.FindControl("chkID");
                Literal           OrderNo = (Literal)rpt.FindControl("ltlOrderNo");
                Literal           ltlWGT  = (Literal)rpt.FindControl("ltlWGT");
                if (chkID.Checked)
                {
                    wgt += Convert.ToDecimal(ltlWGT.Text);

                    Mod_TMO_ORDER_MATCH mod = new Mod_TMO_ORDER_MATCH();
                    mod.C_ORDER_NO     = ltlOrderNo.Text;
                    mod.C_MATCH_ID     = chkID.Value;
                    mod.C_OLD_ORDER_NO = OrderNo.Text;
                    mod.C_TYPE         = Convert.ToDecimal(ltlType.Text);
                    if (tmo_order_match.Add(mod))//记录
                    {
                        Mod_TS_CUSTFILE modCust = ts_custfile.GetModel(ltlCustID.Text);

                        if (trc_roll_prodcut.UpdateMatch(chkID.Value, ltlOrderNo.Text, ltlConNo.Text, modCust.C_NO, modCust.C_NAME, "N"))//更新线材自由状态
                        {
                            result = true;
                        }
                    }
                }
            }
            if (result)
            {
                //更新订单匹配量
                if (tmo_condetails.UpdateMatch(wgt, ltlOrderNo.Text, Convert.ToInt32(ltlType.Text)))
                {
                    WebMsg.MessageBox("提交成功");
                    GetList();
                }
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Session["kh"] = null;

                //获取用户所属公司名称
                var vUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (vUser != null)
                {
                    DateTime dt = DateTime.Now;
                    Start.Value = dt.AddDays(-(dt.Day) + 1).ToString("yyy-MM-dd");
                    End.Value   = dt.AddMonths(1).AddDays(-(dt.Day)).ToString("yyy-MM-dd");

                    Mod_TS_CUSTFILE mod = ts_custfile.GetModel(vUser.CustId);
                    if (mod != null)
                    {
                        ltlcustno.Text = mod.C_NO;
                    }
                }
            }
        }
Beispiel #10
0
        public AjaxResult ConsultAdd([FromBody] dynamic Json)
        {
            #region                        //接收参数
            string QuestID = Json.QuestID; //技术问题ID
            string Stl_Grd = Json.Stl_Grd; //钢种
            string UseDesc = Json.UseDesc; //用途及工艺
            string Remark  = Json.Remark;  //问题描述
            #endregion

            #region //数据操作
            AjaxResult result = new AjaxResult();
            result.Code = DoResult.Success;
            Mod_TS_USER          modUser     = GetUserID();
            Mod_TS_CUSTFILE      modcustfile = ts_custfile.GetModel(modUser.C_CUST_ID);
            Mod_TMC_TECH_CONSULT mod         = new Mod_TMC_TECH_CONSULT();

            mod.C_QUEST_ID  = QuestID;
            mod.C_CUST_NAME = modcustfile.C_NAME;
            mod.C_CUST_CODE = modcustfile.C_NO;
            mod.C_STL_GRD   = Stl_Grd;
            mod.C_USE_DESC  = UseDesc;
            mod.C_REMARK    = Remark;
            mod.C_EMP_ID    = modUser.C_ID;
            mod.C_EMP_NAME  = modUser.C_NAME;

            if (tmc_tech_consult.Add(mod))
            {
                result.Result = "提交成功";
            }
            else
            {
                result.Result = "提交失败";
            }
            #endregion

            return(result);
        }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         //获取用户所属公司名称
         var vUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
         if (vUser != null)
         {
             Session["xm"] = null;
             DateTime dt = DateTime.Now;
             txtStart.Value = dt.AddDays(-(dt.Day) + 1).ToString("yyy-MM-dd");
             txtEnd.Value   = dt.AddMonths(1).AddDays(-(dt.Day)).ToString("yyy-MM-dd");
             Mod_TS_CUSTFILE mod = ts_custfile.GetModel(vUser.CustId);
             if (mod != null)
             {
                 ltlcustno.Text = mod.C_NO;
             }
             if (!string.IsNullOrEmpty(Request.QueryString ["flag"]))
             {
                 hidflag.Value = Request.QueryString["flag"];
             }
         }
     }
 }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                var vUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (vUser != null)
                {
                    try
                    {
                        ltlUserID.Text = vUser.Id;
                        ltlCustID.Text = vUser.CustId;
                        hCustID.Value  = vUser.CustId;

                        BindArea();

                        Mod_TS_USER mod = ts_user.GetModel(vUser.Id);
                        if (mod != null)
                        {
                            #region //基本信息
                            txtUserName.Value = mod.C_ACCOUNT;
                            txtName.Value     = mod.C_NAME;
                            txtPhone.Value    = mod.C_MOBILE;
                            txtFax.Value      = mod.C_MOBILE2;
                            txtTel.Value      = mod.C_PHONE;
                            txtEMail.Value    = mod.C_EMAIL;
                            #endregion

                            #region //余额
                            DataTable dt = ts_custfile.GetCusetMoney(vUser.CustId).Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                ltltime.Text   = Convert.ToDateTime(dt.Rows[0]["TS"].ToString()).ToString();
                                txtMoney.Value = decimal.Parse(dt.Rows[0]["KHYE"].ToString()).ToString("###,##0.00");
                            }
                            #endregion

                            #region //公司档案
                            if (!string.IsNullOrEmpty(mod.C_CJNAME))
                            {
                                txtC_CJNAME.Text = mod.C_CJNAME;
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(ltlCustID.Text))
                                {
                                    Mod_TS_CUSTFILE modCustFile = ts_custfile.GetModel(ltlCustID.Text);
                                    txtC_CJNAME.Text = modCustFile.C_NAME;
                                }
                            }
                            txtC_CJINTRO.Text      = mod.C_CJINTRO;
                            txtC_STL_GRD.Text      = mod.C_STL_GRD;
                            txtC_LEGALREPRES.Text  = mod.C_LEGALREPRES;
                            txtC_CGJCR.Text        = mod.C_CGJCR;
                            txtC_JOB.Text          = mod.C_JOB;
                            txtC_JCTEL.Text        = mod.C_JCTEL;
                            txtC_ADDRESS.Text      = mod.C_ADDRESS;
                            dropArea.SelectedIndex = dropArea.Items.IndexOf(dropArea.Items.FindByText(mod.C_AREA));
                            txtC_MANAGER.Text      = mod.C_MANAGER;
                            #endregion
                        }
                    }
                    catch (Exception ex)
                    {
                        WebMsg.MessageBox(ex.Message);
                    }
                }
            }
        }
Beispiel #13
0
        private bool InsertOrder()
        {
            List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

            if (Session["kh"] != null)
            {
                DataTable dt = (DataTable)Session["kh"];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    #region 数据操作

                    Mod_TS_USER       modUser  = ts_user.GetModel(ltlC_EMP_ID.Text);
                    Mod_TMO_CON       modCon   = tmo_con.GetModel(txtConNO.Text);
                    Mod_TB_MATRL_MAIN modMat   = tb_matrl_main.GetModel(dt.Rows[i]["C_ID"].ToString());
                    Mod_TS_CUSTFILE   modCust  = ts_custfile.GetModel(modUser.C_CUST_ID);
                    Mod_TMO_ORDER     modOrder = new Mod_TMO_ORDER();

                    string order_no = randomnumber.CreateOrderNo(txtConNO.Text);                                                                                 //订单号
                    modOrder.C_ORDER_NO    = order_no;
                    modOrder.C_CON_NO      = txtConNO.Text;                                                                                                      //合同号
                    modOrder.C_CON_NAME    = modCon.C_CON_NAME;                                                                                                  //合同名称
                    modOrder.C_AREA        = modCon.C_AREA;                                                                                                      //区域
                    modOrder.C_INVBASDOCID = modMat.C_PK_INVBASDOC;                                                                                              //存货档案主键
                    modOrder.C_INVENTORYID = modMat.C_PK_INVMANDOC;                                                                                              //存货管理档案主键
                    modOrder.C_PROD_NAME   = modMat.C_PROD_NAME;                                                                                                 //品名
                    modOrder.C_PROD_KIND   = modMat.C_PROD_KIND;                                                                                                 //品种
                    modOrder.C_MAT_CODE    = modMat.C_MAT_CODE;                                                                                                  //物料编码
                    modOrder.C_MAT_NAME    = modMat.C_MAT_NAME;                                                                                                  //物料名称
                    modOrder.C_SPEC        = modMat.C_SPEC;                                                                                                      //规格
                    modOrder.C_STL_GRD     = modMat.C_MAT_TYPE == "841" ? modMat.C_MAT_NAME : modMat.C_MAT_TYPE == "851" ? modMat.C_MAT_NAME : modMat.C_STL_GRD; //钢种
                    modOrder.C_FUNITID     = modMat.C_FJLDW;                                                                                                     //辅单位
                    modOrder.C_UNITID      = modMat.C_PK_MEASDOC;                                                                                                //主计量单位
                    modOrder.D_DELIVERY_DT = modCon.D_CONINVALID_DT;                                                                                             //计划收货日期
                    modOrder.D_DT          = modCon.D_CONSING_DT;                                                                                                //订单日期//签单日期
                    modOrder.C_VDEF1       = "";                                                                                                                 //质量ID
                    modOrder.C_SFPJ        = "N";

                    modOrder.C_TECH_PROT      = dt.Rows[i]["C_CUST_TECH_PROT"].ToString(); //客户协议号
                    modOrder.C_STD_CODE       = dt.Rows[i]["C_STD_CODE"].ToString();       //执行标准
                    modOrder.C_FREE1          = dt.Rows[i]["ZYX1"].ToString();             //自由项1
                    modOrder.C_FREE2          = dt.Rows[i]["ZYX2"].ToString();             //自由项2
                    modOrder.C_BY4            = dt.Rows[i]["C_BY4"].ToString();            //是否不锈钢
                    modOrder.N_TYPE           = Convert.ToDecimal(modMat.C_MAT_TYPE);
                    modOrder.C_PACK           = dt.Rows[i]["C_PACK"].ToString();           //包装要求
                    modOrder.C_RECEIPTAREAID  = modCon.C_CRECEIPTAREAID;                   //收货地区
                    modOrder.C_RECEIVEADDRESS = modCon.C_ADDRESS;                          //收货地址
                    modOrder.C_RECEIPTCORPID  = modCon.C_CRECEIPTCUSTOMERID;               //收货单位
                    modOrder.C_CURRENCYTYPEID = modCon.C_CURRENCYTYPEID;                   //货币
                    modOrder.N_TYPE           = Convert.ToDecimal(modMat.C_MAT_TYPE);
                    modOrder.N_USER_LEV       = modCon.N_CUST_LEV;                         //客户等级
                    modOrder.C_REMARK         = modCon.C_REAMRK;
                    modOrder.C_EMP_ID         = modUser.C_ID;
                    modOrder.C_EMP_NAME       = modUser.C_EMP_NAME;
                    modOrder.C_CUST_NO        = modCust.C_NO;
                    modOrder.C_CUST_NAME      = modCust.C_NAME;
                    modOrder.C_SALE_CHANNEL   = modCust.N_TYPE == 1 ? "经销" : "直销";
                    modOrder.C_LEV            = GetLev("STL_GRD_Lev"); //钢种等级
                    modOrder.C_ORDER_LEV      = GetLev("Order_Lev");   //订单等级
                    modOrder.N_COST           = 0;                     //成本
                    modOrder.N_STATUS         = -1;                    //订单状态

                    decimal N_WGT = 0;
                    if (!string.IsNullOrEmpty(dt.Rows[i]["N_WGT"].ToString()))
                    {
                        N_WGT = Convert.ToDecimal(dt.Rows[i]["N_WGT"].ToString());
                    }
                    modOrder.N_WGT  = N_WGT;                                           //数量
                    modOrder.N_HSL  = modMat.N_HSL == null ? 0 : modMat.N_HSL;         //换算率
                    modOrder.N_FNUM = modMat.N_HSL == null ? 1 : N_WGT / modMat.N_HSL; //辅数量
                    if (!string.IsNullOrEmpty(modMat.C_PK_TAXITEMS))
                    {
                        Mod_TMB_TAXITEMS modTaxi = tmb_taxitems.GetModel(modMat.C_PK_TAXITEMS);
                        modOrder.N_TAXRATE = modTaxi.N_TAXRATIO;                                                                          //税率

                        #region                                                                                                           //获取钢种单价-税率
                        string Price = dt.Rows[i]["PRICE"].ToString().ToString() == "" ? "0" : dt.Rows[i]["PRICE"].ToString().ToString(); //单价
                        if (!string.IsNullOrEmpty(Price))
                        {
                            decimal N_TAXRATE             = Convert.ToDecimal(modOrder.N_TAXRATE) + 1;              //税率
                            decimal N_ORIGINALCURPRICE    = decimal.Round(Convert.ToDecimal(Price) / N_TAXRATE, 2); //原币无税单价
                            decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(Price);                               //原币含税单价

                            decimal N_ORIGINALCURMNY    = N_WGT * N_ORIGINALCURPRICE;                               //原币无税金额
                            decimal N_ORIGINALCURSUMMNY = N_WGT * N_ORIGINALCURTAXPRICE;                            //原币价税合计
                            decimal N_ORIGINALCURTAXMNY = N_ORIGINALCURSUMMNY - N_ORIGINALCURMNY;                   //原币税额

                            modOrder.N_ORIGINALCURPRICE    = N_ORIGINALCURPRICE;                                    //原币无税单价
                            modOrder.N_ORIGINALCURTAXPRICE = N_ORIGINALCURTAXPRICE;                                 //原币含税单价
                            modOrder.N_ORIGINALCURTAXMNY   = N_ORIGINALCURTAXMNY;                                   //原币税额
                            modOrder.N_ORIGINALCURMNY      = N_ORIGINALCURMNY;                                      //原币无税金额
                            modOrder.N_ORIGINALCURSUMMNY   = N_ORIGINALCURSUMMNY;                                   //原币价税合计
                        }
                        #endregion
                    }


                    orderList.Add(modOrder);

                    #endregion
                }
            }

            return(tmo_con.InsertFirstOrder(orderList));
        }
Beispiel #14
0
        public AjaxResult ConAdd([FromBody] dynamic Json)
        {
            #region 参数
            string ZCCode       = Json.ZCCode == null ? "01" : Json.ZCCode; //政策编码
            string ConName      = Json.ConName;                             //合同名称
            string ConType      = Json.ConType;                             //合同类型ID
            string Currency     = Json.Currency;                            //货币类型ID
            string ConsingDT    = Json.ConsingDT;                           //签署日期
            string ConeffeDT    = Json.ConeffeDT;                           //计划有效日期
            string ConinvalidDT = Json.ConinvalidDT;                        //计划失效日期
            string ShipVia      = Json.ShipVia;                             //发运方式ID
            string Remark       = Json.Remark;                              //备注
            string CGID         = Json.CGID;                                //收货单位
            string STATION      = Json.STATION;                             //站点
            string SalesEmpID   = Json.SalesEmpID;                          //业务员ID
            string Addr         = Json.Addr;                                //收货地址
            string OTCID        = Json.OTCID;                               //开票单位
            string CustID       = Json.CustID;                              //客户
            #endregion

            #region //数据操作
            AjaxResult           result    = new AjaxResult();
            List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();
            DataTable            dt        = ts_user.GetSaleDept(SalesEmpID).Tables[0];

            Mod_TS_USER modUser = GetUserID();
            Mod_TMO_CON mod     = new Mod_TMO_CON();
            string      conNo   = randomnumber.CreateConNo(ZCCode);       //合同号
            mod.C_CON_XH         = conNo;                                 //合同序号
            mod.C_CON_NO         = conNo;                                 //合同号
            mod.C_CON_NAME       = ConName;                               //合同名称
            mod.C_CONTYPEID      = ConType;                               //合同类型ID
            mod.C_CURRENCYTYPEID = Currency;                              //货币类型ID
            mod.D_CONSING_DT     = Convert.ToDateTime(ConsingDT);         //签署日期
            mod.D_CONEFFE_DT     = Convert.ToDateTime(ConeffeDT);         //计划有效日期
            mod.D_CONINVALID_DT  = Convert.ToDateTime(ConinvalidDT);      //计划失效日期
            //mod.D_NEED_DT = Convert.ToDateTime(ConinvalidDT).AddDays(-30);//需求日期
            mod.C_TRANSMODEID        = ShipVia;                           //发运方式ID
            mod.C_AREA               = dt.Rows[0]["AREA"].ToString();     //合同区域
            mod.C_REAMRK             = Remark;                            //备注
            mod.C_CRECEIPTCUSTOMERID = CGID;                              //收货单位ID
            mod.C_CRECEIPTCORPID     = OTCID;                             //开票单位ID
            mod.C_STATION            = STATION;                           //站点
            mod.C_EMPLOYEEID         = SalesEmpID;                        //业务员ID
            mod.C_DEPTID             = dt.Rows[0]["C_DEPTID"].ToString(); //业务部门

            if (!string.IsNullOrEmpty(CGID))
            {
                Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(CGID);
                mod.C_ADDRESS        = Addr;               //收货地址
                mod.C_CRECEIPTAREAID = modCust.C_AREATYPE; //收货地区
            }

            Mod_TS_CUSTFILE modCustfile = CustID == "" ? ts_custfile.GetModel(modUser.C_CUST_ID) : ts_custfile.GetCustModel(CustID);
            mod.C_CUSTOMERID  = modCustfile.C_NC_M_ID; //NCID
            mod.C_CUSTNAME    = modCustfile.C_NAME;
            mod.C_CUST_NO     = modCustfile.C_NO;      //客户编码
            mod.C_COPERATORID = SalesEmpID;            //制单人
            mod.C_EMP_ID      = modUser.C_ID;
            mod.C_EMP_NAME    = modUser.C_NAME;
            mod.N_CUST_LEV    = modCustfile.N_LEVEL;
            mod.N_CHANGENUM   = 0;//变更次数默认0

            if (tmo_con.InsertConOrder(mod, orderList))
            {
                result.Code   = DoResult.Success;
                result.Result = conNo;
            }
            else
            {
                result.Code   = DoResult.Failed;
                result.Result = "提交失败";
            }
            #endregion

            return(result);
        }