Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    Mod_TMO_ORDER mod = tmo_order.GetModel(Request.QueryString["ID"]);
                    if (mod != null)
                    {
                        Mod_TMO_CON conmod = tmo_con.GetModel(mod.C_CON_NO);
                        if (conmod != null)
                        {
                            var list = trc_roll_prodcut.Check_OrderAndRoll(mod.C_CON_NO);
                            if (list.Result)
                            {
                                if (list.Flag == 0)
                                {
                                    lbl_msg.Text = "当前合同存在排产计划,请谨慎操作!";
                                }
                                else
                                {
                                    lbl_msg.Text = "当前合同存在线材库存,请谨慎操作!";
                                }
                            }

                            ltlConNO.Text    = conmod.C_CON_NO;
                            ltlcustno.Text   = conmod.C_CUST_NO;
                            ltlcustname.Text = conmod.C_CUSTNAME;
                            ltlarea.Text     = conmod.C_AREA;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 绑定合同相关信息
        /// </summary>
        private void BindConInfo()
        {
            if (!string.IsNullOrEmpty(txtConNO.Text))
            {
                Mod_TMO_CON mod = con.GetModel(txtConNO.Text);
                if (mod != null)
                {
                    dropCurrType.SelectedIndex = dropCurrType.Items.IndexOf(dropCurrType.Items.FindByText(mod.C_CURRENCY_TYPE));
                    txtDate.Value             = Convert.ToDateTime(mod.D_CONSING_DT).ToString("yyy-MM-dd");
                    txtStart.Value            = Convert.ToDateTime(mod.D_CONEFFE_DT).ToString("yyy-MM-dd");
                    txtEnd.Value              = Convert.ToDateTime(mod.D_CONINVALID_DT).ToString("yyy-MM-dd");
                    dropConType.SelectedIndex = dropConType.Items.IndexOf(dropConType.Items.FindByText(mod.C_CON_TYPE));
                    txtConNO.Text             = mod.C_CON_NO;
                    txtConName.Text           = mod.C_CON_NAME;
                    txtCustName.Text          = mod.C_CUST_NAME;
                    dropShipVia.SelectedIndex = dropShipVia.Items.IndexOf(dropShipVia.Items.FindByText(mod.C_SHIPVIA));
                    dropConArea.SelectedIndex = dropConArea.Items.IndexOf(dropConArea.Items.FindByText(mod.C_CON_AREA));
                    txtState.Text             = GetOrderState(Convert.ToInt32(mod.N_CON_STATUS));
                    hidState.Value            = mod.N_CON_STATUS.ToString();

                    bool status = mod.N_CON_STATUS.ToString() == "-1" ? true : false;
                    btnSave.Enabled   = status;
                    btnAdd.Disabled   = mod.N_CON_STATUS.ToString() == "-1" ? false : true;
                    btnEdit.Disabled  = mod.N_CON_STATUS.ToString() == "-1" ? false : true;
                    btnDel.Enabled    = status;
                    btnSubmit.Enabled = status;
                }

                BindConOrder();
            }
        }
Beispiel #3
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);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 获取合同信息
        /// </summary>

        private void GetCon()
        {
            Mod_TMO_CON mod = con.GetModel(ltlConN0.Text);

            if (mod != null)
            {
                txtTitle.Text   = mod.C_CON_NAME;
                txtContent.Text = mod.C_DESC;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 获取合同信息
        /// </summary>

        private void GetCon()
        {
            Mod_TMO_CON mod = tmo_con.GetModel(ltlConN0.Text);

            if (mod != null)
            {
                txtTitle.Text   = mod.C_CON_NO;
                txtContent.Text = mod.C_REAMRK;
            }
        }
        /// <summary>
        /// 加载合同信息
        /// </summary>
        private void GetConInfo()
        {
            if (!string.IsNullOrEmpty(ltlTaskID.Text))
            {
                try
                {
                    #region //加载合同基本信息

                    Mod_TMO_CON modcon = con.GetModel(ltlTaskID.Text);
                    if (modcon != null)
                    {
                        hidcon.Value            = modcon.C_CON_NO;
                        ltlConNo.Text           = modcon.C_CON_NO;
                        ltlConName.Text         = modcon.C_CON_NAME;
                        ltlConType.Text         = GetDic(modcon.C_CONTYPEID);
                        ltlCustName.Text        = modcon.C_CUSTNAME;
                        ltlD_CONSING_DT.Text    = Convert.ToDateTime(modcon.D_CONSING_DT).ToString("yyy-MM-dd");
                        ltlD_CONEFFE_DT.Text    = Convert.ToDateTime(modcon.D_CONEFFE_DT).ToString("yyy-MM-dd");
                        ltlD_CONINVALID_DT.Text = Convert.ToDateTime(modcon.D_CONINVALID_DT).ToString("yyy-MM-dd");

                        Mod_TMB_FLOWINFO modFlow = tmb_flowinfo.GetModel(modcon.C_FLOWID);
                        ltlC_APPROVER_FLOW.Text = modFlow?.C_NAME ?? "";

                        ltlC_SHIPVIA.Text       = GetDic(modcon.C_TRANSMODEID);    //发运方式
                        ltlC_CURRENCY_TYPE.Text = GetDic(modcon.C_CURRENCYTYPEID); //货币类型
                        ltlC_BUSINESS_TYPE.Text = GetDic(modcon.C_BIZTYPE);        //业务类型

                        Mod_TS_DEPT modDept = ts_dept.GetModel(modcon.C_DEPTID);
                        if (modDept != null)
                        {
                            ltlDept.Text = modDept.C_NAME;//部门
                        }

                        ltlSaleUser.Text    = ts_user.GetSaleName(modcon.C_EMPLOYEEID); //业务员
                        ltlC_SALE_DEPT.Text = GetDic(modcon.C_SALECORPID);              //销售组织

                        ltlC_CGC.Text     = GetCust(modcon.C_CRECEIPTCUSTOMERID);       //收货单位
                        ltlC_OTC.Text     = GetCust(modcon.C_CRECEIPTCORPID);           //开票单位
                        ltlC_STATION.Text = modcon.C_STATION;
                        ltlConArea.Text   = modcon.C_AREA;
                        ltlConState.Text  = StringFormat.GetOrderState(modcon.N_STATUS);
                        ltlDESC.Text      = modcon.C_REAMRK;


                        //加载合同订单列表
                        GetOrderList();
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    WebMsg.MessageBox(ex.Message);
                }
            }
        }
Beispiel #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            #region //保存
            Mod_TMO_CON mod = con.GetModel(txtConNO.Value);
            if (mod != null)
            {
                mod.C_CON_NAME      = txtConName.Value;
                mod.C_CON_TYPE      = dropConType.SelectedItem.Text;
                mod.D_CONSING_DT    = Convert.ToDateTime(txtQianDanDT.Value);
                mod.D_CONEFFE_DT    = Convert.ToDateTime(txtPlanStartDT.Value);
                mod.D_CONINVALID_DT = Convert.ToDateTime(txtPlanEndDT.Value);
                mod.C_SHIPVIA       = dropFaYun.SelectedItem.Text;
                mod.C_CURRENCY_TYPE = dropBiZhong.SelectedItem.Text;
                mod.C_BUSINESS_TYPE = dropYeWuType.SelectedItem.Text;
                mod.C_DEPT_ID       = hidDeptID.Value;
                mod.C_SALESMAN      = hidEmpID.Value;
                mod.C_SALE_DEPT     = dropSale.SelectedValue;
                mod.N_FLAG          = Convert.ToInt32(dropClass.SelectedValue);
                mod.C_STOCK_DEPT    = txtKC.Value;
                mod.C_CON_AREA      = dropArea.SelectedValue;
                mod.C_ISSHIP        = chkIsFaYun.Checked == true ? "1" : "0";

                mod.C_DESC = txtDESC.Value;

                mod.N_FLAG = Convert.ToInt32(GetConFlag(dropClass.SelectedItem.Text));

                var BaseUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"];
                if (BaseUser != null)
                {
                    mod.C_XG_MODIFY     = BaseUser.Id;
                    mod.C_XG_MODEIFY_DT = DateTime.Now;
                }

                if (con.Update(mod))
                {
                    #region //更新订单等级

                    int lev = Convert.ToInt32(dropClass.SelectedValue);

                    if (condetails.UpdateOrderLEV(txtConNO.Value, lev))
                    {
                        WebMsg.MessageBox("保存成功");
                        GetConInfo();//重新加载
                    }

                    #endregion
                }
            }

            #endregion
        }
        /// <summary>
        /// 加载合同信息
        /// </summary>
        private void GetConInfo()
        {
            if (!string.IsNullOrEmpty(ltlTaskID.Text))
            {
                Mod_TMO_CON modcon = con.GetModel(ltlTaskID.Text);
                if (modcon != null)
                {
                    txtConNO.Value   = ltlTaskID.Text;
                    txtConName.Value = modcon.C_CON_NAME;
                    dropConType.Items.Insert(0, new ListItem(modcon.C_CON_TYPE, modcon.C_CON_TYPE));
                    txtCustName.Value     = modcon.C_CUST_NAME;
                    txtQianDanDT.Value    = Convert.ToDateTime(modcon.D_CONSING_DT).ToString("yyy-MM-dd");
                    txtPlanStartDT.Value  = Convert.ToDateTime(modcon.D_CONEFFE_DT).ToString("yyy-MM-dd");
                    txtPlanEndDT.Value    = Convert.ToDateTime(modcon.D_CONINVALID_DT).ToString("yyy-MM-dd");
                    txtSysPlanEndDT.Value = Convert.ToDateTime(modcon.D_SYS_CONINVALID_DT).ToString("yyy-MM-dd");
                    txtCustLEV.Value      = modcon.N_CUST_LEV.ToString() == "1" ? "优先" : "普通";

                    dropFaYun.Items.Insert(0, new ListItem(modcon.C_SHIPVIA, modcon.C_SHIPVIA));
                    dropBiZhong.Items.Insert(0, new ListItem(modcon.C_CURRENCY_TYPE, modcon.C_CURRENCY_TYPE));
                    dropYeWuType.Items.Insert(0, new ListItem(modcon.C_BUSINESS_TYPE, modcon.C_BUSINESS_TYPE));
                    string flag = GetConFlag(Convert.ToInt32(modcon.N_FLAG));
                    dropClass.Items.Insert(0, new ListItem(flag, flag));

                    #region //收货单位/收货地址/开票单位

                    DataTable dt1 = condetails.GetCGC_OTC(txtConNO.Value).Tables[0];
                    if (dt1.Rows.Count > 0)
                    {
                        txtShuoHuoCompany.Value = dt1.Rows[0]["C_CGC"].ToString();
                        txtShuoHuoAddr.Value    = dt1.Rows[0]["C_CGADDR"].ToString();
                        txtKaiPiaoCompany.Value = dt1.Rows[0]["C_OTC"].ToString();
                    }


                    #endregion

                    dropArea.Items.Insert(0, new ListItem(modcon.C_CON_AREA, modcon.C_CON_AREA));

                    txtState.Value = StringFormat.GetOrderState(modcon.N_CON_STATUS);

                    if (!string.IsNullOrEmpty(modcon.C_ISSHIP))
                    {
                        chkIsFaYun.Checked = modcon.C_ISSHIP == "0" ? false : true;
                    }
                    txtDESC.Value = modcon.C_DESC;


                    GetOrderList();//加载合同明细
                }
            }
        }
Beispiel #9
0
        private void BindInfo()
        {
            if (!string.IsNullOrEmpty(txtconno.Text))
            {
                #region //合同搜索
                Mod_TMO_CON modCon = tmo_con.GetModel(txtconno.Text);
                if (modCon != null)
                {
                    droparea.SelectedIndex = droparea.Items.IndexOf(droparea.Items.FindByText(modCon.C_AREA));
                    txtC_CONNO.Text        = modCon.C_CON_NO;
                    txtC_DH_COMPANY.Text   = modCon.C_CUSTNAME;
                    txtC_SH_COMPANY.Text   = modCon.C_CUSTNAME;
                    txtC_STATION.Text      = modCon.C_STATION;
                    txtC_CUSTNO.Text       = modCon.C_CUST_NO;

                    Mod_TS_CUSTFILE mod = ts_custfile.GetModelCode(modCon.C_CUST_NO);
                    if (mod != null)
                    {
                        txtC_CUSTNAME.Text = mod.C_NAME;       //客户名称
                        txtC_KH_BANK.Text  = mod.C_EXTEND1;    //开户行
                        txtC_TAXNO.Text    = mod.C_TAXPAYERNO; //税号
                        txtC_ACCOUNT.Text  = mod.C_EXTEND2;    //账号
                        txtC_ADDRESS.Text  = mod.C_EXTEND3;    //地址
                        txtC_TEL.Text      = mod.C_EXTEND4;    //电话
                    }
                }


                #endregion
            }

            if (!string.IsNullOrEmpty(txtcustno.Text))
            {
                #region //客户编码搜索
                Mod_TS_CUSTFILE mod = ts_custfile.GetModelCode(txtcustno.Text);
                if (mod != null)
                {
                    txtC_CUSTNO.Text   = mod.C_NO;
                    txtC_CUSTNAME.Text = mod.C_NAME;       //客户名称
                    txtC_KH_BANK.Text  = mod.C_EXTEND1;    //开户行
                    txtC_TAXNO.Text    = mod.C_TAXPAYERNO; //税号
                    txtC_ACCOUNT.Text  = mod.C_EXTEND2;    //账号
                    txtC_ADDRESS.Text  = mod.C_EXTEND3;    //地址
                    txtC_TEL.Text      = mod.C_EXTEND4;    //电话
                }
                #endregion
            }
        }
Beispiel #10
0
        //提交合同
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtConNO.Text) && !string.IsNullOrEmpty(txtCustName.Text))
            {
                if (rptList.Items.Count > 0)
                {
                    Mod_TMO_CON modcon = con.GetModel(txtConNO.Text);
                    modcon.N_CON_STATUS        = 0;                                   //更新合同状态
                    modcon.D_CONINVALID_DT     = Convert.ToDateTime(txtEnd.Value);
                    modcon.D_SYS_CONINVALID_DT = Convert.ToDateTime(ltlSysDate.Text); //系统计划失效日期
                    if (con.Update(modcon))
                    {
                        #region//获取发货上允差
                        decimal   range = 0;
                        DataTable dt    = comdiff.GetRangeList(Convert.ToDecimal(lblSum.Text)).Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            range = Convert.ToDecimal(dt.Rows[0]["C_RANGE"]);
                        }
                        #endregion

                        //更新每个订单状态和发货上允差
                        bool result = false;
                        foreach (RepeaterItem rpt in rptList.Items)
                        {
                            HtmlInputCheckBox chkSelect = (HtmlInputCheckBox)rpt.FindControl("chkSelect");
                            result = condetails.UpdateGC(range, chkSelect.Value);
                        }
                        if (result)
                        {
                            WebMsg.MessageBox("提交成功", "MyCon.aspx");
                        }
                    }
                }
                else
                {
                    WebMsg.MessageBox("请添加订单");
                    return;
                }
            }
            else
            {
                WebMsg.MessageBox("请输入合同名称,再点击保存");
            }
        }
Beispiel #11
0
        public AjaxResult GetOldOrderAdd([FromBody] dynamic Json)
        {
            #region                                    //参数
            string ConNo     = Json.ConNo;             //合同号
            JArray OrderList = (JArray)Json.OrderList; //.OrderNo
            #endregion

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

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

            Mod_TMO_CON modCon = tmo_con.GetModel(ConNo);
            for (int i = 0; i < OrderList.Count; i++)
            {
                #region //添加订单

                Mod_TMO_ORDER modOrder = tmo_order.GetOrderModel(OrderList[i]["OrderNo"].ToString());
                string        order_no = randomnumber.CreateOrderNo(ConNo); //订单号
                modOrder.C_ORDER_NO = order_no;
                modOrder.C_CON_NO   = ConNo;                                //合同号
                modOrder.C_CON_NAME = modCon.C_CON_NAME;                    //合同名称
                modOrder.C_AREA     = modCon.C_AREA;                        //区域
                //modOrder.D_NEED_DT = modCon.D_CONINVALID_DT;//需求日期
                modOrder.D_DELIVERY_DT    = modCon.D_CONINVALID_DT;         //计划收货日期
                modOrder.D_DT             = DateTime.Now;                   //订单日期
                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_REMARK         = modCon.C_REAMRK;

                ListOrder.Add(modOrder);
                #endregion
            }
            result.Result = tmo_con.InsertConOrder(modCon, ListOrder) == true ? "提交成功" : "提交失败";
            #endregion

            return(result);
        }
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)
                {
                    ltlC_EMP_ID.Text   = vUser.Id;
                    ltlC_EMP_NAME.Text = vUser.Name;

                    if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                    {
                        ltlCon_No.Text = Request.QueryString["ID"];//合同号
                        Mod_TMO_CON modCon = tmo_con.GetModel(ltlCon_No.Text);
                        ltlCustNo.Text = modCon.C_CUST_NO;
                    }
                }
                else
                {
                    WebMsg.CheckUserLogin();
                }
            }
        }
Beispiel #13
0
        //销售订单导入NC
        protected void Button1_Click(object sender, EventArgs e)
        {
            #region //导入NC

            Mod_TMO_CON mod = tmo_con.GetModel(txtCON.Text);

            List <ApiOrderDto> orderDto = new List <ApiOrderDto>();
            ApiOrderDto        dto      = new ApiOrderDto();
            dto.NC_ID     = "";
            dto.SaleCode  = txtConNo.Text;
            dto.ConNO     = mod.C_CON_NO;
            dto.D_NC_DATE = mod.D_MOD_DT.ToString();
            orderDto.Add(dto);
            string        result      = "";
            string        filePath    = "~/FileInterface/download/" + txtConNo.Text + ".xml";
            string        xmlFileName = System.Web.HttpContext.Current.Server.MapPath(filePath);
            List <string> resList     = apisaleorder.SendXmlOrder(orderDto, xmlFileName, "");
            #endregion

            string jg = resList[0].ToString().ToString() == "1" ? "导入NC成功" : GetNCError(resList);
            result = "单据号:" + txtConNo.Text + ",结果:" + jg;

            WebMsg.MessageBox(result);
        }
Beispiel #14
0
        /// <summary>
        /// 绑定合同相关信息
        /// </summary>
        private void BindConInfo()
        {
            if (!string.IsNullOrEmpty(txtConNO.Text))
            {
                Mod_TMO_CON mod = con.GetModel(txtConNO.Text);
                if (mod != null)
                {
                    dropCurrType.SelectedIndex = dropCurrType.Items.IndexOf(dropCurrType.Items.FindByText(mod.C_CURRENCY_TYPE));
                    txtDate.Value             = Convert.ToDateTime(mod.D_CONSING_DT).ToString("yyy-MM-dd");
                    txtStart.Value            = Convert.ToDateTime(mod.D_CONEFFE_DT).ToString("yyy-MM-dd");
                    txtEnd.Value              = Convert.ToDateTime(mod.D_CONINVALID_DT).ToString("yyy-MM-dd");
                    dropConType.SelectedIndex = dropConType.Items.IndexOf(dropConType.Items.FindByText(mod.C_CON_TYPE));
                    txtConNO.Text             = mod.C_CON_NO;
                    txtConName.Text           = mod.C_CON_NAME;
                    txtCustName.Text          = mod.C_CUST_NAME;
                    dropShipVia.SelectedIndex = dropShipVia.Items.IndexOf(dropShipVia.Items.FindByText(mod.C_SHIPVIA));
                    dropConArea.SelectedIndex = dropConArea.Items.IndexOf(dropConArea.Items.FindByText(mod.C_CON_AREA));
                    txtState.Text             = GetOrderState(mod.N_CON_STATUS);
                    hidState.Value            = mod.N_CON_STATUS.ToString();

                    BindConOrder();
                }
            }
        }
        /// <summary>
        /// 加载客户默认地址与开票单位
        /// </summary>
        private void BindUserInfo()
        {
            Mod_TMO_CON modCON = tmo_con.GetModel(hidconNo.Value);

            if (modCON != null)
            {
                hidConName.Value  = modCON.C_CON_NAME;
                hidCurrType.Value = modCON.C_CURRENCY_TYPE;
                hidConArea.Value  = modCON.C_CON_AREA;
                hidShipVia.Value  = modCON.C_SHIPVIA;

                //客户档案
                Mod_TS_CUSTFILE mod = custfile.GetCustModel(modCON.C_CUST_NO);
                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(mod.C_ID, "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(mod.C_ID).Tables[0];
                if (dtc.Rows.Count > 0)
                {
                    txtOTCompany.Value = dtc.Rows[0]["C_OTCOMPANY"].ToString();
                }
            }
        }
Beispiel #16
0
        /// <summary>
        /// 加载合同信息
        /// </summary>
        private void GetConInfo()
        {
            if (!string.IsNullOrEmpty(txtConNO.Value))
            {
                Mod_TMO_CON modcon = tmo_con.GetModel(txtConNO.Value);
                if (modcon != null)
                {
                    #region //变更合同量控制
                    DataTable dtfywgt = GetData("DM002");
                    if (dtfywgt.Rows.Count > 0)
                    {
                        decimal num = 0;
                        if (!string.IsNullOrEmpty(dtfywgt.Rows[0]["C_DETAILCODE"].ToString()))
                        {
                            num = Convert.ToDecimal(dtfywgt.Rows[0]["C_DETAILCODE"].ToString());
                            decimal fywgt = Convert.ToDecimal(txtoldconwgt.Text);
                            decimal fd    = fywgt * num;
                            hidsf.Value  = Convert.ToString(fywgt + fd); //上幅数
                            hidxf.Value  = Convert.ToString(fywgt - fd); //下幅数
                            hidmsg.Value = dtfywgt.Rows[0]["C_DETAILNAME"].ToString();
                        }
                    }
                    else
                    {
                        hidsf.Value = txtoldconwgt.Text;
                    }
                    #endregion

                    Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(modcon.C_CUSTOMERID);
                    ltlCustNo.Text       = modCust?.C_NO;
                    ltlN_CON_STATUS.Text = modcon.N_STATUS.ToString();
                    hidstatus.Value      = modcon.N_STATUS.ToString();

                    #region //根据合同状态显示按钮

                    switch (modcon.N_STATUS.ToString())
                    {
                    case "0":                      //待审
                        btnAdd.Disabled   = false; //产品
                        btnCheck.Enabled  = true;  //送审
                        btncondel.Visible = true;
                        btncancel.Visible = true;  //撤回客户
                        break;

                    default:
                        btncondel.Visible = false;
                        btncancel.Visible = false;
                        break;
                    }

                    #endregion


                    txtConName.Value          = modcon.C_CON_NAME;
                    dropConType.SelectedIndex = dropConType.Items.IndexOf(dropConType.Items.FindByValue(modcon.C_CONTYPEID));
                    txtCustName.Value         = modcon.C_CUSTNAME;

                    txtQianDanDT.Value   = Convert.ToDateTime(modcon.D_CONSING_DT).ToString("yyy-MM-dd");
                    txtPlanStartDT.Value = Convert.ToDateTime(modcon.D_CONEFFE_DT).ToString("yyy-MM-dd");
                    txtPlanEndDT.Value   = Convert.ToDateTime(modcon.D_CONINVALID_DT).ToString("yyy-MM-dd");


                    dropFaYun.SelectedIndex    = dropFaYun.Items.IndexOf(dropFaYun.Items.FindByValue(modcon.C_TRANSMODEID));
                    dropBiZhong.SelectedIndex  = dropBiZhong.Items.IndexOf(dropBiZhong.Items.FindByValue(modcon.C_CURRENCYTYPEID));
                    dropYeWuType.SelectedIndex = dropYeWuType.Items.IndexOf(dropYeWuType.Items.FindByValue(modcon.C_BIZTYPE));

                    #region//收货地址
                    DataTable dtaddr = ts_custaddr.GetAddr("", "", modcon.C_CUSTOMERID, "", "").Tables[0];
                    if (dtaddr.Rows.Count > 0)
                    {
                        dropAddr.DataSource     = dtaddr;
                        dropAddr.DataTextField  = "C_CGAREA";
                        dropAddr.DataValueField = "C_CGAREA";
                        dropAddr.DataBind();
                        dropAddr.SelectedIndex = dropAddr.Items.IndexOf(dropAddr.Items.FindByText(modcon.C_ADDRESS));
                    }
                    #endregion

                    #region //部门
                    Mod_TS_DEPT modDept = ts_dept.GetModel(modcon.C_DEPTID);
                    if (modDept != null)
                    {
                        txtDept.Value = modDept.C_NAME;

                        hidC_DEPT_ID.Value = modcon.C_DEPTID;
                    }

                    #endregion

                    #region //业务员
                    txtSaleUser.Value   = ts_user.GetSaleName(modcon.C_EMPLOYEEID);
                    hidC_SALESMAN.Value = modcon.C_EMPLOYEEID;
                    #endregion

                    dropSale.SelectedIndex = dropSale.Items.IndexOf(dropSale.Items.FindByValue(modcon.C_SALECORPID));

                    txtShuoHuoCompany.Value = GetCust(modcon.C_CRECEIPTCUSTOMERID);
                    txtKaiPiaoCompany.Value = GetCust(modcon.C_CRECEIPTCORPID);
                    txtC_STATION.Value      = modcon.C_STATION;

                    txtState.Value      = StringFormat.GetOrderState(modcon.N_STATUS);
                    txtDESC.Value       = modcon.C_REAMRK;
                    txtZhiDanRen.Value  = GetUserName(modcon.C_COPERATORID);
                    txtZhiDanTime.Value = modcon.D_DMAKEDATE.ToString();

                    #region //最后修改人/最后修改时间

                    txtC_APPROVEID.Value   = GetUserName(modcon.C_APPROVEID);
                    txtD_APPROVEDATE.Value = modcon.D_APPROVEDATE.ToString();
                    txtLastEditUser.Value  = GetUserName(modcon.C_EDITEMPLOYEEID);
                    txtLastEditTime.Value  = modcon.D_EDITDATE.ToString();

                    #endregion

                    GetOrderList();
                }
            }
        }
Beispiel #17
0
        /// <summary>
        /// 添加发运单
        /// </summary>
        /// <returns></returns>
        private bool InsertFyd()
        {
            decimal fyzs  = 0;
            decimal fywgt = 0;

            string sendcode = randomnumber.CreateDispID(); //发运单据号

            #region                                        //表体
            List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                HtmlInputCheckBox chkOrder     = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单主键
                HtmlInputText     txtfyzs      = (HtmlInputText)rptList.Items[i].FindControl("txtfyzs");      //发运支数
                HtmlInputText     txtjhfyl     = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl");     //发运数量
                HtmlInputHidden   hidC_CGID    = (HtmlInputHidden)rptList.Items[i].FindControl("hidC_CGID");  //收货单位
                HtmlInputHidden   hidshdq      = (HtmlInputHidden)rptList.Items[i].FindControl("hidshdq");    //收货地区
                TextBox           txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code");       //包装要求
                DropDownList      dropzldj     = (DropDownList)rptList.Items[i].FindControl("dropzldj");      //质量等级
                DropDownList      dropshdz     = (DropDownList)rptList.Items[i].FindControl("dropshdz");      //收货地址
                Literal           ltlpkplan    = (Literal)rptList.Items[i].FindControl("ltlpkplan");          //日计划主键
                Literal           ltlcustno    = (Literal)rptList.Items[i].FindControl("ltlcustno");          //客户编码

                HtmlInputHidden hidckid     = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid");       //仓库ID
                HtmlInputText   txtckname   = (HtmlInputText)rptList.Items[i].FindControl("txtckname");       //仓库名称
                HtmlInputText   txtqtyq     = (HtmlInputText)rptList.Items[i].FindControl("txtqtyq");         //其他要求
                HtmlInputText   txtremark   = (HtmlInputText)rptList.Items[i].FindControl("txtremark");       //行备注
                TextBox         txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code");           //执行标准
                TextBox         txtC_FREE1  = (TextBox)rptList.Items[i].FindControl("txtC_FREE1");            //自由项1
                TextBox         txtC_FREE2  = (TextBox)rptList.Items[i].FindControl("txtC_FREE2");            //自由项2

                Mod_TMO_ORDER modOrder = tmo_order.GetModel(chkOrder.Value);
                if (modOrder != null)
                {
                    fyzs  += Convert.ToDecimal(txtfyzs.Value ?? "0");
                    fywgt += Convert.ToDecimal(txtjhfyl.Value ?? "0");

                    Mod_TMD_DISPATCHDETAILS modfyditem = new Mod_TMD_DISPATCHDETAILS();
                    modfyditem.C_DISPATCH_ID     = sendcode;                                                               //发运单单据号
                    modfyditem.C_MAT_CODE        = modOrder.C_MAT_CODE;                                                    //物料编码
                    modfyditem.C_MAT_NAME        = modOrder.C_MAT_NAME;                                                    //物料名称
                    modfyditem.C_SPEC            = modOrder.C_SPEC;                                                        //规格
                    modfyditem.C_STL_GRD         = modOrder.C_STL_GRD;                                                     //钢种
                    modfyditem.C_QUALIRY_LEV     = dropzldj.SelectedItem.Value;                                            //质量等级主键-发运单
                    modfyditem.C_JUDGE_LEV_ZH    = dropzldj.SelectedItem.Text;                                             //质量等级编码
                    modfyditem.C_FREE_TERM       = txtC_FREE1.Text;                                                        //自由项
                    modfyditem.C_FREE_TERM2      = txtC_FREE2.Text;                                                        //自由项
                    modfyditem.C_PACK            = txtPack_Code.Text;                                                      //包装要求
                    modfyditem.C_STD_CODE        = txtStd_Code.Text;                                                       //执行标准
                    modfyditem.C_ELSENEED        = txtqtyq.Value;                                                          //其他要求?
                    modfyditem.C_REMARK          = txtremark.Value;                                                        //行备注*****
                    modfyditem.N_COM_AMOUNT_WGT  = modOrder.N_FNUM;                                                        //原始订单辅数量
                    modfyditem.N_WGT             = modOrder.N_WGT;                                                         //原始订单数量
                    modfyditem.C_EQUATION_FACTOR = modOrder.N_HSL.ToString();                                              //换算率
                    modfyditem.C_UNITIS          = modOrder.C_UNITID;                                                      //主计量单位ID
                    modfyditem.C_ORGO_CUST       = modOrder.C_CUST_NAME;                                                   //订货客户
                    modfyditem.C_CGC             = hidC_CGID.Value;                                                        //收货单位-发运单
                    modfyditem.C_ORDER_TYPE      = modOrder.N_TYPE.ToString() == "8" ? "805" : modOrder.N_TYPE.ToString(); //订单类型 8线材 6钢坯 831废乱材  841焦化产品 851渣
                    modfyditem.C_SEND_AREA       = hidshdq.Value;                                                          //到货地区-发运单
                    modfyditem.C_AREA            = dropshdz.SelectedItem?.Value ?? "";                                     //到货地址-发运单
                    modfyditem.C_EMP_ID          = ltlempid.Text;
                    modfyditem.C_EMP_NAME        = ltlempname.Text;
                    modfyditem.C_CON_NO          = modOrder.C_CON_NO;                                            //合同号
                    modfyditem.C_PLAN_ID         = ltlpkplan.Text;                                               //日计划主键
                    modfyditem.C_NO            = modOrder.C_ORDER_NO;                                            //订单号
                    modfyditem.C_ORDERPK       = modOrder.C_ID;                                                  //订单主键
                    modfyditem.C_CUSTNO        = ltlcustno.Text;                                                 //客户编码
                    modfyditem.N_FYZS          = Convert.ToDecimal(txtfyzs.Value == "" ? "0" : txtfyzs.Value);   //发运支数
                    modfyditem.N_FYWGT         = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value); //发运数量
                    modfyditem.C_SEND_STOCK    = txtckname.Value;                                                //发运仓库名称
                    modfyditem.C_SEND_STOCK_PK = hidckid.Value;                                                  //发运仓库ID
                    modfyditem.C_PRODUCT_ID    = "";                                                             //库存产品ID
                    modfyditem.C_AU_UNITIS     = modOrder.C_FUNITID;                                             //辅单位
                    modfyditem.N_PRICE         = 0;                                                              //到货地点费用

                    item.Add(modfyditem);
                }
            }
            #endregion

            #region//表头
            Mod_TMD_DISPATCH modfyd = new Mod_TMD_DISPATCH();

            modfyd.C_ID             = sendcode;                         //发运单单据号
            modfyd.C_GPS_NO         = txtgps.Text;                      //GPS号
            modfyd.D_DISP_DT        = Convert.ToDateTime(txtfydt.Text); //发运日期
            modfyd.C_SHIPVIA        = dropfyfs.SelectedItem.Value;      //发运方式
            modfyd.C_COMCAR         = dropcys.SelectedItem.Value;       //承运商
            modfyd.C_IS_WIRESALE    = dropsfxc.SelectedItem.Text;       //汉字是否线材
            modfyd.C_IS_WIRESALE_ID = dropsfxc.SelectedItem.Value;      //是否线材主键
            modfyd.C_LIC_PLA_NO     = txtcph.Text;                      //车牌号
            modfyd.C_ATSTATION      = txtdz.Text;                       //到站
            modfyd.C_CREATE_ID      = ltlempid.Text;                    //制单人
            modfyd.C_EMP_ID         = ltlempid.Text;                    //修改人ID
            modfyd.C_EMP_NAME       = ltlempname.Text;                  //修改人
            modfyd.C_EXTEND5        = ltltype.Text;                     //订单类型 8线材 6钢坯 831废乱材  841焦化产品 851渣
            modfyd.C_CUSTNAME       = ltlcustname.Text;                 //客户
            modfyd.C_CON_NO         = ltlcon_no.Text;                   //合同号
            modfyd.N_QUA            = fyzs;                             //发运支数
            modfyd.N_WGT            = fywgt;                            //发运量
            modfyd.N_IS_EXPORT      = 0;                                //是否包到价
            modfyd.C_EXTEND2        = txtcph.Text;                      //虚拟车号
            Mod_TMO_CON modCon = tmo_con.GetModel(ltlcon_no.Text);
            if (modCon != null)
            {
                modfyd.C_BUSINESS_DEPT = modCon.C_DEPTID;     //业务部门
                modfyd.C_BUSINESS_ID   = modCon.C_EMPLOYEEID; //业务员
            }
            #endregion

            if (tmd_dispatch.InsertFYD(modfyd, item))
            {
                txtsendcode.Text = sendcode;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #18
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);
            }
        }
Beispiel #19
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);
        }
Beispiel #20
0
        private bool Add(int N_STATUS)
        {
            bool result = true;

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

            #region //修改合同基本信息

            Mod_TMO_CON modCon = tmo_con.GetModel(txtConNO.Text);
            modCon.C_CON_NO     = txtConNO.Text;
            modCon.C_CON_NAME   = txtConName.Text;
            modCon.C_CONTYPEID  = dropConType.SelectedItem.Value;                    //合同类型
            modCon.C_EMPLOYEEID = hidsaleempid.Value;                                //业务员
            modCon.C_DEPTID     = hiddeptid.Value;                                   //业务部门

            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.D_NEED_DT        = Convert.ToDateTime(txtEnd.Value).AddDays(-30); //需求日期
            modCon.C_TRANSMODEID    = dropShipVia.SelectedValue;                     //发运方式
            modCon.N_STATUS         = N_STATUS;

            Mod_TS_DEPT modDept = ts_dept.GetModel(hiddeptid.Value);
            if (modDept != null)
            {
                modCon.C_AREA = modDept.C_NAME;//合同区域
            }

            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_STATION = txtC_STATION.Value;
            modCon.C_REAMRK  = txtReamrk.Value;

            #endregion

            #region//修改合同明细
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                Literal      ltlC_NO                  = (Literal)rptList.Items[i].FindControl("ltlC_NO");
                TextBox      txtPack_Code             = (TextBox)rptList.Items[i].FindControl("txtPack_Code");             //包装要求
                TextBox      txtWgt                   = (TextBox)rptList.Items[i].FindControl("txtWgt");                   //数量
                TextBox      txtC_PRO_USE             = (TextBox)rptList.Items[i].FindControl("txtC_PRO_USE");             //用途
                TextBox      txtC_CUST_SQ             = (TextBox)rptList.Items[i].FindControl("txtC_CUST_SQ");             //特殊要求
                TextBox      txtN_ORIGINALCURTAXPRICE = (TextBox)rptList.Items[i].FindControl("txtN_ORIGINALCURTAXPRICE"); //含税单价
                DropDownList dropZL                   = (DropDownList)rptList.Items[i].FindControl("dropZL");              //质量

                if (string.IsNullOrEmpty(txtPack_Code.Text) && tqb_pack.Exists(txtPack_Code.Text))
                {
                    result = false;
                    break;
                }


                Mod_TMO_ORDER modOrder = tmo_order.GetModel(ltlC_NO.Text);
                modOrder.C_CON_NAME = modCon.C_CON_NAME;            //合同名称
                modOrder.C_AREA     = modCon.C_AREA;                //合同区域
                //modOrder.D_NEED_DT = modCon.D_NEED_DT;//需求日期
                modOrder.D_DELIVERY_DT = modCon.D_CONINVALID_DT;    //计划收货日期
                modOrder.C_VDEF1       = dropZL.SelectedItem.Value; //质量主键
                modOrder.C_PACK        = txtPack_Code.Text.Trim();  //包装要求
                decimal N_WGT = 0;
                if (!string.IsNullOrEmpty(txtWgt.Text))
                {
                    N_WGT          = Convert.ToDecimal(txtWgt.Text);
                    modOrder.N_WGT = N_WGT;                                         //数量
                }
                modOrder.N_FNUM = modOrder.N_HSL == 0 ? 1 : N_WGT / modOrder.N_HSL; //辅数量

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

                    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.C_CUST_SQ        = txtC_CUST_SQ.Text;              //客户要求
                modOrder.C_PRO_USE        = txtC_PRO_USE.Text;              //产品用途
                modOrder.C_TRANSMODE      = dropShipVia.SelectedItem.Text;  //发运方式
                modOrder.C_TRANSMODEID    = dropShipVia.SelectedItem.Value; //发运主键
                modOrder.C_YWY            = txtSaleUser.Value;              //业务员
                modOrder.N_STATUS         = N_STATUS;                       //订单状态
                modOrder.N_EXEC_STATUS    = -2;                             //订单状态
                orderList.Add(modOrder);
            }
            #endregion

            return(result == true?tmo_con.UpdateConOrder(modCon, orderList) : result);
        }
Beispiel #21
0
        /// <summary>
        /// 保存合同
        /// </summary>
        /// <param name="state">状态</param>
        /// <returns></returns>
        private bool SaveCon(int state)
        {
            List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

            #region //修改合同基本信息

            Mod_TMO_CON modCon = tmo_con.GetModel(hidconno.Value);
            if (hidconno.Value != txtConNO.Value)
            {
                modCon.C_CON_NEW = txtConNO.Value;                                                //合同号
            }
            modCon.N_STATUS         = state;                                                      //合同状态
            modCon.C_CON_NAME       = txtConName.Value;                                           //合同名称
            modCon.C_CONTYPEID      = dropConType.SelectedValue;                                  //合同类型
            modCon.C_CURRENCYTYPEID = dropBiZhong.SelectedValue;                                  //货币类型
            modCon.D_CONSING_DT     = Convert.ToDateTime(txtQianDanDT.Value);                     //签署日期
            modCon.D_CONEFFE_DT     = Convert.ToDateTime(txtPlanStartDT.Value);                   //生效日期
            modCon.D_CONINVALID_DT  = Convert.ToDateTime(txtPlanEndDT.Value);                     //失效日期

            modCon.C_TRANSMODEID    = dropFaYun.SelectedItem.Value;                               //发运方式
            modCon.C_SALECORPID     = dropSale.SelectedItem.Value;                                //销售组织-
            modCon.C_AREA           = txtDept.Value;                                              //合同区域
            modCon.C_REAMRK         = txtDESC.Value;                                              //备注
            modCon.C_STATION        = txtC_STATION.Value;                                         //站点
            modCon.C_BIZTYPE        = dropYeWuType.SelectedItem.Value;                            //业务类型-
            modCon.C_DEPTID         = hidC_DEPT_ID.Value;                                         //业务部门-
            modCon.C_EMPLOYEEID     = hidC_SALESMAN.Value;                                        //业务员
            modCon.C_EDITEMPLOYEEID = ltlC_EMP_ID.Text;                                           //修改人
            modCon.D_EDITDATE       = DateTime.Now;                                               //修改时间
            modCon.C_ADDRESS        = dropAddr.SelectedItem?.Text ?? "";                          //收货地址

            string C_PCLX = dropYeWuType.SelectedItem.Text == "1001NC10000000005EI8" ? "1" : "0"; //1出口材,0普通材

            modCon.C_CRECEIPTCUSTOMERID = hidC_CGID.Value;                                        //收货单位
            modCon.C_CRECEIPTCORPID     = hidC_OTCID.Value;                                       //开票单位
            modCon.N_FLAG = dropClass.SelectedValue;

            #endregion

            #region //修改合同明细

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                DropDownList dropZL   = (DropDownList)rptList.Items[i].FindControl("dropZL");
                DropDownList dropzxzt = (DropDownList)rptList.Items[i].FindControl("dropzxzt");

                DropDownList dropsfjk = (DropDownList)rptList.Items[i].FindControl("dropsfjk");

                TextBox txtWgt = (TextBox)rptList.Items[i].FindControl("txtWgt");                                     //数量
                TextBox txtN_ORIGINALCURTAXPRICE = (TextBox)rptList.Items[i].FindControl("txtN_ORIGINALCURTAXPRICE"); //原币含税单价

                TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code");
                TextBox txtRemark    = (TextBox)rptList.Items[i].FindControl("txtRemark");//行备注

                Literal ltlC_NO = (Literal)rptList.Items[i].FindControl("ltlC_NO");

                HtmlInputText txtD_DELIVERY_DT = (HtmlInputText)rptList.Items[i].FindControl("txtD_DELIVERY_DT"); //订单交货日期
                HtmlInputText txtN_TAXRATE     = (HtmlInputText)rptList.Items[i].FindControl("txtN_TAXRATE");     //税率
                HtmlInputText txtStd_Code      = (HtmlInputText)rptList.Items[i].FindControl("txtStd_Code");      //执行标准
                HtmlInputText txtC_FREE1       = (HtmlInputText)rptList.Items[i].FindControl("txtC_FREE1");       //自由项1
                HtmlInputText txtC_FREE2       = (HtmlInputText)rptList.Items[i].FindControl("txtC_FREE2");       //自由项2



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

                if (hidconno.Value != txtConNO.Value)
                {
                    modOrder.C_CON_NO = modCon.C_CON_NEW;                                //新合同号
                }
                modOrder.C_CON_NAME    = txtConName.Value;                               //合同名称
                modOrder.C_AREA        = txtDept.Value;                                  //区域
                modOrder.C_CUST_SQ     = txtDESC.Value;
                modOrder.C_PCLX        = C_PCLX;                                         //1出口材,0普通材
                modOrder.N_EXEC_STATUS = Convert.ToDecimal(dropzxzt.SelectedItem.Value); //执行状态
                                                                                         //modOrder.D_NEED_DT = modCon.D_NEED_DT;//需求日期
                modOrder.D_DELIVERY_DT    = Convert.ToDateTime(txtD_DELIVERY_DT.Value);  //计划订单交货日期
                modOrder.C_YWY            = txtSaleUser.Value;                           //业务员姓名
                modOrder.C_CURRENCYTYPEID = dropBiZhong.SelectedValue;                   //货币

                modOrder.C_STD_CODE = txtStd_Code.Value;                                 //执行标准
                modOrder.C_FREE1    = txtC_FREE1.Value;                                  //自由项1
                modOrder.C_FREE2    = txtC_FREE2.Value;                                  //自由项2

                modOrder.C_PACK           = txtPack_Code.Text;                           //包装要求
                modOrder.C_LEV            = "";                                          //等级
                modOrder.C_ORDER_LEV      = "";                                          //级别
                modOrder.C_VDEF1          = dropZL.SelectedValue;                        //质量等级
                modOrder.C_STL_GRD_CLASS  = "";                                          //钢种大类
                modOrder.C_SFJK           = dropsfjk.SelectedItem.Text;                  //监控钢种
                modOrder.C_RECEIPTAREAID  = modCon.C_CRECEIPTAREAID;                     //收货地区
                modOrder.C_RECEIVEADDRESS = modCon.C_ADDRESS;                            // 收货地址
                modOrder.C_RECEIPTCORPID  = modCon.C_CRECEIPTCUSTOMERID;                 //收货单位
                modOrder.C_REMARK         = txtRemark.Text;                              //行备注


                decimal N_WGT = 0;
                if (!string.IsNullOrEmpty(txtWgt.Text))
                {
                    N_WGT = Convert.ToDecimal(txtWgt.Text);
                }
                modOrder.N_WGT  = N_WGT;                                            //数量
                modOrder.N_FNUM = modOrder.N_HSL == 0 ? 1 : N_WGT / modOrder.N_HSL; //辅数量


                #region //获取钢种单价-折扣-税率
                if (!string.IsNullOrEmpty(txtN_ORIGINALCURTAXPRICE.Text))
                {
                    decimal shuolv = Convert.ToDecimal(txtN_TAXRATE.Value == "" ? "0" : txtN_TAXRATE.Value);//税率
                    if (Convert.ToDecimal(shuolv) >= 1)
                    {
                        shuolv = shuolv / 100;
                    }

                    decimal N_TAXRATE             = shuolv + 1;                                                   //税率
                    decimal N_ORIGINALCURPRICE    = Convert.ToDecimal(txtN_ORIGINALCURTAXPRICE.Text) / N_TAXRATE; //原币无税单价
                    decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(txtN_ORIGINALCURTAXPRICE.Text);             //原币含税单价

                    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_TAXRATE             = shuolv;                                                      //税率
                    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.UpdateConOrder(modCon, orderList));
        }
Beispiel #22
0
        /// <summary>
        /// 插入销售订单
        /// </summary>
        /// <param name="parem">合同参数列表,返回DataTable:ID,CODE</param>
        /// <returns></returns>
        public DataTable InsertSaleOrder(List <string> parem)
        {
            //初始化DataTable
            DataTable dt = new DataTable();

            dt.Columns.Add("ID", typeof(string));   //主键
            dt.Columns.Add("CODE", typeof(string)); //单据号


            Dal_TMO_CON        tmo_con        = new Dal_TMO_CON();
            Dal_TMO_CONDETAILS tmo_condetails = new Dal_TMO_CONDETAILS();
            ArrayList          strSql         = new ArrayList();


            if (parem.Count > 0)
            {
                for (int i = 0; i < parem.Count; i++)
                {
                    Mod_TMO_CON       modCon  = tmo_con.GetModel(parem[i]);
                    Mod_TMO_SALEORDER modSale = new Mod_TMO_SALEORDER();

                    #region                                            //销售订单主表
                    string pk_mainid = Guid.NewGuid().ToString("N");   //主键ID
                    string code      = Dal_RandomNumber.GetSaleCode(); //销售单据号

                    dt.Rows.Add(new object[] { pk_mainid, code });

                    StringBuilder cmdText = new StringBuilder();
                    cmdText.Append("insert into TMO_SALEORDER(");
                    cmdText.Append("C_ID,C_CODE,C_CONNO,C_INITIALIZE_ID,C_BIZTYPE,D_BILLDATE,C_CUSTOMERID,C_DEPTID,C_EMPLOYEEID,C_OPERATORID,C_SALECORPID,C_RECEIPTCUSTOMERID,C_RECEIVEADDRESS,C_RECEIPTCORPID,C_TRANSMODEID,D_MAKEDATE,C_APPROVEID,D_APPROVEDATE)");
                    cmdText.Append(" values (");
                    cmdText.Append("'" + pk_mainid + "',");                                            //主键ID
                    cmdText.Append("'" + code + "',");                                                 //销售单据号
                    cmdText.Append("'" + modCon.C_CON_NO + "',");                                      //合同号
                    cmdText.Append("'',");                                                             //方案表主键
                    cmdText.Append("'" + modCon.C_BIZTYPE + "',");                                     //业务类型ID
                    cmdText.Append("to_date('" + DateTime.Now + "','yyyy-mm-dd hh24:mi:ss'),");        //单据日期
                    cmdText.Append("'" + modCon.C_CUSTOMERID + "',");                                  //客户ID-NC客商管理档案主键
                    cmdText.Append("'" + modCon.C_DEPTID + "',");                                      //部门ID
                    cmdText.Append("'" + modCon.C_EMPLOYEEID + "',");                                  //业务员ID
                    cmdText.Append("'" + modCon.C_COPERATORID + "',");                                 //制单人ID
                    cmdText.Append("'" + modCon.C_SALECORPID + "',");                                  //销售组织ID
                    cmdText.Append("'" + modCon.C_CRECEIPTCUSTOMERID + "',");                          //收货单位
                    cmdText.Append("'" + modCon.C_ADDRESS + "',");                                     //收货地址
                    cmdText.Append("'" + modCon.C_CRECEIPTAREAID + "',");                              //开票单位ID-来源与客户档案信息
                    cmdText.Append("'" + modCon.C_TRANSMODEID + "',");                                 //发运方式ID
                    cmdText.Append("to_date('" + modCon.D_DMAKEDATE + "','yyyy-mm-dd hh24:mi:ss'),");  //制单日期
                    cmdText.Append("'" + modCon.C_APPROVEID + "',");                                   //审批人
                    cmdText.Append("to_date('" + modCon.D_APPROVEDATE + "','yyyy-mm-dd hh24:mi:ss')"); //审批日期
                    cmdText.Append(")");
                    strSql.Add(cmdText.ToString());
                    #endregion


                    DataTable dtOrder = tmo_condetails.GetConOrderList(parem[i], "").Tables[0];
                    if (dtOrder.Rows.Count > 0)
                    {
                        for (int k = 0; k < dtOrder.Rows.Count; k++)
                        {
                            #region                                                      //插入销售订单子表
                            Mod_TMO_CONDETAILS modOrder  = tmo_condetails.GetModel(dtOrder.Rows[k]["C_NO"].ToString());
                            string             pk_itemid = Guid.NewGuid().ToString("N"); //主键
                            StringBuilder      cmdText2  = new StringBuilder();
                            cmdText2.Append("insert into TMO_SALEORDERITEM(");
                            cmdText2.Append("C_ID,C_BILLID,C_ORDERNO,C_CONNO,C_INVBASDOCID,C_INVENTORYID,C_UNITID,C_FUNITID,N_NUMBER,D_CONSIGNDATE,D_DELIVERDATE,C_CURRENCYTYPEID,N_TAXRATE,N_ORIGINALCURPRICE,N_ORIGINALCURTAXPRICE,N_ORIGINALCURTAXMNY,N_ORIGINALCURMNY,N_ORIGINALCURSUMMNY,C_RECEIPTAREAID,C_RECEIVEADDRESS,C_RECEIPTCORPID,C_VFREE1,C_VFREE2,C_VFREE3,C_VDEF1)");
                            cmdText2.Append(" values (");
                            cmdText2.Append("'" + pk_itemid + "',");                                               //主键
                            cmdText2.Append("'" + pk_mainid + "',");                                               //来源销售主表ID
                            cmdText2.Append("'" + modOrder.C_NO + "',");                                           //订单号
                            cmdText2.Append("'" + modOrder.C_CON_NO + "',");                                       //合同号
                            cmdText2.Append("'" + modOrder.C_INVBASDOCID + "',");                                  //存货档案主键
                            cmdText2.Append("'" + modOrder.C_INVENTORYID + "',");                                  //存货管理档案主键
                            cmdText2.Append("'" + modOrder.C_UNITID + "',");                                       //主计量单位
                            cmdText2.Append("'" + modOrder.C_PACKUNITID + "',");                                   //辅单位
                            cmdText2.Append("" + modOrder.N_WGT + ",");                                            //数量
                            cmdText2.Append("to_date('" + modOrder.D_DELIVERY_DT + "','yyyy-mm-dd hh24:mi:ss'),"); //发货日期
                            cmdText2.Append("to_date('" + modOrder.D_DELIVERY_DT + "','yyyy-mm-dd hh24:mi:ss'),"); //交货日期
                            cmdText2.Append("'" + modOrder.C_CURRENCYTYPEID + "',");                               //货币
                            cmdText2.Append("" + modOrder.N_TAXRATE + ",");                                        //税率
                            cmdText2.Append("" + modOrder.N_ORIGINALCURPRICE + ",");                               //原币无税单价
                            cmdText2.Append("" + modOrder.N_ORIGINALCURTAXPRICE + ",");                            //原币含税单价
                            cmdText2.Append("" + modOrder.N_ORIGINALCURTAXMNY + ",");                              //原币税额
                            cmdText2.Append("" + modOrder.N_ORIGINALCURMNY + ",");                                 //原币无税金额
                            cmdText2.Append("" + modOrder.N_ORIGINALCURSUMMNY + ",");                              //原币价税合计
                            cmdText2.Append("'" + modCon.C_CRECEIPTAREAID + "',");                                 //收货地区
                            cmdText2.Append("'" + modCon.C_ADDRESS + "',");                                        //收货地址
                            cmdText2.Append("'" + modCon.C_CRECEIPTCORPID + "',");                                 //收货单位
                            cmdText2.Append("'" + modOrder.C_FREE_TERM + "',");                                    //自由项1
                            cmdText2.Append("'" + modOrder.C_FREE_TERM2 + "',");                                   //自由项2
                            cmdText2.Append("'" + modOrder.C_PACK + "',");                                         //包装要求
                            cmdText2.Append("'" + modOrder.C_VDEF1 + "'");                                         //质量等级
                            cmdText2.Append(")");

                            strSql.Add(cmdText2.ToString());
                            #endregion

                            #region                                                     //日计划
                            string        dayCode  = Dal_RandomNumber.GetDayPlanCode(); //日计划单据号
                            StringBuilder cmdText3 = new StringBuilder();
                            cmdText3.Append("insert into TMP_DAYPLAN(");
                            cmdText3.Append(@"C_PLCODE,
                                                C_PKBILLB,
                                                C_PKBILLH,
                                                C_CONNO,
                                                C_ORDERNO,
                                                C_PKINV,
                                                C_PKASSISTMEASURE,
                                                N_ASSISTNUM,
                                                N_NUM,
                                                N_UNITPRICE,
                                                N_MONEY,
                                                D_PLANDATE,
                                                D_ORDSNDATE,
                                                D_REQUIREDATE,
                                                D_SNDDATE,
                                                C_PKCUST,
                                                C_PKSENDTYPE,
                                                C_PKSALEORG,
                                                C_PKOPERATOR,
                                                C_PKOPRDEPART,
                                                C_PKPLANPERSON,
                                                C_PKAPPRPERSON,
                                                D_APPRDATE,
                                                C_PKARRIVEAREA,
                                                C_DESTADDRESS,
                                                C_RECEIPTCORPID,
                                                C_BIZTYPE,
                                                C_UNITID,
                                                C_VFREE1,
                                                C_VFREE2,
                                                C_VFREE3,
                                                C_VFREE4,
                                                C_SALECODE)");
                            cmdText3.Append(" values (");
                            cmdText3.Append("'" + dayCode + "',");                                                 //日计划单据号
                            cmdText3.Append("'" + pk_itemid + "',");                                               //来源销售订单子表ID
                            cmdText3.Append("'" + pk_mainid + "',");                                               //来源销售订单主表ID
                            cmdText3.Append("'" + modOrder.C_CON_NO + "',");                                       //合同号
                            cmdText3.Append("'" + modOrder.C_NO + "',");                                           //订单号
                            cmdText3.Append("'" + modOrder.C_INVENTORYID + "',");                                  //存货主键
                            cmdText3.Append("'" + modOrder.C_PACKUNITID + "',");                                   //辅计量单位ID
                            cmdText3.Append("" + modOrder.N_FNUM + ",");                                           //辅数量
                            cmdText3.Append("" + modOrder.N_WGT + ",");                                            //主数量
                            cmdText3.Append("" + modOrder.N_ORIGINALCURTAXPRICE + ",");                            //单价
                            cmdText3.Append("" + modOrder.N_ORIGINALCURSUMMNY + ",");                              //订单金额
                            cmdText3.Append("to_date('" + modOrder.D_DT + "','yyyy-mm-dd hh24:mi:ss'),");          //日计划日期
                            cmdText3.Append("to_date('" + modOrder.D_DELIVERY_DT + "','yyyy-mm-dd hh24:mi:ss'),"); //定单要求发货日期
                            cmdText3.Append("to_date('" + modOrder.D_DELIVERY_DT + "','yyyy-mm-dd hh24:mi:ss'),"); //定单要求到货日期
                            cmdText3.Append("to_date('" + modOrder.D_DELIVERY_DT + "','yyyy-mm-dd hh24:mi:ss'),"); //实际发货日期
                            cmdText3.Append("'" + modOrder.C_RECEIPTCORPID + "',");                                //客户ID
                            cmdText3.Append("'" + modCon.C_TRANSMODEID + "',");                                    //发运方式ID
                            cmdText3.Append("'" + modCon.C_SALECORPID + "',");                                     //销售组织ID
                            cmdText3.Append("'" + modCon.C_EMPLOYEEID + "',");                                     //业务员ID
                            cmdText3.Append("'" + modCon.C_DEPTID + "',");                                         //业务部门ID
                            cmdText3.Append("'" + modCon.C_COPERATORID + "',");                                    //计划人ID
                            cmdText3.Append("'" + modCon.C_APPROVEID + "',");                                      //审批人ID
                            cmdText3.Append("to_date('" + modCon.D_APPROVEDATE + "','yyyy-mm-dd hh24:mi:ss'),");   //审批日期
                            cmdText3.Append("'" + modCon.C_CRECEIPTAREAID + "',");                                 //到货地区ID
                            cmdText3.Append("'" + modCon.C_ADDRESS + "',");                                        //到货地址
                            cmdText3.Append("'" + modCon.C_CRECEIPTCUSTOMERID + "',");                             //收货单位ID
                            cmdText3.Append("'" + modCon.C_BIZTYPE + "',");                                        //业务类型ID
                            cmdText3.Append("'" + modOrder.C_UNITID + "',");                                       //计量单位ID
                            cmdText3.Append("'" + modOrder.C_FREE_TERM + "',");                                    //自由项1
                            cmdText3.Append("'" + modOrder.C_FREE_TERM2 + "',");                                   //自由项2
                            cmdText3.Append("'" + modOrder.C_PACK + "',");                                         //包装要求
                            cmdText3.Append("'" + modOrder.C_VDEF1 + "',");                                        //质量等级
                            cmdText3.Append("'" + code + "'");                                                     //销售单据号
                            cmdText3.Append(")");
                            strSql.Add(cmdText3);
                            #endregion
                        }
                    }
                }
                DbHelperOra.ExecuteSqlTran(strSql);
            }
            return(dt);
        }
Beispiel #23
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);
        }
Beispiel #24
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);
        }
Beispiel #25
0
        public AjaxResult ConEdit([FromBody] dynamic Json)
        {
            #region                                  //参数
            string ConNo        = Json.ConNo;        //合同号
            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 CGCID        = Json.CGCID;        //收货单位ID
            string STATION      = Json.STATION;      //站点
            string SalesEmpID   = Json.SalesEmpID;   //业务员ID
            string Addr         = Json.Addr;         //收货地址
            string OTCID        = Json.OTCID;        //开票单位
            #endregion

            #region //数据操作

            AjaxResult result = new AjaxResult();


            if (!string.IsNullOrEmpty(ConNo))
            {
                List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();

                DataTable   dt  = ts_user.GetSaleDept(SalesEmpID).Tables[0];
                Mod_TMO_CON mod = tmo_con.GetModel(ConNo);

                mod.C_CON_NAME           = ConName;                           //合同名称
                mod.C_CONTYPEID          = ConType;                           //合同类型
                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.C_TRANSMODEID        = ShipVia;                           //发运方式ID
                mod.C_AREA               = dt.Rows[0]["AREA"].ToString();     //合同区域
                mod.C_CRECEIPTCUSTOMERID = CGCID;                             //收货单位
                mod.C_CRECEIPTCORPID     = OTCID;                             //开票单位
                mod.C_STATION            = STATION;                           //站点
                mod.C_EMPLOYEEID         = SalesEmpID;                        //业务员
                mod.C_DEPTID             = dt.Rows[0]["C_DEPTID"].ToString(); //业务部门
                mod.C_REAMRK             = Remark;                            //备注
                mod.N_CHANGENUM          = 0;                                 //合同变更次数

                if (!string.IsNullOrEmpty(CGCID))
                {
                    Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(CGCID);
                    mod.C_CRECEIPTCUSTOMERID = CGCID;              //收货单位
                    mod.C_ADDRESS            = Addr;               //收货地址
                    mod.C_CRECEIPTAREAID     = modCust.C_AREATYPE; //收货地区
                }
                if (tmo_con.UpdateConOrder(mod, orderList))
                {
                    result.Code   = DoResult.Success;
                    result.Result = "编辑成功";
                }
                else
                {
                    result.Code   = DoResult.Failed;
                    result.Result = "编辑失败";
                }
            }
            else
            {
                result.Code   = DoResult.Failed;
                result.Result = "编辑失败";
            }
            #endregion

            return(result);
        }
Beispiel #26
0
        /// <summary>
        /// NC销售合同接口
        /// </summary>
        /// <param name="con">合同号</param>
        /// <param name="xmlFileName">文件名/路径</param>
        /// <param name="empID">操作人ID</param>
        /// <returns></returns>
        public List <string> SendXmlOrder(string con, string xmlFileName, string empID)
        {
            try
            {
                Mod_TMO_CON      modCon  = tmo_con.GetModel(con);
                Mod_TMB_FLOWINFO modFlow = tmb_flowinfo.GetModel(modCon.C_FLOWID);

                XmlDocument xmlDoc = new XmlDocument();
                //创建类型声明节点
                XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no");
                xmlDoc.AppendChild(node);

                //创建根节点
                XmlElement root = xmlDoc.CreateElement("ufinterface");
                #region//给节点属性赋值
                root.SetAttribute("account", "1");
                root.SetAttribute("billtype", "CTEXT");
                root.SetAttribute("filename", "");
                root.SetAttribute("isexchange", "Y");
                root.SetAttribute("proc", "add");
                root.SetAttribute("receiver", "101");
                root.SetAttribute("replace", "Y");
                root.SetAttribute("roottag", "bill");
                root.SetAttribute("sender", "1107");
                root.SetAttribute("subbilltype", "");
                #endregion
                xmlDoc.AppendChild(root);

                //创建子根节点
                XmlElement so_order = xmlDoc.CreateElement("bill");
                #region                           //节点属性
                so_order.SetAttribute("id", con); //主键
                #endregion
                root.AppendChild(so_order);

                XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null);

                #region                                                                                                          //表头_bill_head
                CreateNode(xmlDoc, head, "actualinvalidate", Convert.ToDateTime(modCon.D_CONINVALID_DT).ToString("yyy-MM-dd"));  //实际终止日期
                CreateNode(xmlDoc, head, "actualvalidate", Convert.ToDateTime(modCon.D_CONEFFE_DT).ToString("yyy-MM-dd"));       //实际生效日期
                CreateNode(xmlDoc, head, "audiid", modCon.C_APPROVEID);                                                          //审核人
                CreateNode(xmlDoc, head, "auditdate", Convert.ToDateTime(modCon.D_APPROVEDATE).ToString("yyy-MM-dd"));           //审核日期
                CreateNode(xmlDoc, head, "bsc", "N");                                                                            //是否委外---****
                CreateNode(xmlDoc, head, "ct_code", modCon.C_CON_NO);                                                            //合同编码
                CreateNode(xmlDoc, head, "ct_name", modCon.C_CON_NAME);                                                          //合同名称
                CreateNode(xmlDoc, head, "ctflag", modCon.N_STATUS.ToString());                                                  //合同状态
                CreateNode(xmlDoc, head, "currid", modCon.C_CURRENCYTYPEID);                                                     //币种
                CreateNode(xmlDoc, head, "currrate", "1");                                                                       //折本汇率
                CreateNode(xmlDoc, head, "custid", modCon.C_CUSTOMERID);                                                         //客商
                CreateNode(xmlDoc, head, "custunit", "");                                                                        //对方单位说明
                CreateNode(xmlDoc, head, "depid", modCon.C_DEPTID);                                                              //部门1001NC100000008KOR85
                CreateNode(xmlDoc, head, "ifearly", "N");                                                                        //是否期初
                CreateNode(xmlDoc, head, "invallidate", Convert.ToDateTime(modCon.D_CONINVALID_DT).ToString("yyy-MM-dd"));       //计划失效日期
                CreateNode(xmlDoc, head, "iprintcount", "0");                                                                    //计划失效日期
                CreateNode(xmlDoc, head, "operdate", Convert.ToDateTime(modCon.D_DMAKEDATE).ToString("yyy-MM-dd"));              //制单日期
                CreateNode(xmlDoc, head, "operid", modCon.C_COPERATORID);                                                        //制单人1006AA1000000000NI7B
                CreateNode(xmlDoc, head, "payterm", "");                                                                         //收付款协议
                CreateNode(xmlDoc, head, "personnelid", modCon.C_EMPLOYEEID);                                                    //人员(业务员ID)1001NC10000000000TD8
                CreateNode(xmlDoc, head, "pk_corp", modCon.C_XGID);                                                              //公司
                CreateNode(xmlDoc, head, "pk_ct_manage", modCon.C_CON_NO);                                                       //合同主键
                CreateNode(xmlDoc, head, "pk_ct_type", modCon.C_CONTYPEID);                                                      //类型定义主键
                CreateNode(xmlDoc, head, "projectid", "");                                                                       //项目号
                CreateNode(xmlDoc, head, "subscribedate", Convert.ToDateTime(modCon.D_CONSING_DT).ToString("yyy-MM-dd"));        //合同签订日期
                CreateNode(xmlDoc, head, "valdate", Convert.ToDateTime(modCon.D_CONEFFE_DT).ToString("yyy-MM-dd"));              //计划生效日期
                CreateNode(xmlDoc, head, "activeflag", "0");                                                                     //激活状态
                CreateNode(xmlDoc, head, "clastoperatorid", modCon.C_EDITEMPLOYEEID);                                            //最后修改人
                CreateNode(xmlDoc, head, "astcurrate", "");                                                                      //折辅汇率
                CreateNode(xmlDoc, head, "nprepaylimitmny", "");                                                                 //预付款限额
                CreateNode(xmlDoc, head, "nprepaymny", "");                                                                      //预付款
                CreateNode(xmlDoc, head, "taudittime", Convert.ToDateTime(modCon.D_APPROVEDATE).ToString("yyy-MM-dd HH:mm:ss")); //审批时间
                CreateNode(xmlDoc, head, "tlastmaketime", Convert.ToDateTime(modCon.D_EDITDATE).ToString("yyy-MM-dd HH:mm:ss")); //最后修改时间
                CreateNode(xmlDoc, head, "tmaketime", Convert.ToDateTime(modCon.D_DMAKEDATE).ToString("yyy-MM-dd HH:mm:ss"));    //制单时间
                CreateNode(xmlDoc, head, "def1", "");                                                                            //自定义项1
                CreateNode(xmlDoc, head, "def2", modFlow.C_NAME);                                                                //审批流程名称(日常合同)
                CreateNode(xmlDoc, head, "def3", "");                                                                            //自定义项3
                CreateNode(xmlDoc, head, "def4", "");                                                                            //自定义项4
                CreateNode(xmlDoc, head, "def5", modCon.C_CON_NO);                                                               //自定义项5-合同表头主键
                CreateNode(xmlDoc, head, "pk_defdoc1", modCon.C_REAMRK);                                                         // 合同说明信息
                CreateNode(xmlDoc, head, "pk_defdoc2", "");                                                                      // 审批流主键
                CreateNode(xmlDoc, head, "pk_defdoc3", "");                                                                      // 自定义项主键3
                CreateNode(xmlDoc, head, "pk_defdoc4", "");                                                                      // 自定义项主键4
                CreateNode(xmlDoc, head, "pk_defdoc5", GetUserName(modCon.C_EMPLOYEEID));                                        // 自定义项主键5-业务员姓名
                CreateNode(xmlDoc, head, "transpmode", modCon.C_TRANSMODEID);                                                    // 发运方式

                #endregion

                so_order.AppendChild(head);
                XmlElement body = xmlDoc.CreateElement("bill_body");
                so_order.AppendChild(body);

                DataTable dt = tmo_order.GetList(" C_CON_NO='" + con + "'").Tables[0];
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    int rowno = j + 1;

                    Mod_TMO_ORDER modOrder = tmo_order.GetModel(dt.Rows[j]["C_ID"].ToString());
                    if (modOrder != null)
                    {
                        XmlNode entry = xmlDoc.CreateNode(XmlNodeType.Element, "item", null);

                        #region                                                                                                   //表体_item

                        CreateNode(xmlDoc, entry, "amount", modOrder.N_WGT.ToString());                                           //数量
                        CreateNode(xmlDoc, entry, "invclid", "");                                                                 //存货分类
                        CreateNode(xmlDoc, entry, "invid", modOrder.C_INVENTORYID);                                               //存货管理档案主键
                        CreateNode(xmlDoc, entry, "measid", modOrder.C_UNITID);                                                   //主计量单位
                        CreateNode(xmlDoc, entry, "natiprice", modOrder.N_ORIGINALCURPRICE.ToString());                           //本币无税单价
                        CreateNode(xmlDoc, entry, "natisum", modOrder.N_ORIGINALCURMNY.ToString());                               //本币无税金额
                        CreateNode(xmlDoc, entry, "natitaxmny", modOrder.N_ORIGINALCURTAXMNY.ToString());                         //本币税额
                        CreateNode(xmlDoc, entry, "natitaxprice", modOrder.N_ORIGINALCURTAXPRICE.ToString());                     //本币含税单价
                        CreateNode(xmlDoc, entry, "natitaxsummny", modOrder.N_ORIGINALCURSUMMNY.ToString());                      //本币价税合计
                        CreateNode(xmlDoc, entry, "ordnum", "");                                                                  //订单执行累计数量
                        CreateNode(xmlDoc, entry, "ordprice", "");                                                                //订单执行累计含税单价
                        CreateNode(xmlDoc, entry, "ordsum", "");                                                                  //订单执行累计本币价税合计
                        CreateNode(xmlDoc, entry, "oriprice", modOrder.N_ORIGINALCURPRICE.ToString());                            //原币无税单价
                        CreateNode(xmlDoc, entry, "orisum", modOrder.N_ORIGINALCURMNY.ToString());                                //原币无税金额
                        CreateNode(xmlDoc, entry, "oritaxmny", modOrder.N_ORIGINALCURTAXMNY.ToString());                          //原币税额
                        CreateNode(xmlDoc, entry, "oritaxprice", modOrder.N_ORIGINALCURTAXPRICE.ToString());                      //原币含税单价
                        CreateNode(xmlDoc, entry, "oritaxsummny", modOrder.N_ORIGINALCURSUMMNY.ToString());                       //原币价税合计
                        CreateNode(xmlDoc, entry, "pk_corp", modOrder.C_XGID);                                                    //公司
                        CreateNode(xmlDoc, entry, "pk_ct_manage", "");                                                            //合同主键
                        CreateNode(xmlDoc, entry, "pk_ct_manage_b", "");                                                          //表体主键
                        CreateNode(xmlDoc, entry, "taxration", modOrder.N_TAXRATE.ToString());                                    //税率
                        CreateNode(xmlDoc, entry, "astmeasid", modOrder.C_FUNITID);                                               //辅计量单位
                        CreateNode(xmlDoc, entry, "astnum", modOrder.N_FNUM.ToString());                                          //辅数量
                        CreateNode(xmlDoc, entry, "astprice", "");                                                                //辅币无税单价
                        CreateNode(xmlDoc, entry, "astsum", "");                                                                  //辅币无税金额
                        CreateNode(xmlDoc, entry, "asttaxmny", "");                                                               //辅币税额
                        CreateNode(xmlDoc, entry, "asttaxprice", "");                                                             //辅币含税单价
                        CreateNode(xmlDoc, entry, "asttaxsummny", "");                                                            //辅币价税合计
                        CreateNode(xmlDoc, entry, "cqpbaseschemeid", "");                                                         //优质优价方案
                        CreateNode(xmlDoc, entry, "crowno", rowno.ToString());                                                    //行号
                        CreateNode(xmlDoc, entry, "transrate", modOrder.N_HSL.ToString());                                        //主辅计量换算率
                        CreateNode(xmlDoc, entry, "vbatchcode", "");                                                              //批次号
                        CreateNode(xmlDoc, entry, "def1", "");                                                                    //自定义项1
                        CreateNode(xmlDoc, entry, "def2", "");                                                                    //自定义项2
                        CreateNode(xmlDoc, entry, "def3", "");                                                                    //自定义项3
                        CreateNode(xmlDoc, entry, "def4", modOrder.C_PRO_USE);                                                    //自定义项4产品用途
                        CreateNode(xmlDoc, entry, "def5", "");                                                                    //自定义项5
                        CreateNode(xmlDoc, entry, "def6", "");                                                                    //自定义项6
                        CreateNode(xmlDoc, entry, "def7", "");                                                                    //自定义项7
                        CreateNode(xmlDoc, entry, "def8", "");                                                                    //自定义项8
                        CreateNode(xmlDoc, entry, "def9", "");                                                                    //自定义项9
                        CreateNode(xmlDoc, entry, "def10", modOrder.C_ID);                                                        //合同表体主键
                        CreateNode(xmlDoc, entry, "pk_defdoc1", "");                                                              //自定义项主键1
                        CreateNode(xmlDoc, entry, "pk_defdoc2", "");                                                              //自定义项主键2
                        CreateNode(xmlDoc, entry, "pk_defdoc3", "");                                                              //自定义项主键3
                        CreateNode(xmlDoc, entry, "pk_defdoc4", "");                                                              //自定义项主键4
                        CreateNode(xmlDoc, entry, "pk_defdoc5", "");                                                              //自定义项主键5
                        CreateNode(xmlDoc, entry, "pk_defdoc6", "");                                                              //自定义项主键6
                        CreateNode(xmlDoc, entry, "pk_defdoc7", "");                                                              //自定义项主键7
                        CreateNode(xmlDoc, entry, "pk_defdoc8", "");                                                              //自定义项主键8
                        CreateNode(xmlDoc, entry, "pk_defdoc9", "");                                                              //自定义项主键9
                        CreateNode(xmlDoc, entry, "pk_defdoc10", "");                                                             //自定义项主键10
                        CreateNode(xmlDoc, entry, "pk_defdoc11", "");                                                             //自定义项主键11
                        CreateNode(xmlDoc, entry, "pk_defdoc12", "");                                                             //自定义项主键12
                        CreateNode(xmlDoc, entry, "pk_defdoc13", "");                                                             //自定义项主键13
                        CreateNode(xmlDoc, entry, "pk_defdoc14", "");                                                             //自定义项主键14
                        CreateNode(xmlDoc, entry, "pk_defdoc15", "");                                                             //自定义项主键15
                        CreateNode(xmlDoc, entry, "pk_defdoc16", modOrder.C_SPEC);                                                //规格
                        CreateNode(xmlDoc, entry, "pk_defdoc17", modOrder.C_STL_GRD);                                             //钢种
                        CreateNode(xmlDoc, entry, "pk_defdoc18", "");                                                             //自定义项主键18
                        CreateNode(xmlDoc, entry, "pk_defdoc19", "");                                                             //自定义项主键19
                        CreateNode(xmlDoc, entry, "pk_defdoc20", "");                                                             //自定义项主键20
                        CreateNode(xmlDoc, entry, "vfree1", modOrder.C_FREE1);                                                    //自由项1
                        CreateNode(xmlDoc, entry, "vfree2", modOrder.C_FREE2);                                                    //自由项2
                        CreateNode(xmlDoc, entry, "vfree3", modOrder.C_PACK);                                                     //自由项3
                        CreateNode(xmlDoc, entry, "vfree4", "");                                                                  //自由项4
                        CreateNode(xmlDoc, entry, "vfree5", "");                                                                  //自由项5
                        CreateNode(xmlDoc, entry, "creceiptcorpid", modOrder.C_RECEIPTCORPID);                                    //收货单位
                        CreateNode(xmlDoc, entry, "vreceiveaddress", modOrder.C_RECEIVEADDRESS);                                  //收货地址
                        CreateNode(xmlDoc, entry, "delivdate", Convert.ToDateTime(modOrder.D_DELIVERY_DT).ToString("yyy-MM-dd")); //计划收发货日期
                        CreateNode(xmlDoc, entry, "creceiptareaid", modOrder.C_RECEIPTAREAID);                                    //收货地区ID
                        #endregion

                        body.AppendChild(entry);
                    }
                }

                xmlDoc.Save(xmlFileName);

                List <string> parem = NCSendXml.SendXML(xmlDoc); //发送NC
                parem.Add(con);                                  //合同号
                parem.Add(empID);
                parem.Add("销售合同-NC");
                parem.Add(parem[0] == "1" ? "导入NC成功" : "导入NC失败");
                //日志录入
                AddLog(parem);

                return(parem);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #27
0
        /// <summary>
        /// 加载合同信息
        /// </summary>
        private void GetConInfo()
        {
            if (!string.IsNullOrEmpty(hidconno.Value))
            {
                Mod_TMO_CON modcon = tmo_con.GetModel(hidconno.Value);
                if (modcon != null)
                {
                    #region //是否合同变更
                    if (!string.IsNullOrEmpty(modcon.C_CON_NO_OLD))
                    {
                        hidycon.Value       = modcon.C_CON_NO_OLD;                         //原合同号
                        hidycondlxwgt.Value = tmo_order.GetConSumWgt(modcon.C_CON_NO_OLD); //原合同待履行量

                        #region                                                            //变更合同量控制
                        DataTable dtfywgt = GetData("DM002");
                        if (dtfywgt.Rows.Count > 0)
                        {
                            decimal num = 0;
                            if (!string.IsNullOrEmpty(dtfywgt.Rows[0]["C_DETAILCODE"].ToString()))
                            {
                                num = Convert.ToDecimal(dtfywgt.Rows[0]["C_DETAILCODE"].ToString());
                                decimal fywgt = Convert.ToDecimal(hidycondlxwgt.Value);
                                decimal fd    = fywgt * num;
                                hidsf.Value  = Convert.ToString(fywgt + fd); //上幅数
                                hidxf.Value  = Convert.ToString(fywgt - fd); //下幅数
                                hidmsg.Value = dtfywgt.Rows[0]["C_DETAILNAME"].ToString();
                            }
                        }
                        #endregion
                    }
                    #endregion

                    txtConNO.Value   = modcon.C_CON_NO;
                    ltlcon_bgNo.Text = modcon.N_CHANGENUM.ToString();
                    Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(modcon.C_CUSTOMERID);
                    ltlCustNo.Text       = modCust?.C_NO ?? "";
                    ltlN_CON_STATUS.Text = modcon.N_STATUS.ToString();
                    hidstatus.Value      = modcon.N_STATUS.ToString();

                    #region //根据合同状态显示按钮

                    switch (modcon.N_STATUS.ToString())
                    {
                    case "0":                                 //待审
                        btnSave.Enabled     = true;           //保存
                        btnAdd.Disabled     = false;          //产品
                        btnCheck.Enabled    = true;           //送审
                        btnSX.Enabled       = false;          //生效
                        btndj.Enabled       = true;           //冻结
                        btnjd.Enabled       = !btndj.Enabled; //解冻
                        btnzz.Enabled       = true;           //终止
                        btnqs.Enabled       = false;          //弃审
                        btncondel.Enabled   = true;           //合同删除
                        btncancel.Enabled   = true;           //撤回客户
                        btnAdd_TWC.Disabled = false;          //头尾材
                        btnPrice.Enabled    = true;



                        break;

                    case "1":                        //审核中
                        btnSave.Enabled     = false; //保存
                        btnAdd.Disabled     = true;  //产品
                        btnCheck.Enabled    = false; //送审
                        btnSX.Enabled       = false; //生效
                        btndj.Enabled       = false; //冻结
                        btnjd.Enabled       = false; //解冻
                        btnzz.Enabled       = false; //终止
                        btnqs.Enabled       = false; //弃审
                        btncondel.Enabled   = false; //合同删除
                        btncancel.Enabled   = false; //撤回客户
                        btnAdd_TWC.Disabled = true;  //头尾材
                        btnPrice.Enabled    = false;

                        break;

                    case "4":                                 // 审核通过
                        btnSave.Enabled  = false;             //保存
                        btnAdd.Disabled  = true;              //产品
                        btnCheck.Enabled = false;             //送审

                        btnSX.Enabled       = true;           //生效
                        btndj.Enabled       = true;           //冻结
                        btnjd.Enabled       = !btndj.Enabled; //解冻
                        btnzz.Enabled       = true;           //终止
                        btnqs.Enabled       = true;           //弃审
                        btncondel.Enabled   = false;          //合同删除
                        btncancel.Enabled   = false;          //撤回客户
                        btnAdd_TWC.Disabled = true;           //头尾材
                        btnPrice.Enabled    = false;


                        break;

                    case "2":                                 //生效
                        btnSave.Enabled  = false;             //保存
                        btnAdd.Disabled  = true;              //产品
                        btnCheck.Enabled = false;             //送审

                        btnSX.Enabled       = false;          //生效
                        btndj.Enabled       = true;           //冻结
                        btnjd.Enabled       = !btndj.Enabled; //解冻
                        btnzz.Enabled       = true;           //终止
                        btnqs.Enabled       = false;          //弃审
                        btncondel.Enabled   = false;          //合同删除
                        btncancel.Enabled   = false;          //撤回客户
                        btnAdd_TWC.Disabled = true;           //头尾材
                        btnPrice.Enabled    = false;

                        break;

                    case "5":                                 // 冻结
                        btnSave.Enabled  = false;             //保存
                        btnAdd.Disabled  = true;              //产品
                        btnCheck.Enabled = false;             //送审

                        btnSX.Enabled       = false;          //生效
                        btndj.Enabled       = false;          //冻结
                        btnjd.Enabled       = !btndj.Enabled; //解冻
                        btnzz.Enabled       = false;          //终止
                        btnqs.Enabled       = false;          //弃审
                        btncondel.Enabled   = false;          //合同删除
                        btncancel.Enabled   = false;          //撤回客户
                        btnAdd_TWC.Disabled = true;           //头尾材
                        btnPrice.Enabled    = false;

                        break;

                    case "6":                        // 终止
                        btnSave.Enabled  = false;    //保存
                        btnAdd.Disabled  = true;     //产品
                        btnCheck.Enabled = false;    //送审

                        btnSX.Enabled       = false; //生效
                        btndj.Enabled       = false; //冻结
                        btnjd.Enabled       = false; //解冻
                        btnzz.Enabled       = false; //终止
                        btnqs.Enabled       = false; //弃审
                        btncondel.Enabled   = false; //合同删除
                        btncancel.Enabled   = false; //撤回客户
                        btnAdd_TWC.Disabled = true;  //头尾材
                        btnPrice.Enabled    = false;

                        break;
                    }

                    #endregion


                    txtConName.Value  = modcon.C_CON_NAME;
                    txtCustName.Value = modcon.C_CUSTNAME;

                    txtQianDanDT.Value   = Convert.ToDateTime(modcon.D_CONSING_DT).ToString("yyy-MM-dd");
                    txtPlanStartDT.Value = Convert.ToDateTime(modcon.D_CONEFFE_DT).ToString("yyy-MM-dd");
                    txtPlanEndDT.Value   = Convert.ToDateTime(modcon.D_CONINVALID_DT).ToString("yyy-MM-dd");


                    dropFaYun.SelectedIndex    = dropFaYun.Items.IndexOf(dropFaYun.Items.FindByValue(modcon.C_TRANSMODEID));        //发运方式
                    dropBiZhong.SelectedIndex  = dropBiZhong.Items.IndexOf(dropBiZhong.Items.FindByValue(modcon.C_CURRENCYTYPEID)); //货币类型
                    dropYeWuType.SelectedIndex = dropYeWuType.Items.IndexOf(dropYeWuType.Items.FindByValue(modcon.C_BIZTYPE));      //业务类型
                    dropConType.SelectedIndex  = dropConType.Items.IndexOf(dropConType.Items.FindByValue(modcon.C_CONTYPEID));      //合同类型
                    dropSale.SelectedIndex     = dropSale.Items.IndexOf(dropSale.Items.FindByValue(modcon.C_SALECORPID));           //销售组织

                    dropClass.SelectedIndex = dropClass.Items.IndexOf(dropClass.Items.FindByValue(modcon.N_FLAG));

                    #region//收货地址
                    DataTable dtaddr = ts_custaddr.GetAddr("", "", modcon.C_CUSTOMERID, "", "").Tables[0];
                    if (dtaddr.Rows.Count > 0)
                    {
                        dropAddr.DataSource     = dtaddr;
                        dropAddr.DataTextField  = "C_CGAREA";
                        dropAddr.DataValueField = "C_CGAREA";
                        dropAddr.DataBind();
                        dropAddr.SelectedIndex = dropAddr.Items.IndexOf(dropAddr.Items.FindByText(modcon.C_ADDRESS));
                    }
                    #endregion

                    #region //部门
                    Mod_TS_DEPT modDept = ts_dept.GetModel(modcon.C_DEPTID);
                    if (modDept != null)
                    {
                        txtDept.Value = modDept.C_NAME;

                        hidC_DEPT_ID.Value = modcon.C_DEPTID;
                    }

                    #endregion

                    #region //业务员
                    txtSaleUser.Value   = ts_user.GetSaleName(modcon.C_EMPLOYEEID);
                    hidC_SALESMAN.Value = modcon.C_EMPLOYEEID;
                    #endregion

                    txtShuoHuoCompany.Value = GetCust(modcon.C_CRECEIPTCUSTOMERID);
                    hidC_CGID.Value         = modcon.C_CRECEIPTCUSTOMERID ?? "";
                    txtKaiPiaoCompany.Value = GetCust(modcon.C_CRECEIPTCORPID);
                    hidC_OTCID.Value        = modcon.C_CRECEIPTCORPID ?? "";
                    txtC_STATION.Value      = modcon.C_STATION;

                    txtState.Value      = StringFormat.GetOrderState(modcon.N_STATUS);
                    txtDESC.Value       = modcon.C_REAMRK;
                    txtZhiDanRen.Value  = GetUserName(modcon.C_COPERATORID);
                    txtZhiDanTime.Value = modcon.D_DMAKEDATE.ToString();

                    #region //最后修改人/最后修改时间

                    txtLastEditUser.Value = GetUserName(modcon.C_EDITEMPLOYEEID);
                    txtLastEditTime.Value = modcon.D_EDITDATE.ToString();

                    #endregion

                    #region//审批流程

                    txtC_APPROVEID.Value   = GetUserName(modcon.C_APPROVEID);
                    txtD_APPROVEDATE.Value = modcon.D_APPROVEDATE.ToString();

                    if (!string.IsNullOrEmpty(modcon.C_FLOWID))
                    {
                        string url = "FlowStep_View.aspx?taskID=" + hidconno.Value + "&flowID=" + modcon.C_FLOWID;

                        Mod_TMB_FLOWINFO modFlow = tmb_flowinfo.GetModel(modcon.C_FLOWID);
                        ltlC_APPROVER_FLOW.Text = "<a href=\"javascript: void(0); \" class='flow' onclick=\"_iframe('" + url + "','500','400','审批记录');\">" + modFlow?.C_NAME + "&nbsp;<span class=\"glyphicon glyphicon-search\"></span></a>";
                    }
                    #endregion

                    GetOrderList();
                }
            }
        }
Beispiel #28
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 #29
0
        public AjaxResult OrderEdit([FromBody] dynamic Json)
        {
            #region                        //参数
            string OrderNO = Json.OrderNO; //订单号
            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;

            DataRow drOrder = tmo_order.GetRowOrder(OrderNO, "");
            if (drOrder != null)
            {
                Mod_TS_USER     modUser  = GetUserID();
                Mod_TS_CUSTFILE modCust  = ts_custfile.GetModel(modUser.C_CUST_ID);
                Mod_TMO_ORDER   modOrder = tmo_order.GetModel(drOrder["C_ID"].ToString());

                Mod_TMO_CON modCon = tmo_con.GetModel(modOrder.C_CON_NO);

                modOrder.C_VDEF1 = VdefID; //质量;
                modOrder.C_PACK  = Pack;   //包装要求
                decimal N_WGT = 0;
                if (!string.IsNullOrEmpty(Wgt))
                {
                    N_WGT = Convert.ToDecimal(Wgt);
                }
                modOrder.N_WGT  = N_WGT;                  //数量
                modOrder.N_FNUM = N_WGT / modOrder.N_HSL; //数量

                #region                                   //获取钢种单价-税率
                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

                List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>();
                orderList.Add(modOrder);

                result.Result = tmo_con.UpdateConOrder(modCon, orderList) == true ? "修改成功" : "修改失败";
            }
            else
            {
                result.Result = "当前暂无修改订单";
            }


            #endregion

            return(result);
        }
Beispiel #30
0
        /// <summary>
        /// 加载合同信息
        /// </summary>
        private void GetConInfo()
        {
            if (!string.IsNullOrEmpty(txtConNO.Text))
            {
                Mod_TMO_CON modcon = tmo_con.GetModel(txtConNO.Text);
                if (modcon != null)
                {
                    ltlcon_bgNo.Text = modcon.N_CHANGENUM.ToString();//合同版本

                    Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(modcon.C_CUSTOMERID);
                    hidCustNO.Value = modCust.C_NO;
                    hidCustID.Value = modcon.C_CUSTOMERID;//客户ID

                    ltlCustType.Text     = modCust.N_TYPE == 1 ? "经销" : "直销";
                    ltlN_CON_STATUS.Text = modcon.N_STATUS.ToString();
                    hidstatus.Value      = modcon.N_STATUS.ToString(); //当前状态

                    #region                                            //状态按钮设置

                    bool boolbtn = ltlN_CON_STATUS.Text == "-1" ? true : false;
                    btnSave.Enabled   = boolbtn;
                    btnSubmit.Enabled = boolbtn;
                    btnProc.Disabled  = ltlN_CON_STATUS.Text == "-1" ? false : true;
                    //btnProc_F.Disabled = ltlN_CON_STATUS.Text == "-1" ? false : true;
                    btnAdd.Disabled  = ltlN_CON_STATUS.Text == "-1" ? false : true;
                    btnConBg.Enabled = ltlN_CON_STATUS.Text == "2" ? true : false;
                    #endregion


                    txtConName.Text           = modcon.C_CON_NAME;
                    dropConType.SelectedIndex = dropConType.Items.IndexOf(dropConType.Items.FindByText(modcon.C_CONTYPEID));
                    txtCustName.Text          = modcon.C_CUSTNAME;


                    if (!string.IsNullOrEmpty(modcon.D_CONSING_DT.ToString()))
                    {
                        txtDate.Value = Convert.ToDateTime(modcon.D_CONSING_DT).ToString("yyy-MM-dd");
                    }

                    if (!string.IsNullOrEmpty(modcon.D_CONEFFE_DT.ToString()))
                    {
                        txtStart.Value = Convert.ToDateTime(modcon.D_CONEFFE_DT).ToString("yyy-MM-dd");
                    }
                    if (!string.IsNullOrEmpty(modcon.D_CONINVALID_DT.ToString()))
                    {
                        txtEnd.Value = Convert.ToDateTime(modcon.D_CONINVALID_DT).ToString("yyy-MM-dd");
                    }

                    dropShipVia.SelectedIndex  = dropShipVia.Items.IndexOf(dropShipVia.Items.FindByValue(modcon.C_TRANSMODEID));
                    dropCurrType.SelectedIndex = dropCurrType.Items.IndexOf(dropCurrType.Items.FindByValue(modcon.C_CURRENCYTYPEID));


                    txtC_CGC.Value  = GetCust(modcon.C_CRECEIPTCUSTOMERID); //收货单位
                    hidC_CGID.Value = modcon.C_CRECEIPTCUSTOMERID;          //收货单位NC主键

                    txtC_OTC.Value     = GetCust(modcon.C_CRECEIPTCORPID);  //开票单位
                    hidC_OTCID.Value   = modcon.C_CRECEIPTCORPID;           //开票单位NC主键
                    txtC_STATION.Value = modcon.C_STATION;

                    #region //业务员
                    txtSaleUser.Value  = ts_user.GetSaleName(modcon.C_EMPLOYEEID);
                    hidsaleempid.Value = modcon.C_EMPLOYEEID;
                    hiddeptid.Value    = modcon.C_DEPTID;
                    #endregion

                    txtReamrk.Value = modcon.C_REAMRK;

                    txtAddr.Value = modcon.C_ADDRESS;

                    GetOrderList();
                }
            }
        }