示例#1
0
        public bool CancelMaterial(CMSMStruct.MaterialSStruct mssold)
        {
            int recount = msa.CancelMaterial(mssold);

            if (recount <= 0)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public bool InsertMaterial(CMSMStruct.MaterialSStruct mss)
        {
            int recount = msa.InsertMaterial(mss);

            if (recount <= 0)
            {
                return(false);
            }

            return(true);
        }
示例#3
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;
                }
            }
        }
示例#4
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));
        }
示例#5
0
        private void btDel_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.MaterialSStruct mssold = (CMSMStruct.MaterialSStruct)Session["mssold"];
            if (mssold.strBatchNo == "" || mssold.strMaterialCode == "")
            {
                this.SetErrorMsgPageBydir("获取原材料批次和编号错误!");
                return;
            }

            if (!ms1.CancelMaterial(mssold))
            {
                this.SetErrorMsgPageBydir("原材料作废失败,请重试!");
                return;
            }
            else
            {
                this.SetSuccMsgPageBydir("原材料作废成功!", "");
                return;
            }
        }
示例#6
0
        public bool UpdateMaterial(CMSMStruct.MaterialSStruct mssnew, CMSMStruct.MaterialSStruct mssold)
        {
            string sqlset = "";

            if (mssnew.strMaterialName != mssold.strMaterialName)
            {
                sqlset += "cnvcMaterialName='" + mssnew.strMaterialName + "',";
            }
            if (mssnew.strStandardUnit != mssold.strStandardUnit)
            {
                sqlset += "cnvcStandardUnit='" + mssnew.strStandardUnit + "',";
            }
            if (mssnew.strUnit != mssold.strUnit)
            {
                sqlset += "cnvcUnit='" + mssnew.strUnit + "',";
            }
            if (mssnew.dPrice != mssold.dPrice)
            {
                sqlset += "cnnPrice=" + mssnew.dPrice.ToString() + ",";
            }
            if (mssnew.strProviderName != mssold.strProviderName)
            {
                sqlset += "cnvcProviderName='" + mssnew.strProviderName + "',";
            }
            if (mssnew.strMaterialType != mssold.strMaterialType)
            {
                sqlset += "cnvcMaterialType='" + mssnew.strMaterialType + "',";
            }

            if (sqlset != "")
            {
                sqlset = sqlset.Substring(0, sqlset.Length - 1);
                int recount = msa.UpdateMaterial(mssnew.strMaterialCode, sqlset);
                if (recount <= 0)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#7
0
        public int CancelMaterial(CMSMStruct.MaterialSStruct mssold)
        {
            int recount = 0;

            try
            {
                string sql1 = "update tbMaterialPara set cnvcFlag='1' where cnvcBatchNo='" + mssold.strBatchNo + "' and cnnMaterialCode=" + mssold.strMaterialCode;
                recount = SqlHelper.ExecuteNonQuery(con, CommandType.Text, sql1);
                return(recount);
            }
            catch (Exception e)
            {
                clog.WriteLine(e);
                return(recount);
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
        }
示例#8
0
        public int InsertMaterial(CMSMStruct.MaterialSStruct mss)
        {
            int recount = 0;

            try
            {
                string sql1 = "insert into tbMaterialPara values('" + mss.strBatchNo + "','" + mss.strMaterialName + "','" + mss.strStandardUnit + "','" + mss.strUnit + "'," + mss.dPrice.ToString() + ",'" + mss.strProviderName + "','" + mss.strMaterialType + "',0,0,'0')";
                recount = SqlHelper.ExecuteNonQuery(con, CommandType.Text, sql1);

                return(recount);
            }
            catch (Exception e)
            {
                clog.WriteLine(e);
                return(recount);
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
        }
示例#9
0
        private void btMod_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.MaterialSStruct mssold = (CMSMStruct.MaterialSStruct)Session["mssold"];
            if (mssold.strMaterialCode == "")
            {
                this.SetErrorMsgPageBydir("获取原材料编号错误!");
                return;
            }

            CMSMStruct.MaterialSStruct mssnew = new CMSMStruct.MaterialSStruct();
            mssnew.strMaterialCode = mssold.strMaterialCode;

            if (txtMaterialName.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("原材料名称不能为空!");
                return;
            }
            else if (ms1.ChkNewMaterialNameDup(txtBatchNo.Text.Trim(), txtMaterialName.Text.Trim(), mssold.strMaterialCode))
            {
                mssnew.strMaterialName = txtMaterialName.Text.Trim();
            }
            else
            {
                this.SetErrorMsgPageBydirHistory("该原材料名称已经存在,请重新输入!");
                return;
            }

            if (txtPrice.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("单价不能为空!");
                return;
            }
            else
            {
                mssnew.dPrice = double.Parse(txtPrice.Text.Trim());
            }

            if (txtUnit.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("单位不能为空!");
                return;
            }
            else
            {
                mssnew.strUnit = txtUnit.Text.Trim();
            }

            if (txtProviderName.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("供应商不能为空!");
                return;
            }
            else
            {
                mssnew.strProviderName = txtProviderName.Text.Trim();
            }

            mssnew.strStandardUnit = this.txtStandardUnit.Text.Trim();
            mssnew.strMaterialType = this.ddlMaterialType.SelectedValue;

            if (!ms1.UpdateMaterial(mssnew, mssold))
            {
                this.SetErrorMsgPageBydir("保存原材料修改信息失败,请重试!");
                return;
            }
            else
            {
                this.SetSuccMsgPageBydir("保存原材料修改信息成功!", "");
                return;
            }
        }
示例#10
0
        private void btAdd_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.MaterialSStruct mss = new CMSMStruct.MaterialSStruct();

            if (txtBatchNo.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("原材料批次不能为空!");
                return;
            }
            else
            {
                mss.strBatchNo = txtBatchNo.Text.Trim();
            }

            if (txtMaterialName.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("原材料名称不能为空!");
                return;
            }
            else if (ms1.ChkMaterialNameDup(mss.strBatchNo, txtMaterialName.Text.Trim()))
            {
                mss.strMaterialName = txtMaterialName.Text.Trim();
            }
            else
            {
                this.SetErrorMsgPageBydirHistory("该原材料名称已经存在,请重新输入!");
                return;
            }

            if (txtPrice.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("单价不能为空!");
                return;
            }
            else
            {
                mss.dPrice = double.Parse(txtPrice.Text.Trim());
            }

            if (txtUnit.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("单位不能为空!");
                return;
            }
            else
            {
                mss.strUnit = txtUnit.Text.Trim();
            }

            if (txtProviderName.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydirHistory("供应商不能为空!");
                return;
            }
            else
            {
                mss.strProviderName = txtProviderName.Text.Trim();
            }

            mss.strStandardUnit = this.txtStandardUnit.Text.Trim();
            mss.strMaterialType = this.ddlMaterialType.SelectedValue;

            if (!ms1.InsertMaterial(mss))
            {
                this.SetErrorMsgPageBydir("添加原材料资料失败,请重试!");
                return;
            }
            else
            {
                this.SetSuccMsgPageBydir("添加原材料资料成功!", "");
                return;
            }
        }
示例#11
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;
            }
        }
示例#12
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;
            }
        }