Ejemplo n.º 1
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;
            }
        }