Esempio n. 1
0
        //合同变更
        protected void btnConBg_Click(object sender, EventArgs e)
        {
            try
            {
                #region //新增变更合同
                List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

                #region //添加合同基本信息

                int NO = Convert.ToInt32(ltlcon_bgNo.Text) + 1;

                Mod_TMO_CON modCon = tmo_con.GetModel(txtConNO.Text);
                modCon.C_CON_NO        = modCon.C_CON_NO + "-" + NO.ToString();
                modCon.C_CON_NAME      = modCon.C_CON_NAME;
                modCon.N_STATUS        = -1;                                           //客户待提交
                modCon.D_CONSING_DT    = DateTime.Now;                                 //合同签署日期
                modCon.D_CONEFFE_DT    = Convert.ToDateTime(DateTime.Now);             //计划生效日期
                modCon.D_CONINVALID_DT = Convert.ToDateTime(DateTime.Now).AddDays(60); //计划失效日期
                modCon.C_CON_NO_OLD    = txtConNO.Text;                                //原始合同号
                modCon.N_CHANGENUM     = NO;                                           //变更次数
                #endregion

                #region                                                 //添加合同明细
                Bll_RandomNumber randomnumber = new Bll_RandomNumber(); //流水号
                DataTable        dtOrder      = tmo_order.GetConOrderList(txtConNO.Text, "", "", "", "", "").Tables[0];

                for (int i = 0; i < dtOrder.Rows.Count; i++)
                {
                    Mod_TMO_ORDER modOrder = tmo_order.GetModel(dtOrder.Rows[i]["C_ID"].ToString()); //订单表
                    string        order_no = randomnumber.CreateOrderNo(modCon.C_CON_NO);            //订单号
                    modOrder.C_ORDER_NO      = order_no;
                    modOrder.C_CON_NO        = modCon.C_CON_NO;                                      //合同号
                    modOrder.C_CON_NAME      = modCon.C_CON_NAME;                                    //合同名称
                    modOrder.C_CUST_NO       = modCon.C_CUST_NO;                                     //客户编码
                    modOrder.C_CUST_NAME     = modCon.C_CUSTNAME;                                    //客户名称
                    modOrder.C_RECEIPTCORPID = modCon.C_CRECEIPTCUSTOMERID;                          //收货单位
                    modOrder.N_STATUS        = -1;                                                   //客户待提交
                    modOrder.C_SFPJ          = "N";                                                  //是否评价
                    modOrder.N_EXEC_STATUS   = -2;                                                   //未提报
                    modOrder.N_WGT           = modOrder.N_WGT;                                       //原合同数量
                    modOrder.C_ORDER_NO_OLD  = dtOrder.Rows[i]["C_ORDER_NO"].ToString();             //原合同号
                    orderList.Add(modOrder);
                }
                #endregion

                #endregion

                if (tmo_con.InsertConOrder(modCon, orderList))
                {
                    string url = "ConEdit_BG.aspx?ID=" + modCon.C_CON_NO + "&YID=" + txtConNO.Text;
                    Response.Redirect(url);
                }
            }
            catch (Exception ex)
            {
                WebMsg.MessageBox(ex.Message);
            }
        }
Esempio n. 2
0
        //库存订单
        protected void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

                #region Insert

                Mod_TMO_ORDER modOrder = tmo_order.GetModel(ltlOrderNo.Text);

                Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(modOrder.C_MAT_CODE);

                string order_no = randomnumber.CreateOrderNo(ltlConNO.Text);//订单号
                modOrder.C_ORDER_NO = order_no;
                modOrder.N_USER_LEV = 0;
                modOrder.N_COST     = 0;

                decimal N_WGT = Convert.ToDecimal(txtNum.Value ?? "0");
                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                                                                                   //获取钢种单价-折扣-税率
                decimal Price                 = Convert.ToDecimal(modOrder.N_ORIGINALCURTAXPRICE);        //原币含税单价
                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

                orderList.Add(modOrder);

                #endregion

                if (tmo_con.InsertKCFirstOrder(orderList))
                {
                    Response.Write("<script>alert('提交成功');window.parent.close();</script>");
                }
            }
            catch (Exception ex)
            {
                WebMsg.MessageBox(ex.Message);
            }
        }
Esempio n. 3
0
        //添加
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Mod_TMO_CON     modCon  = tmo_con.GetModel(ltlCon_No.Text);
                Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(modCon.C_CUSTOMERID);

                List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

                for (int i = 0; i < rptList.Items.Count; i++)
                {
                    HtmlInputCheckBox cbxSelect           = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkMat_Code"); //物料ID
                    Literal           ltlmatcode          = (Literal)rptList.Items[i].FindControl("ltlmatcode");            //物料编码
                    Literal           ltlmatname          = (Literal)rptList.Items[i].FindControl("ltlmatname");            //物料名称
                    Literal           ltlstlgrd           = (Literal)rptList.Items[i].FindControl("ltlstlgrd");             //钢种
                    Literal           ltlspec             = (Literal)rptList.Items[i].FindControl("ltlspec");               //规格
                    Literal           ltlC_CUST_TECH_PROT = (Literal)rptList.Items[i].FindControl("ltlC_CUST_TECH_PROT");   //客户协议
                    Literal           ltlC_STD_CODE       = (Literal)rptList.Items[i].FindControl("ltlC_STD_CODE");         //执行标准
                    Literal           ltlzyx1             = (Literal)rptList.Items[i].FindControl("ltlzyx1");               //自由项1
                    Literal           ltlzyx2             = (Literal)rptList.Items[i].FindControl("ltlzyx2");               //自由项2
                    Literal           ltlC_IS_BXG         = (Literal)rptList.Items[i].FindControl("ltlC_IS_BXG");           //是否不锈钢

                    if (cbxSelect.Checked)
                    {
                        #region Insert
                        Mod_TB_MATRL_MAIN modMat   = tb_matrl_main.GetModel(cbxSelect.Value);
                        Mod_TMO_ORDER     modOrder = new Mod_TMO_ORDER();

                        string order_no = randomnumber.CreateOrderNo(ltlCon_No.Text); //订单号
                        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;                      // "jlda0000000000000041";//辅单位
                        modOrder.C_UNITID      = modMat.C_PK_MEASDOC;                 //主计量单位
                                                                                      //modOrder.D_NEED_DT = modCon.D_CONINVALID_DT;//需求日期
                        modOrder.D_DELIVERY_DT = modCon.D_CONINVALID_DT;              //计划收货日期
                        modOrder.D_DT          = DateTime.Now;                        //订单日期


                        modOrder.C_TECH_PROT = ltlC_CUST_TECH_PROT.Text; //客户协议号
                        modOrder.C_FREE1     = ltlzyx1.Text;             //自由项1
                        modOrder.C_FREE2     = ltlzyx2.Text;             //自由项2
                        modOrder.C_STD_CODE  = ltlC_STD_CODE.Text;       //执行标准
                        modOrder.C_BY4       = ltlC_IS_BXG.Text;         //是否不锈钢
                        //modOrder.C_PACK = pack;//包装要求

                        decimal N_WGT = 0;
                        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; //辅数量

                        modOrder.C_RECEIPTCORPID  = 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_CUST_SQ      = modCon.C_REAMRK;                         //客户要求
                        modOrder.C_EMP_ID       = ltlC_EMP_ID.Text;                        //操作人ID
                        modOrder.C_EMP_NAME     = ltlC_EMP_NAME.Text;                      //操作人姓名
                        modOrder.C_CUST_NO      = modCon.C_CUST_NO;                        //客户编码
                        modOrder.C_CUST_NAME    = modCon.C_CUSTNAME;                       //客户名称
                        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    = 0;                     //待审

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

                        modOrder.C_VDEF1 = modMat.C_MAT_TYPE == "6" ? "1001NC100000000052Z3" : "1016NC10000000000V1A"; //质量等级

                        #region                                                                                        //获取钢种单价-折扣-税率
                        decimal Price                 = 0;
                        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

                        orderList.Add(modOrder);

                        #endregion
                    }
                }

                if (tmo_con.InsertFirstOrder(orderList))
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "window.parent.document.getElementById('imgbtnJz').click();window.parent.close();", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "alert('" + ex.Message + "')", true);
            }
        }
Esempio n. 4
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));
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        public AjaxResult ConChange([FromBody] dynamic Json)
        {
            #region                    //参数
            string conNO = Json.conNO; //合同号
            #endregion

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

            try
            {
                if (!string.IsNullOrEmpty(conNO))
                {
                    #region //新增变更合同
                    List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

                    #region //添加合同基本信息



                    Mod_TMO_CON modCon = tmo_con.GetModel(conNO);
                    int         NO     = Convert.ToInt32(modCon.N_CHANGENUM.ToString()) + 1;
                    modCon.C_CON_NO        = modCon.C_CON_NO + "-" + NO.ToString();
                    modCon.C_CON_NAME      = modCon.C_CON_NAME;
                    modCon.N_STATUS        = -1;                                           //客户待提交
                    modCon.D_CONSING_DT    = DateTime.Now;                                 //合同签署日期
                    modCon.D_CONEFFE_DT    = Convert.ToDateTime(DateTime.Now);             //计划生效日期
                    modCon.D_CONINVALID_DT = Convert.ToDateTime(DateTime.Now).AddDays(60); //计划失效日期
                    modCon.C_CON_NO_OLD    = conNO;                                        //原始合同号
                    modCon.N_CHANGENUM     = NO;                                           //变更次数
                    #endregion

                    #region                                                 //添加合同明细
                    Bll_RandomNumber randomnumber = new Bll_RandomNumber(); //流水号
                    DataTable        dtOrder      = tmo_order.GetConOrderList(conNO, "", "", "", "", "").Tables[0];

                    for (int i = 0; i < dtOrder.Rows.Count; i++)
                    {
                        Mod_TMO_ORDER modOrder = tmo_order.GetModel(dtOrder.Rows[i]["C_ID"].ToString()); //订单表
                        string        order_no = randomnumber.CreateOrderNo(modCon.C_CON_NO);            //订单号
                        modOrder.C_ORDER_NO     = order_no;
                        modOrder.C_CON_NO       = modCon.C_CON_NO;                                       //合同号
                        modOrder.C_CON_NAME     = modCon.C_CON_NAME;                                     //合同名称
                        modOrder.N_STATUS       = -1;                                                    //客户待提交
                        modOrder.C_SFPJ         = "N";                                                   //是否评价
                        modOrder.N_EXEC_STATUS  = -2;                                                    //未提报
                        modOrder.N_WGT          = modOrder.N_WGT;                                        //原合同数量
                        modOrder.C_ORDER_NO_OLD = dtOrder.Rows[i]["C_ORDER_NO"].ToString();              //原合同号
                        orderList.Add(modOrder);
                    }
                    #endregion

                    #endregion

                    if (tmo_con.InsertConOrder(modCon, orderList))
                    {
                        result.Code   = DoResult.Success;
                        result.Result = "变更成功";
                    }
                }
                else
                {
                    result.Code   = DoResult.Success;
                    result.Result = "合同为空,无法操作";
                }
            }
            catch (Exception ex)
            {
                result.Code   = DoResult.Success;
                result.Result = ex.Message;
            }
            #endregion

            return(result);
        }
Esempio n. 7
0
        /// <summary>
        /// 新增合同
        /// </summary>
        /// <param name="N_STATUS">合同状态</param>
        /// <returns></returns>
        private bool Add(int N_STATUS)
        {
            bool result = true;

            List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

            #region //添加合同基本信息

            Mod_TMO_CON modCon = new Mod_TMO_CON();

            Mod_TS_DEPT modDept = ts_dept.GetModel(hiddeptid.Value);


            string areaCode = dropConPolicyArea.SelectedItem.Value == "" ? "01" : dropConPolicyArea.SelectedItem.Value;

            conNo               = randomnumber.CreateConNo(areaCode); //合同号
            modCon.C_CON_XH     = conNo;
            modCon.C_CON_NO     = conNo;                              //合同号
            modCon.C_CON_NAME   = txtConName.Text;                    //合同名称
            modCon.C_CONTYPEID  = dropConType.SelectedItem.Value;     //合同类型
            modCon.C_CUSTOMERID = hidCustID.Value;                    //客户ID
            modCon.C_CUSTNAME   = txtCustName.Text;                   //客户名称
            modCon.C_CUST_NO    = hidCustNO.Value;                    //客户客户编码
            modCon.C_EMPLOYEEID = hidsaleempid.Value;                 //业务员ID
            modCon.C_DEPTID     = hiddeptid.Value;                    //业务部门
            if (!string.IsNullOrEmpty(hiddeptid.Value))
            {
                Mod_TS_DEPT moddept = ts_dept.GetModel(hiddeptid.Value);
                modCon.C_AREA = moddept.C_NAME;                           //部门
            }
            modCon.C_CURRENCYTYPEID = dropCurrType.SelectedValue;         //货币
            modCon.D_CONSING_DT     = Convert.ToDateTime(txtDate.Value);  //签署日期
            modCon.D_CONEFFE_DT     = Convert.ToDateTime(txtStart.Value); //计划生效日期
            modCon.D_CONINVALID_DT  = Convert.ToDateTime(txtEnd.Value);   //计划失效日期
            modCon.C_TRANSMODEID    = dropShipVia.SelectedValue;          //发运方式
            modCon.N_STATUS         = N_STATUS;
            modCon.C_EMP_ID         = ltlC_EMP_ID.Text;
            modCon.C_EMP_NAME       = ltlC_EMP_NAME.Text;
            modCon.N_CUST_LEV       = Convert.ToDecimal(ltlCustLEV.Text);//客户等级

            if (!string.IsNullOrEmpty(hidC_CGID.Value))
            {
                Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(hidC_CGID.Value);
                modCon.C_CRECEIPTCUSTOMERID = hidC_CGID.Value;    //收货单位
                modCon.C_ADDRESS            = txtAddr.Value;      //收货地址
                modCon.C_CRECEIPTAREAID     = modCust.C_AREATYPE; //收货地区
            }
            modCon.C_CRECEIPTCORPID = hidC_OTCID.Value;           //开票单位

            modCon.C_STATION   = txtC_STATION.Value;              //站点
            modCon.C_REAMRK    = txtReamrk.Value;
            modCon.N_CHANGENUM = 0;                               //合同变更次数


            #endregion

            #region//添加合同明细
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                Literal       ltlC_ID        = (Literal)rptList.Items[i].FindControl("ltlC_ID");        //物料ID
                Literal       ltlC_TECH_PROT = (Literal)rptList.Items[i].FindControl("ltlC_TECH_PROT"); //客户协议号
                Literal       ltlC_STD_CODE  = (Literal)rptList.Items[i].FindControl("ltlC_STD_CODE");  //执行标准
                Literal       ltlzyx1        = (Literal)rptList.Items[i].FindControl("ltlzyx1");        //自由项1
                Literal       ltlzyx2        = (Literal)rptList.Items[i].FindControl("ltlzyx2");        //自由项2
                Literal       ltlC_IS_BXG    = (Literal)rptList.Items[i].FindControl("ltlC_IS_BXG");    //执行标准
                TextBox       txtPack_Code   = (TextBox)rptList.Items[i].FindControl("txtPack_Code");   //包装要求
                TextBox       txtC_PRO_USE   = (TextBox)rptList.Items[i].FindControl("txtC_PRO_USE");   //产品用途
                TextBox       txtC_CUST_SQ   = (TextBox)rptList.Items[i].FindControl("txtC_CUST_SQ");   //特殊要求
                DropDownList  dropZL         = (DropDownList)rptList.Items[i].FindControl("dropZL");    //质量
                HtmlInputText txtWgt         = (HtmlInputText)rptList.Items[i].FindControl("txtWgt");   //数量
                HtmlInputText txtPrice       = (HtmlInputText)rptList.Items[i].FindControl("txtPrice"); //含税单价

                if (dropConPolicyArea.SelectedItem.Text != "钢坯")
                {
                    if (string.IsNullOrEmpty(txtPack_Code.Text) && tqb_pack.Exists(txtPack_Code.Text))
                    {
                        result = false;
                        break;
                    }
                }

                #region //合同明细

                Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(ltlC_ID.Text);

                Mod_TMO_ORDER modOrder = new Mod_TMO_ORDER();                                                                                                //订单表

                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_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       = dropZL.SelectedItem.Value;                                                                                          //质量主键ID
                modOrder.C_SFPJ        = "N";
                modOrder.C_TECH_PROT   = ltlC_TECH_PROT.Text;                                                                                                //客户协议号
                modOrder.C_FREE1       = ltlzyx1.Text;                                                                                                       //自由项1
                modOrder.C_FREE2       = ltlzyx2.Text;                                                                                                       //自由项2
                modOrder.C_STD_CODE    = ltlC_STD_CODE.Text;                                                                                                 //执行标准
                modOrder.C_BY4         = ltlC_IS_BXG.Text;                                                                                                   //是否不锈钢
                modOrder.N_TYPE        = Convert.ToDecimal(modMat.C_MAT_TYPE);                                                                               //订单类型
                modOrder.C_PACK        = txtPack_Code.Text.Trim();                                                                                           //包装要求

                Mod_TMB_TAXITEMS modTaxi = tmb_taxitems.GetModel(modMat.C_PK_TAXITEMS);

                decimal shuolv = Convert.ToDecimal(modTaxi.N_TAXRATIO) >= 1 ? Convert.ToDecimal(modTaxi.N_TAXRATIO) / 100 : Convert.ToDecimal(modTaxi.N_TAXRATIO); //税率

                modOrder.N_TAXRATE = shuolv;                                                                                                                       //税率

                decimal N_WGT = 0;
                if (!string.IsNullOrEmpty(txtWgt.Value))
                {
                    N_WGT = Convert.ToDecimal(txtWgt.Value);
                }
                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(txtPrice.Value))
                {
                    decimal N_TAXRATE             = Convert.ToDecimal(modOrder.N_TAXRATE) + 1;              //税率
                    decimal N_ORIGINALCURPRICE    = Convert.ToDecimal(txtPrice.Value) / N_TAXRATE;          //原币无税单价
                    decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(txtPrice.Value);                      //原币含税单价

                    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      = txtC_CUST_SQ.Text;             //客户要求
                modOrder.C_PRO_USE      = txtC_PRO_USE.Text;             //产品用途
                modOrder.C_EMP_ID       = modCon.C_EMP_ID;
                modOrder.C_EMP_NAME     = modCon.C_EMP_NAME;
                modOrder.C_CUST_NO      = hidCustNO.Value;
                modOrder.C_CUST_NAME    = txtCustName.Text;
                modOrder.C_SALE_CHANNEL = ltlCustType.Text;
                modOrder.C_LEV          = GetLev("STL_GRD_Lev");          //钢种等级
                modOrder.C_ORDER_LEV    = GetLev("Order_Lev");            //订单等级
                modOrder.N_COST         = 0;                              //成本
                modOrder.C_TRANSMODE    = dropShipVia.SelectedItem.Text;  //发运方式
                modOrder.C_TRANSMODEID  = dropShipVia.SelectedItem.Value; //发运方式主键
                modOrder.C_YWY          = txtSaleUser.Value;              //业务员姓名
                modOrder.N_STATUS       = N_STATUS;

                orderList.Add(modOrder);
                #endregion
            }
            #endregion

            return(result == true?tmo_con.InsertConOrder(modCon, orderList) : result);
        }