예제 #1
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            strArriveDate = Request.Form["txtArrive"].ToString();
            if (strArriveDate == "" || strArriveDate == null)
            {
                this.Popup("到货时间不能为空,请重新选择时间!");
                return;
            }
            if (this.txtStockPrice.Text.Trim() == "" || !this.JudgeIsNum(this.txtStockPrice.Text.Trim()))
            {
                this.Popup("采购货品单价不能为空且必须是数字!");
                return;
            }
            if (this.txtStockCount.Text.Trim() == "" || !this.JudgeIsNum(this.txtStockCount.Text.Trim()))
            {
                this.Popup("采购货品数量不能为空且必须是数字!");
                return;
            }
            CMSMStruct.LoginStruct         ls1   = (CMSMStruct.LoginStruct)Session["Login"];
            CMSMStruct.PoStockDetailStruct psds1 = new CMSMStruct.PoStockDetailStruct();
            psds1.strPoID      = this.txtPoID.Text.Trim();
            psds1.strDeptID    = this.ddlDeptID.SelectedValue;
            psds1.strGoodsCode = this.txtGoodsCode.Text.Trim();
            psds1.strStockUnit = this.ddlStockUnit.SelectedValue;
            psds1.strGroupCode = this.ddlUnitGroup.SelectedValue;
            psds1.dStockPrice  = Math.Round(double.Parse(this.txtStockPrice.Text.Trim()), 2);
            psds1.dStockCount  = Math.Round(double.Parse(this.txtStockCount.Text.Trim()), 2);
            psds1.dStockFee    = Math.Round(psds1.dStockPrice * psds1.dStockCount, 2);
            psds1.dtArriveDate = DateTime.Parse(strArriveDate);
            psds1.strRowState  = "0";
            psds1.strCreater   = ls1.strOperName;

            if (psds1.strPoID == "" || psds1.strPoID.Length != 13)
            {
                this.Popup("采购订单号不正确!");
                return;
            }
            if (psds1.strDeptID == "")
            {
                this.Popup("下订部门不能为空!");
                return;
            }
            if (psds1.strGoodsCode == "")
            {
                this.Popup("采购货品不能为空!");
                return;
            }
            if (psds1.strStockUnit == "")
            {
                this.Popup("采购货品单位不能为空!");
                return;
            }
            if (psds1.dStockCount == 0)
            {
                this.Popup("采购货品数量不能为0!");
                return;
            }

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

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                if (StoBusi.IsExistPoStockDetail(psds1.strPoID, psds1.strDeptID, psds1.strGoodsCode))
                {
                    this.Popup("该订单下已经有此部门和货品的子订单,你可直接在已有子订单中修改订购数量!");
                    this.ClientScript.RegisterStartupScript(this.GetType(), "hide", "<script lanaguage=javascript>ShowHide('1','none');</script>");
                    return;
                }

                if (StoBusi.NewPoSotckDetailAdd(psds1, ls1.strLoginID))
                {
                    this.SetSuccMsgPageBydir("新采购子订单添加成功!", "Storage/wfmPoStockDetail.aspx?POID=" + psds1.strPoID + "&Prvd=" + this.ddlProvider.SelectedValue + "&pos=" + this.txtState.Text.Trim());
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("新采购子订单添加时发生错误,请重试!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }