Exemplo n.º 1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (Session["Login"] == null)
            {
                Response.Redirect("../Exit.aspx");
                return;
            }

            string    strid    = Request.QueryString["id"];
            string    strBatch = Request.QueryString["batch"];
            Hashtable htapp    = (Hashtable)Application["appconf"];
            string    strcons  = (string)htapp["cons"];

            ms1 = new MaterialSBusi(strcons);

            if (!IsPostBack)
            {
                this.FillDropDownList("tbNameCodeToStorage", this.ddlMaterialType, "vcCommSign='MaterialType'");
                Session["mssold"] = null;
                if (strid == "" || strid == null)
                {
                    this.btAdd.Enabled = true;
                    this.btDel.Enabled = false;
                    this.btMod.Enabled = false;
                    lbltitle.Text      = "新原材料资料录入";
                }
                else
                {
                    this.btAdd.Enabled      = false;
                    this.btDel.Enabled      = true;
                    this.btMod.Enabled      = true;
                    this.txtBatchNo.Enabled = false;
                    CMSMStruct.MaterialSStruct mss = ms1.GetMaterialInfo(strBatch, strid);
                    this.txtBatchNo.Text               = mss.strBatchNo;
                    this.txtMaterialName.Text          = mss.strMaterialName;
                    this.txtStandardUnit.Text          = mss.strStandardUnit;
                    this.txtUnit.Text                  = mss.strUnit;
                    this.txtPrice.Text                 = mss.dPrice.ToString();
                    this.txtProviderName.Text          = mss.strProviderName;
                    this.ddlMaterialType.SelectedIndex = this.ddlMaterialType.Items.IndexOf(this.ddlMaterialType.Items.FindByValue(mss.strMaterialType));
                    lbltitle.Text         = "原材料资料修改--正在编辑的原材料编码为:" + strid;
                    Session["mssold"]     = mss;
                    this.txtPrice.Enabled = false;
                }
            }
        }
Exemplo n.º 2
0
        private void DataGrid1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataGridItem item    = this.DataGrid1.SelectedItem;
            Hashtable    htapp   = (Hashtable)Application["appconf"];
            string       strcons = (string)htapp["cons"];

            msb1 = new MaterialSBusi(strcons);
            CMSMStruct.MaterialSStruct mss = msb1.GetMaterialInfo(item.Cells[0].Text.Trim(), item.Cells[1].Text.Trim());
            this.txtBatchNo.Text               = mss.strBatchNo;
            this.txtMaterialCode.Text          = mss.strMaterialCode;
            this.txtMaterialName.Text          = mss.strMaterialName;
            this.txtStandardUnit.Text          = mss.strStandardUnit;
            this.txtUnit.Text                  = mss.strUnit;
            this.txtPrice.Text                 = mss.dPrice.ToString();
            this.txtProviderName.Text          = mss.strProviderName;
            this.txtCurCount.Text              = mss.dCurCount.ToString();
            this.ddlMaterialType.SelectedIndex = this.ddlMaterialType.Items.IndexOf(this.ddlMaterialType.Items.FindByValue(mss.strMaterialType));
        }
Exemplo n.º 3
0
        private void btAdd_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
            if (ls1.strDeptID == "CEN00" || ls1.strNewDeptID == "")
            {
                this.Popup("没有操作权限,请使用部门帐号!");
                this.btnQuery.Enabled = false;
                this.btAdd.Enabled    = false;
                return;
            }
            if (this.txtMaterialCode.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("请选择要入库有原材料!");
                return;
            }
            string strOutCount = this.txtOutCount.Text.Trim();

            if (strOutCount == "")
            {
                this.SetErrorMsgPageBydirHistory("请输入本次出库数量!");
                return;
            }
            if (!this.JudgeIsNum(strOutCount, "本次出库数量"))
            {
                return;
            }

            CMSMStruct.MaterialOutStruct mes1 = new CommCenter.CMSMStruct.MaterialOutStruct();
            mes1.dOutCount       = Math.Round(double.Parse(strOutCount), 2);
            mes1.strBatchNo      = this.txtBatchNo.Text.Trim();
            mes1.strMaterialCode = this.txtMaterialCode.Text.Trim();
            mes1.strMaterialName = this.txtMaterialName.Text.Trim();
            mes1.strStandardUnit = this.txtStandardUnit.Text.Trim();
            mes1.strUnit         = this.txtUnit.Text.Trim();
            mes1.dPrice          = Math.Round(double.Parse(this.txtPrice.Text.Trim()), 2);
            mes1.strProviderName = this.txtProviderName.Text.Trim();
            mes1.strMaterialType = this.ddlMaterialType.SelectedValue;
            mes1.dLastCount      = Math.Round(double.Parse(this.txtCurCount.Text.Trim()), 2);
            mes1.dCount          = mes1.dLastCount - mes1.dOutCount;
            mes1.strOperType     = "0";
            mes1.strOutDate      = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();
//			mes1.strDeptID=ls1.strNewDeptID;
            mes1.strDeptID   = ls1.strDeptID;
            mes1.strOperDate = mes1.strOutDate;
            mes1.strOperName = ls1.strOperName;

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

            msb1 = new MaterialSBusi(strcons);

            CMSMStruct.MaterialSStruct msscur = msb1.GetMaterialInfo(mes1.strBatchNo, mes1.strMaterialCode);
            if (msscur.dCurCount < mes1.dOutCount)
            {
                this.Popup("当前数量不足!");
                return;
            }
            if (msscur.dCurCount != mes1.dLastCount)
            {
                this.SetErrorMsgPageBydir("当前数量可能有变动,请重新录入!");
                return;
            }

            if (msb1.InsertMaterialOut(mes1))
            {
                this.SetSuccMsgPageBydir("录入原材料出库成功!", "");
                return;
            }
            else
            {
                this.SetErrorMsgPageBydir("录入原材料出库失败,请重试!");
                return;
            }
        }
Exemplo n.º 4
0
        private void DataGrid1_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                string newOutCount = ((TextBox)e.Item.Cells[10].Controls[0]).Text.Trim();
                string OutSerial   = e.Item.Cells[0].Text.Trim();
                if (newOutCount == "")
                {
                    this.Popup("请输入出库量");
                    return;
                }
                if (!this.JudgeIsNum(newOutCount, "出库量"))
                {
                    return;
                }

                double dnewOutCount   = Math.Round(double.Parse(newOutCount), 2);
                double doldOutCount   = Math.Round(double.Parse(Session["oldOutCount"].ToString()), 2);
                double dLastCount     = Math.Round(double.Parse(e.Item.Cells[9].Text.Trim()), 2);
                string strChangeCount = (dnewOutCount - doldOutCount).ToString();
                string strNewCurCount = (dLastCount - dnewOutCount).ToString();

                CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
                Hashtable htpara           = new Hashtable();
                htpara.Add("strNewOutCount", newOutCount);
                htpara.Add("strNewCurCount", strNewCurCount);
                htpara.Add("strSerialOld", OutSerial);
                htpara.Add("strOperDate", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());
                htpara.Add("strOperName", ls1.strOperName);
                htpara.Add("strDeptID", ls1.strNewDeptID);
                htpara.Add("strChangeCount", strChangeCount);
                htpara.Add("strMaterialCode", e.Item.Cells[2].Text.Trim());
                htpara.Add("strBatchNo", e.Item.Cells[1].Text.Trim());

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

                CMSMStruct.MaterialSStruct msscur = msb1.GetMaterialInfo(e.Item.Cells[1].Text.Trim(), e.Item.Cells[2].Text.Trim());
                if ((dnewOutCount - doldOutCount) > 0 && msscur.dCurCount < (dnewOutCount - doldOutCount))
                {
                    this.Popup("当前数量不足!");
                    return;
                }

                if (msb1.MaterialOutMod(htpara))
                {
                    this.Popup("原材料出库修正成功!");
                    this.DBbind();
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("原材料出库修正失败!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }