Пример #1
0
        private void GetStlGrd()
        {
            DataTable dt = new DataTable();

            if (dropType.SelectedItem.Value == "0")
            {
                if (cbxmatcode.Checked)
                {
                    dt = tb_matrl_main.GetCustStlGrd(ltlCustNo.Text, txtmatcode.Text).Tables[0];
                }
                else
                {
                    dt = tb_matrl_main.GetCustStlGrd(ltlCustNo.Text, txtmatcode.Text, txtstlgrd.Text, tstspec.Text).Tables[0];
                }
            }
            else
            {
                dt = tb_matrl_main.GetCustStlGrd_GP(ltlCustNo.Text, txtmatcode.Text, txtstlgrd.Text, tstspec.Text).Tables[0];
            }
            if (dt.Rows.Count > 0)
            {
                rptList.DataSource = dt;
                rptList.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "alert('暂无相关记录,请维护客户协议!')", true);
                rptList.DataSource = null;
                rptList.DataBind();
            }
        }
Пример #2
0
        public AjaxResult OrderAdd([FromBody] dynamic Json)
        {
            #region                          //参数
            string ConNo    = Json.ConNo;    //合同号
            string MatID    = Json.MatID;    //物料ID
            string TechProt = Json.TechProt; //客户协议号
            string StdCode  = Json.StdCode;  //执行标准
            string Pack     = Json.Pack;     //包装要求
            string Wgt      = Json.Wgt;      //重量
            string Price    = Json.Price;    //含税单价
            string VdefID   = Json.VdefID;   //质量ID
            #endregion

            #region 数据操作
            AjaxResult result = new AjaxResult();
            result.Code = DoResult.Success;

            Mod_TS_USER       modUser  = GetUserID();
            Mod_TMO_CON       modCon   = tmo_con.GetModel(ConNo);
            Mod_TB_MATRL_MAIN modMat   = tb_matrl_main.GetModel(MatID);
            Mod_TS_CUSTFILE   modCust  = ts_custfile.GetModel(modUser.C_CUST_ID);
            Mod_TMO_ORDER     modOrder = new Mod_TMO_ORDER();

            DataTable dt = tb_matrl_main.GetCustStlGrd(modCust.C_NO, modMat.C_MAT_CODE, modMat.C_STL_GRD, modMat.C_SPEC, TechProt, StdCode).Tables[0];

            string order_no = randomnumber.CreateOrderNo(ConNo);               //订单号
            modOrder.C_ORDER_NO    = order_no;
            modOrder.C_CON_NO      = modCon.C_CON_NO;                          //合同号
            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_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       = VdefID;                                   //质量主键ID
            modOrder.C_SFPJ        = "N";
            modOrder.C_TECH_PROT   = TechProt;                                 //客户协议号
            modOrder.C_FREE1       = dt?.Rows[0]["C_ZYX1"].ToString() ?? "";   //自由项1
            modOrder.C_FREE2       = dt?.Rows[0]["C_ZYX2"].ToString() ?? "";   //自由项2
            modOrder.C_STD_CODE    = StdCode;                                  //执行标准
            modOrder.C_BY4         = dt?.Rows[0]["C_IS_BXG"].ToString() ?? ""; //是否不锈钢
            modOrder.N_TYPE        = Convert.ToDecimal(modMat.C_MAT_TYPE);     //订单类型


            modOrder.C_PACK = Pack;//包装要求

            Mod_TMB_TAXITEMS modTaxi = tmb_taxitems.GetModel(modMat.C_PK_TAXITEMS);
            modOrder.N_TAXRATE = modTaxi.N_TAXRATIO;//税率

            decimal N_WGT = 0;
            if (!string.IsNullOrEmpty(Wgt))
            {
                N_WGT = Convert.ToDecimal(Wgt);
            }
            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; //辅数量

            #region                                                            //获取钢种单价-税率
            if (!string.IsNullOrEmpty(Price))
            {
                decimal N_TAXRATE             = Convert.ToDecimal(modOrder.N_TAXRATE) + 1;              //税率
                decimal N_ORIGINALCURPRICE    = Convert.ToDecimal(Price) / N_TAXRATE;                   //原币无税单价
                decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(Price);                               //原币含税单价

                decimal N_ORIGINALCURMNY    = decimal.Round(N_WGT * N_ORIGINALCURPRICE, 2);             //原币无税金额
                decimal N_ORIGINALCURSUMMNY = N_WGT * N_ORIGINALCURTAXPRICE;                            //原币价税合计
                decimal N_ORIGINALCURTAXMNY = decimal.Round(N_ORIGINALCURSUMMNY - N_ORIGINALCURMNY, 2); //原币税额

                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

            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_USER_LEV     = modCon.N_CUST_LEV;             //客户等级
            modOrder.C_CUST_SQ      = modCon.C_REAMRK;               //客户要求
            modOrder.C_EMP_ID       = modCon.C_EMP_ID;
            modOrder.C_EMP_NAME     = modCon.C_EMP_NAME;
            modOrder.C_CUST_NO      = modCust.C_NO;
            modOrder.C_CUST_NAME    = modCust.C_NAME;
            modOrder.C_SALE_CHANNEL = "";
            modOrder.C_LEV          = GetLev("STL_GRD_Lev");                    //钢种等级
            modOrder.C_ORDER_LEV    = GetLev("Order_Lev");                      //订单等级
            modOrder.N_COST         = 0;                                        //成本
            modOrder.C_TRANSMODE    = modCon.C_TRANSMODEID;                     //发运方式
            modOrder.C_TRANSMODEID  = modCon.C_TRANSMODEID;                     //发运方式主键
            modOrder.C_YWY          = ts_user.GetSaleName(modCon.C_EMPLOYEEID); //业务员姓名
            modOrder.N_STATUS       = Convert.ToDecimal(modCon.N_STATUS);


            List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();
            orderList.Add(modOrder);
            result.Result = tmo_con.InsertFirstOrder(orderList) == true ? "提交成功" : "提交失败";
            #endregion

            return(result);
        }