示例#1
0
        /// <summary>
        /// 获取用户姓名
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <returns></returns>
        private string GetUserName(string id)
        {
            string      name = string.Empty;
            Mod_TS_USER mod  = ts_user.GetModel(id);

            if (mod != null)
            {
                name = mod.C_NAME;
            }
            return(name);
        }
示例#2
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));
        }
示例#3
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);
                    }
                }
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["back_no"] = 0;

                var vUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (vUser == null)
                {
                    WebMsg.CheckUserLogin();
                    return;
                }
                else
                {
                    if (vUser.Roles.Where(x => x.C_CODE == RoleCode).Any())
                    {
                        hidroles.Value = "kh-001";

                        trSale1.Visible = false;
                        trSale2.Visible = false;
                        trSale3.Visible = false;
                        trSale4.Visible = false;
                        trCus1.Visible  = false;
                        trSale5.Visible = false;
                    }
                    else
                    {
                        trSale1.Visible = true;
                        trSale2.Visible = true;
                        trSale3.Visible = true;
                        trSale4.Visible = true;
                        trCus1.Visible  = true;
                        trSale5.Visible = true;
                    }
                }
                Session["Quality"] = null;
                InitDDL();
                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    hid.Value = Request.QueryString["ID"];
                    var mod = qua.GetModel(hid.Value);
                    if (mod != null)
                    {
                        hidstatus.Value = Convert.ToString(mod.N_status);

                        if (vUser.Roles.Where(x => x.C_CODE == RoleCode).Any())
                        {
                            btnflow.Visible = false;

                            if (Convert.ToInt32(mod.N_status) > 0)
                            {
                                this.btnAdd.Visible    = false; //添加行
                                this.btndelrow.Visible = false; //删除行
                                this.btnsave.Visible   = false; //保存
                                this.btnSubmit.Visible = false; //提交
                                btnCheck.Visible       = false; //送审
                            }
                            else
                            {
                                this.btnAdd.Visible    = true;  //添加行
                                this.btndelrow.Visible = true;  //删除行
                                this.btnsave.Visible   = true;  //保存
                                this.btnSubmit.Visible = true;  //提交
                                btnCheck.Visible       = false; //送审
                            }
                        }
                        else
                        {
                            btndoc.Visible         = true;  //文档
                            this.btnSubmit.Visible = false; //提交

                            switch (Convert.ToInt32(mod.N_status))
                            {
                            case 0:                            //待处理
                                this.btnAdd.Visible    = true; //添加行
                                this.btndelrow.Visible = true; //删除行
                                //btnsave.Visible = true;//保存
                                btnCheck.Visible = true;       //送审
                                break;

                            case 1:                             //审批中
                                //btnsave.Visible = false;//保存
                                btnCheck.Visible       = false; //送审
                                this.btnAdd.Visible    = false; //添加行
                                this.btndelrow.Visible = false; //删除行
                                break;

                            case 2:                             //已完成

                                this.btnAdd.Visible    = false; //添加行
                                this.btndelrow.Visible = false; //删除行
                                //btnsave.Visible = false;//保存
                                btnCheck.Visible = false;       //送审
                                break;
                            }
                        }

                        #region 详细信息

                        ltlStat.Text = mod.N_statusname;//当前状态

                        ddlArea.SelectedIndex = ddlArea.Items.IndexOf(ddlArea.Items.FindByText(mod.C_area_id));
                        if (!string.IsNullOrEmpty(mod.C_distributor))
                        {
                            txtDistributor.Value = mod.C_distributor;
                        }
                        if (!string.IsNullOrEmpty(mod.C_directuser))
                        {
                            txtDirectuser.Value = mod.C_directuser;
                        }
                        if (!string.IsNullOrEmpty(mod.C_contact))
                        {
                            txtContact.Value = mod.C_contact;
                        }
                        if (!string.IsNullOrEmpty(mod.C_con_phone))
                        {
                            txtConPhone.Value = mod.C_con_phone;
                        }

                        ddlGrd.SelectedIndex = ddlGrd.Items.IndexOf(ddlGrd.Items.FindByText(mod.C_grd));


                        if (mod.D_ship_start_dt != null)
                        {
                            txtShipStart.Value = DateTime.Parse(mod.D_ship_start_dt.ToString()).ToString("yyyy-MM-dd");
                        }
                        if (mod.D_ship_end_dt != null)
                        {
                            txtShipEnd.Value = DateTime.Parse(mod.D_ship_end_dt.ToString()).ToString("yyyy-MM-dd");
                        }
                        if (!string.IsNullOrEmpty(mod.C_prod_use))
                        {
                            txtProUse.Value = mod.C_prod_use;
                        }
                        if (!string.IsNullOrEmpty(mod.C_object_content))
                        {
                            txtObjContent.Text = mod.C_object_content;
                        }
                        if (!string.IsNullOrEmpty(mod.C_tech_desc))
                        {
                            txtTechDesc.Text = mod.C_tech_desc;
                        }
                        if (!string.IsNullOrEmpty(mod.C_remark))
                        {
                            txtBz.Text = mod.C_remark;
                        }
                        if (mod.N_object_count_wgt != null)
                        {
                            txtOBJECT_COUNT_WGT.Value = mod.N_object_count_wgt.ToString();
                        }
                        if (mod.C_site_survey_content != null)
                        {
                            txtSite_SURVEY_CONTENT.Text = mod.C_site_survey_content.ToString();
                        }
                        if (mod.N_parent_qua != null)
                        {
                            txtPARENT_QUA.Value = mod.N_parent_qua.ToString();
                        }
                        if (mod.N_quest_qua != null)
                        {
                            txtQUEST_QUA.Value = mod.N_quest_qua.ToString();
                        }
                        if (mod.N_middle_qua != null)
                        {
                            txtMIDDLE_QUA.Value = mod.N_middle_qua.ToString();
                        }
                        if (mod.N_else_qua != null)
                        {
                            txtELSE_QUA.Value = mod.N_else_qua.ToString();
                        }
                        if (!string.IsNullOrEmpty(mod.C_dept))
                        {
                            txtDEPT.Value = mod.C_dept;
                        }
                        if (!string.IsNullOrEmpty(mod.C_quality_dept))
                        {
                            txtQUALITY_DEPT.Value = mod.C_quality_dept;
                        }
                        if (!string.IsNullOrEmpty(mod.C_technology))
                        {
                            txtTECHNOLOGY.Value = mod.C_technology;
                        }
                        if (!string.IsNullOrEmpty(mod.C_qt))
                        {
                            txtQT.Value = mod.C_qt;
                        }
                        if (!string.IsNullOrEmpty(mod.C_cust_making))
                        {
                            txtCUST_MAKING.Value = GetUserName(mod.C_cust_making);
                        }
                        if (mod.D_cust_making_dt != null)
                        {
                            txtCUST_MAKING_DT.Value = DateTime.Parse(mod.D_cust_making_dt.ToString()).ToString("yyy-MM-dd");
                        }
                        if (mod.N_flag != null)
                        {
                            ddlType.SelectedValue = mod.N_flag.ToString();
                        }
                        if (!string.IsNullOrEmpty(mod.C_salesman))
                        {
                            txtSaleUser.Value = mod.C_salesman;
                        }

                        if (!string.IsNullOrEmpty(mod.C_quality_result))
                        {
                            txtQUALITY_RESULT.Value = mod.C_quality_result;
                        }

                        //if (!string.IsNullOrEmpty(mod.C_month_average))
                        //{
                        //    txtMONTH_AVERAGE.Value= mod.C_month_average;
                        //}
                        if (txtCUST_MAKING.Value == "" && vUser.Roles.Where(x => SaleCode.Contains(x.C_CODE)).Any() && mod.N_status == 0)
                        {
                            txtCUST_MAKING.Value    = vUser.Name;
                            txtCUST_MAKING_DT.Value = DateTime.Now.ToString("yyyy-MM-dd");
                        }
                        #endregion
                        DataTable dt = qua.GetItemList(" and c_parentid='" + hid.Value + "'").Tables[0];
                        rptList.DataSource = dt;
                        rptList.DataBind();
                        Session["Quality"] = dt;

                        if (dt.Rows.Count > 0)
                        {
                            qua.UpdateMatCode();//执行质量批次物料编码/生产日期
                        }
                    }
                }
                else
                {
                    #region //客户基本信息
                    Mod_TS_USER mod = ts_user.GetModel(vUser.Id);
                    if (mod != null)
                    {
                        #region //基本信息
                        txtDistributor.Value = mod.C_CJNAME;
                        txtContact.Value     = mod.C_NAME;
                        txtConPhone.Value    = mod.C_MOBILE;
                        #endregion
                    }
                    #endregion

                    this.btnAdd.Visible    = true;  //添加行
                    this.btndelrow.Visible = true;  //删除行
                    this.btnsave.Visible   = true;  //保存
                    this.btnSubmit.Visible = true;  //提交
                    btnCheck.Visible       = false; //送审
                    //btnAudit.Visible = false;//审批
                    btndoc.Visible = false;         //文档
                }
            }

            ViewState["back_no"] = Convert.ToInt32(ViewState["back_no"]) + 1;
        }