Exemplo n.º 1
0
        private void btMod_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.LoginStruct       ls1  = (CMSMStruct.LoginStruct)Session["Login"];
            CMSMStruct.PoStockMainStruct psm1 = new CMSMStruct.PoStockMainStruct();
            psm1.strPoID      = this.txtPoID.Text.Trim();
            psm1.strPrvdCode  = this.ddlProvider.SelectedValue;
            psm1.strAddress   = this.txtAddress.Text.Trim();
            psm1.strComments  = this.txtComments.Text.Trim();
            psm1.strPlanCycle = this.txtPlanCycle.Text.Trim();
            psm1.strModer     = ls1.strOperName;

            if (psm1.strPoID == "" || psm1.strPoID.Length != 13)
            {
                this.Popup("采购订单号不正确!");
                return;
            }
            if (psm1.strPrvdCode == "")
            {
                this.Popup("供应商不能为空!");
                return;
            }
            if (psm1.strPlanCycle == "")
            {
                this.Popup("采购周期不能为空!");
                return;
            }

            CMSMStruct.PoStockMainStruct psmold = (CMSMStruct.PoStockMainStruct)Session["psmold"];
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                if ((psm1.strPrvdCode != psmold.strPrvdCode || psm1.strPlanCycle != psmold.strPlanCycle) && StoBusi.IsExistPoProviderCycle(psm1.strPrvdCode, psm1.strPlanCycle))
                {
                    this.Popup("该供应商在本采购周期下已经有订单,不能修改!");
                    return;
                }

                if (StoBusi.ModPoSotckMainInfo(psm1, psmold))
                {
                    this.SetSuccMsgPageBydir("修改采购订单主表内容成功!", "Storage/wfmPoStock.aspx");
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("修改采购订单主表内容时发生错误,请重试!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }
Exemplo n.º 2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (Session["Login"] == null)
            {
                Response.Redirect("../Exit.aspx");
                return;
            }

            string    strPoID = Request.QueryString["POID"];
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);

            if (!IsPostBack)
            {
                if (strPoID == "" || strPoID == null)
                {
                    this.btAdd.Enabled = true;
                    this.btMod.Enabled = false;
                    this.FillDropDownList("Provider", this.ddlProvider);
                    this.txtPoID.Enabled   = false;
                    this.btChState.Visible = false;
                    string strCycle = DateTime.Today.Year.ToString();
                    if (DateTime.Today.Month < 10)
                    {
                        strCycle += "0" + DateTime.Today.Month.ToString();
                    }
                    else
                    {
                        strCycle += DateTime.Today.Month.ToString();
                    }
                    this.txtPoID.Text = "POS" + strCycle + "----";
                    string strNextCycle = DateTime.Today.AddMonths(1).Year.ToString();
                    if (DateTime.Today.AddMonths(1).Month < 10)
                    {
                        strNextCycle += "0" + DateTime.Today.AddMonths(1).Month.ToString();
                    }
                    else
                    {
                        strNextCycle += DateTime.Today.AddMonths(1).Month.ToString();
                    }
                    this.txtPlanCycle.Text = strNextCycle;
                }
                else
                {
                    this.btAdd.Enabled = false;
                    this.btMod.Enabled = true;
                    this.FillDropDownList("Provider", this.ddlProvider);
                    CMSMStruct.PoStockMainStruct psm1 = StoBusi.GetPoStockMainOne(strPoID);
                    this.txtPoID.Text = psm1.strPoID;
                    this.ddlProvider.SelectedIndex = this.ddlProvider.Items.IndexOf(this.ddlProvider.Items.FindByValue(psm1.strPrvdCode));
                    this.txtPlanCycle.Text         = psm1.strPlanCycle;
                    this.txtAddress.Text           = psm1.strAddress;
                    this.txtComments.Text          = psm1.strComments;
                    Session["psmold"]        = psm1;
                    this.txtPoID.Enabled     = false;
                    this.ddlProvider.Enabled = false;
                    switch (psm1.strPoState)
                    {
                    case "0":
                        this.btChState.Text = "执行";
                        break;

                    case "1":
                        this.txtPlanCycle.Enabled = false;
                        this.txtAddress.Enabled   = false;
                        this.txtComments.Enabled  = false;
                        this.btMod.Enabled        = false;
                        this.btChState.Text       = "完成";
                        break;

                    case "2":
                        this.txtPlanCycle.Enabled = false;
                        this.txtAddress.Enabled   = false;
                        this.txtComments.Enabled  = false;
                        this.btMod.Enabled        = false;
                        this.btChState.Visible    = false;
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void btAdd_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.LoginStruct       ls1  = (CMSMStruct.LoginStruct)Session["Login"];
            CMSMStruct.PoStockMainStruct psm1 = new CMSMStruct.PoStockMainStruct();
            psm1.strPoID      = this.txtPoID.Text.Trim();
            psm1.strPrvdCode  = this.ddlProvider.SelectedValue;
            psm1.strAddress   = this.txtAddress.Text.Trim();
            psm1.strComments  = this.txtComments.Text.Trim();
            psm1.strPoState   = "0";
            psm1.strPlanCycle = this.txtPlanCycle.Text.Trim();
            psm1.strCreater   = ls1.strOperName;
            psm1.strModer     = "";
            psm1.strChecker   = "";
            psm1.strCloser    = "";

            if (psm1.strPoID == "" || psm1.strPoID.Length != 13)
            {
                this.Popup("采购订单号不正确!");
                return;
            }
            if (psm1.strPrvdCode == "")
            {
                this.Popup("供应商不能为空!");
                return;
            }
            if (psm1.strPlanCycle == "")
            {
                this.Popup("采购周期不能为空!");
                return;
            }

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                if (StoBusi.IsExistPoProviderCycle(psm1.strPrvdCode, psm1.strPlanCycle))
                {
                    this.Popup("该供应商在本采购周期下已经有订单,你可直接在已有订单中添加采购货品!");
                    return;
                }

                if (StoBusi.NewPoSotckMainAdd(psm1))
                {
                    this.SetSuccMsgPageBydir("新采购计划输入成功,点击下一步添加货品!", "Storage/wfmPoStock.aspx?poid=" + psm1.strPoID, "Storage/wfmPoStockDetail.aspx?POID=" + psm1.strPoID + "&Prvd=" + psm1.strPrvdCode + "&pos=0", "下一步");
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("新采购订单输入时发生错误,请重试!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }