Exemplo n.º 1
0
        private void ddlInv_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string    strsql = "select cnvcInvCode,cnvcInvName,cnvcProduceUnitCode from tbInventory where cnvcInvCode='" + this.ddlInv.SelectedValue + "'";
            DataTable dt     = Helper.Query(strsql);

            Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(dt);
            strsql = "select * from tbcomputationunit where cnvccomunitcode='" + inv.cnvcProduceUnitCode + "'";
            dt     = Helper.Query(strsql);
            if (dt.Rows.Count > 0)
            {
                Entity.ComputationUnit cu = new AMSApp.zhenghua.Entity.ComputationUnit(dt);
                this.txtProduceUnitCode.Text = cu.cnvcComUnitName;
            }
        }
Exemplo n.º 2
0
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            //更新
            try
            {
                string strProduceSerialNo = this.txtProduceSerialNo.Text;
                string strMakeSerialNo    = e.Item.Cells[0].Text;
                string strAdjustcount     = ((TextBox)e.Item.Cells[12].Controls[0]).Text;

                string strstcount = ((TextBox)e.Item.Cells[11].Controls[0]).Text;
                string strinvcode = e.Item.Cells[5].Text;

                string    strmakecount = e.Item.Cells[8].Text;
                string    strcount     = e.Item.Cells[13].Text;
                DataTable dtInv        = Application["tbInventory"] as DataTable;
                DataRow[] drInvs       = dtInv.Select("cnvcinvcode='" + strinvcode + "'");
                if (drInvs.Length == 0)
                {
                    throw new Exception("无此存货");
                }
                Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(drInvs[0]);
                if (!inv.cnbSelf && strAdjustcount != "0")
                {
                    throw new Exception("非自制存货,不能调整数量");
                }
//				if(Convert.ToDecimal(strmakecount)>Convert.ToDecimal(strcount)+Convert.ToDecimal(strAdjustcount)+Convert.ToDecimal(strstcount))
//					throw new Exception("计划生产数量不能大于库存领用量、调整生产数量、生产数量之和");
                OperLog ol = new OperLog();
                ol.cnvcOperID   = this.oper.strLoginID;
                ol.cnvcDeptID   = this.oper.strDeptID;
                ol.cnvcOperType = "调整数量";

                MakeDetail md = new MakeDetail();
                md.cnnMakeSerialNo = Convert.ToDecimal(strMakeSerialNo);
                md.cnnAdjustCount  = Convert.ToDecimal(strAdjustcount);
                md.cnnStCount      = Convert.ToDecimal(strstcount);
                md.cnvcInvCode     = strinvcode;
                ProduceFacade pf = new ProduceFacade();
                pf.UpdateMakeDetail(strProduceSerialNo, md, ol);
                this.Popup("更新调整数量及库存领用量成功");
                this.DataGrid1.EditItemIndex = -1;
                BindGrid();
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void BindDetail(string strOrderSerialNo)
        {
            string    strSql            = "select * from tbOrderBookDetail where cnnOrderSerialNo=" + strOrderSerialNo;
            DataTable dtOrderBookDetail = Helper.Query(strSql);

            this.DataTableConvert(dtOrderBookDetail, "cnvcinvcode", "cnvcinvname", "tbInventory", "cnvcinvcode", "cnvcinvname", "");
            this.DataTableConvert(dtOrderBookDetail, "cnvcinvcode", "cnfretailprice", "tbInventory", "cnvcinvcode", "cnfretailprice", "");
            this.DataTableConvert(dtOrderBookDetail, "cnvcinvcode", "cnvcProduceunitcode", "tbInventory", "cnvcinvcode", "cnvcProduceunitcode", "");
            this.DataTableConvert(dtOrderBookDetail, "cnvcProduceunitcode", "cnvccomunitname", "tbComputationUnit", "cnvccomunitcode", "cnvccomunitname", "");

            dtOrderBookDetail.Columns.Add("cnnsum");
            foreach (DataRow dr in dtOrderBookDetail.Rows)
            {
                Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(dr);
                double           sum = Convert.ToDouble(dr["cnnordercount"].ToString()) * Convert.ToDouble(dr["cnfretailprice"].ToString());
                dr["cnnsum"] = sum;
            }
            Session["ProductList"] = dtOrderBookDetail;
        }
Exemplo n.º 4
0
        private void GetInv(string strinvcode)
        {
            string    strsql = "select * from tbinventory where cnvcinvcode='" + strinvcode + "'";
            DataTable dtInv  = Helper.Query(strsql);

            Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(dtInv);
            Session["part"] = inv;

            strsql = "select * from tbinventory where cnvcinvcode in (select cnvcComponentInvCode from tbBillOfMaterials where cnvcPartInvcode='" + strinvcode + "')";
            DataTable dtchild = Helper.Query(strsql);

            Session["child"] = dtchild;

            strsql = "select * from tbBillOfMaterials where cnvcPartInvcode='" + strinvcode + "'";
            DataTable dtBOM = Helper.Query(strsql);

            Entity.BillOfMaterials bom = new BillOfMaterials(dtBOM);
            Session["BaseQtyD"] = bom.cnnBaseQtyD;
            Session["bom"]      = dtBOM;
        }
Exemplo n.º 5
0
 private void BindChild()
 {
     if (Session["child"] != null)
     {
         DataTable dtchild = Session["child"] as DataTable;
         if (!dtchild.Columns.Contains("cnnBaseQtyN"))
         {
             dtchild.Columns.Add("cnnBaseQtyN");
         }
         if (Session["bom"] != null)
         {
             DataTable dtbom = Session["bom"] as DataTable;
             foreach (DataRow dr in dtchild.Rows)
             {
                 Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(dr);
                 DataRow[]        drs = dtbom.Select("cnvcComponentInvCode='" + inv.cnvcInvCode + "'");
                 if (drs.Length > 0)
                 {
                     Entity.BillOfMaterials bom = new BillOfMaterials(drs[0]);
                     dr["cnnBaseQtyN"] = bom.cnnBaseQtyN;
                 }
             }
         }
         this.DataTableConvert(dtchild, "cnvcProduceUnitCode", "cnvcProduceUnitCodeName", "tbComputationUnit", "cnvcComUnitCode", "cnvcComUnitName", "");
         this.dgBOM.DataSource = dtchild;
         this.dgBOM.DataBind();
     }
     else
     {
         Entity.Inventory inv     = new Entity.Inventory();
         DataTable        dtchild = inv.ToTable().Clone();
         dtchild.Columns.Add("cnnBaseQtyN");
         this.dgBOM.DataSource = dtchild;
         this.dgBOM.DataBind();
     }
 }
Exemplo n.º 6
0
        private void Button1_Click(object sender, System.EventArgs e)
        {
            //选择
            if (this.DataGrid2.SelectedIndex >= 0)
            {
                string strinvcode = this.DataGrid2.SelectedItem.Cells[1].Text;
                if (strinvcode == "nbsp;")
                {
                    return;
                }
                string strinvname        = this.DataGrid2.SelectedItem.Cells[2].Text;
                string strinvccode       = this.DataGrid2.SelectedItem.Cells[3].Text;
                string strgroupcode      = this.DataGrid2.SelectedItem.Cells[20].Text;
                string stProduceUnitCode = this.DataGrid2.SelectedItem.Cells[25].Text;

                Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory();
                inv.cnvcInvCode         = strinvcode;
                inv.cnvcInvName         = strinvname;
                inv.cnvcInvCCode        = strinvccode;
                inv.cnvcGroupCode       = strgroupcode;
                inv.cnvcProduceUnitCode = stProduceUnitCode;


                if (hidflag.Value == "part")
                {
                    Session["part"] = inv;
                    string    strsql  = "select * from tbinventory where cnvcinvcode in (select cnvcComponentInvCode from tbBillOfMaterials where cnvcPartInvcode='" + strinvcode + "')";
                    DataTable dtchild = Helper.Query(strsql);
                    Session["child"] = dtchild;

                    strsql = "select * from tbBillOfMaterials where cnvcPartInvcode='" + strinvcode + "'";
                    DataTable dtBOM            = Helper.Query(strsql);
                    Entity.BillOfMaterials bom = new BillOfMaterials(dtBOM);
                    Session["BaseQtyD"] = bom.cnnBaseQtyD;
                    Session["bom"]      = dtBOM;
                }
                if (hidflag.Value == "child")
                {
                    //子件
                    if (Session["child"] == null)
                    {
                        Session["child"] = inv.ToTable();
                    }
                    else
                    {
                        if (Session["part"] != null)
                        {
                            Entity.Inventory invpart = Session["part"] as Entity.Inventory;
                            if (invpart.cnvcInvCode == inv.cnvcInvCode)
                            {
                                this.Popup("母件已选!");
                                return;
                            }
                        }
                        DataTable dt  = Session["child"] as DataTable;
                        DataRow[] drs = dt.Select("cnvcinvcode='" + inv.cnvcInvCode + "'");
                        if (drs.Length > 0)
                        {
                            this.Popup("子件已选!");
                            return;
                        }
                        int      iColloms = dt.Columns.Count;
                        object[] oArray   = new object[iColloms];
                        inv.ToRow().ItemArray.CopyTo(oArray, 0);
                        dt.Rows.Add(oArray);

                        //dt.Rows.Add(inv.ToRow());
                        Entity.BillOfMaterials bom = new BillOfMaterials();
                        bom.cnvcComponentInvCode = inv.cnvcInvCode;
                        if (Session["bom"] == null)
                        {
                            Session["bom"] = bom.ToTable();
                        }
                        DataTable dtbom = Session["bom"] as DataTable;

                        object[] bomarray = new object[dtbom.Columns.Count];
                        bom.ToRow().ItemArray.CopyTo(bomarray, 0);
                        dtbom.Rows.Add(bomarray);
                        Session["bom"]   = dtbom;
                        Session["child"] = dt;
                    }
                }
            }
            this.Response.Write("<script type=\"text/javascript\">window.close()</script>");
        }
Exemplo n.º 7
0
        public void AssignOut(string strProduceSerialNo, OperLog operLog, string strWarehouse)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    string    strsql1      = "SELECT * FROM tbProduceLog WHERE cnvcProduceState='6' and cnnProduceSerialNo=" + strProduceSerialNo;
                    DataTable dtProduceLog = SqlHelper.ExecuteDataTable(trans, CommandType.Text, strsql1);
                    //rr.cndMakeDate = dtSysTime;
                    //EntityMapping.Create(rr,trans);
                    if (dtProduceLog.Rows.Count == 0)
                    {
                        throw new Exception("生产计划不在分货状态!");
                    }
                    Entity.ProduceLog pl = new ProduceLog(dtProduceLog);

                    string    strsql2           = "select * from tbproducechecklog WHERE cnnAssignCount>0 and cnnproduceserialno=" + strProduceSerialNo;
                    DataTable dtProduceCheckLog = SqlHelper.ExecuteDataTable(trans, CommandType.Text, strsql2);
                    if (dtProduceCheckLog.Rows.Count == 0)
                    {
                        throw new Exception("分货出库产品数量都为0");
                    }

                    DataTable dtInv             = SingleTableQuery.ExcuteQuery("tbInventory", trans);
                    DataTable dtComputationUnit = SingleTableQuery.ExcuteQuery("tbComputationUnit", trans);

                    string    strsql3     = "select * from tbassignlog where cnnproduceserialno=" + strProduceSerialNo;
                    DataTable dtAssignLog = SqlHelper.ExecuteDataTable(trans, CommandType.Text, strsql3);
                    if (dtAssignLog.Rows.Count == 0)
                    {
                        throw new Exception("未找到分货流水");
                    }
                    Entity.AssignLog al = new AssignLog(dtAssignLog);

                    Entity.RdRecord rr = new RdRecord();
                    rr.cnvcRdCode = "RD010";
                    rr.cnvcRdFlag = "0";
                    rr.cnvcWhCode = strWarehouse;
                    rr.cnvcDepID  = pl.cnvcProduceDeptID;
                    //rr.cnvcOperName = operLog.cnvcop
                    rr.cnvcComments  = "分货出库";
                    rr.cnvcMaker     = operLog.cnvcOperID;
                    rr.cnnProorderID = pl.cnnProduceSerialNo;
                    rr.cnvcState     = "2";
                    rr.cndMakeDate   = dtSysTime;
                    long rrid = EntityMapping.Create(rr, trans);

                    foreach (DataRow drProduceCheckLog in dtProduceCheckLog.Rows)
                    {
                        Entity.ProduceCheckLog pcl = new ProduceCheckLog(drProduceCheckLog);


                        Entity.RdRecordDetail rrd = new RdRecordDetail();
                        rrd.cnvcFlag   = "0";
                        rrd.cndExpDate = pcl.cndExpDate;                    //Convert.ToDateTime(this.txtProduceDate.Text).AddDays(pc.cnnDays).AddDays(Convert.ToDouble(txtDays.Text));//Convert.ToDateTime(this.txtExpDate.Text);
                        rrd.cndMdate   = pcl.cndMDate;                      //Convert.ToDateTime(this.txtProduceDate.Text);
                        rrd.cnnRdID    = Convert.ToDecimal(rrid);
                        rrd.cnvcPOID   = al.cnnAssignSerialNo.ToString();

                        DataRow[] drinvs = dtInv.Select("cnvcInvCode='" + pcl.cnvcInvCode + "'");
                        if (drinvs.Length == 0)
                        {
                            throw new Exception(pcl.cnvcInvCode + "存货档案未设置");
                        }
                        Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(drinvs[0]);


                        rrd.cnvcInvCode     = inv.cnvcInvCode;
                        rrd.cnvcGroupCode   = inv.cnvcGroupCode;
                        rrd.cnvcComunitCode = inv.cnvcSTComUnitCode;

                        DataRow[] drcus = dtComputationUnit.Select("cnvcGroupCode='" + inv.cnvcGroupCode + "' and cnbMainUnit=1");
                        if (drcus.Length == 0)
                        {
                            throw new Exception(inv.cnvcGroupCode + "未设置主计量单位");
                        }
                        decimal   dchangerate    = Convert.ToDecimal(drcus[0]["cnichangrate"].ToString());
                        DataRow[] drcus1         = dtComputationUnit.Select("cnvcGroupCode='" + inv.cnvcGroupCode + "' and cnvcComUnitCode='" + inv.cnvcSTComUnitCode + "'");
                        decimal   dchangerate_st = Convert.ToDecimal(drcus1[0]["cnichangrate"].ToString());

//						string strcssql = "SELECT * FROM tbCurrentStock WHERE cnvcWhCode='"+strWarehouse+"' AND cnvcInvCode='"+pcl.cnvcInvCode+"'";
//						DataTable dtcs = SqlHelper.ExecuteDataTable(trans,CommandType.Text,strcssql);


                        string strcssql = "SELECT * FROM tbCurrentStock WHERE cnvcWhCode='" + strWarehouse + "' AND cnvcInvCode='" + pcl.cnvcInvCode + "'"
                                          + " and CONVERT(char(10),isnull(cndExpDate,''),121)>=CONVERT(char(10),getdate(),121) ";
                        string strcssql2 = "SELECT isnull(sum(cnnAvaQuantity),0) FROM tbCurrentStock WHERE cnvcWhCode='" + strWarehouse + "' AND cnvcInvCode='" + pcl.cnvcInvCode + "'"
                                           + " and CONVERT(char(10),isnull(cndExpDate,''),121)>=CONVERT(char(10),getdate(),121) ";
                        DataTable dtcs         = SqlHelper.ExecuteDataTable(trans, CommandType.Text, strcssql);
                        decimal   davaquantity = Convert.ToDecimal(SqlHelper.ExecuteScalar(trans, CommandType.Text, strcssql2).ToString());

                        if (dtcs.Rows.Count == 0)
                        {
                            throw new Exception(pcl.cnvcInvCode + "无库存");
                        }
                        if (davaquantity - pcl.cnnAssignCount * dchangerate_st / dchangerate < 0)
                        {
                            throw new Exception(pcl.cnvcInvCode + "库存不足");
                        }

//						if(cs.cnnAvaQuantity - pcl.cnnAssignCount<0)
//							throw new Exception(pcl.cnvcInvCode+"库存不足");
                        decimal dhave = 0;
                        foreach (DataRow drcs in dtcs.Rows)
                        {
                            Entity.CurrentStock cs = new CurrentStock(drcs);
//							if(cs.cnnAvaQuantity - pcl.cnnAssignCount<0)
//								throw new Exception(pcl.cnvcInvCode+"库存不足");
//							cs.cnnAvaQuantity = cs.cnnAvaQuantity - pcl.cnnAssignCount;
//							cs.cnnQuantity = cs.cnnQuantity - pcl.cnnAssignCount;
//							EntityMapping.Update(cs,trans);


                            if (cs.cnnAvaQuantity > pcl.cnnAssignCount * dchangerate_st / dchangerate - dhave)
                            {
                                cs.cnnAvaQuantity = cs.cnnAvaQuantity - pcl.cnnAssignCount * dchangerate_st / dchangerate;
                                cs.cnnQuantity    = cs.cnnQuantity - pcl.cnnAssignCount * dchangerate_st / dchangerate;
                                EntityMapping.Update(cs, trans);
                                break;
                            }
                            else
                            {
                                cs.cnnAvaQuantity = 0;
                                cs.cnnQuantity    = 0;
                                EntityMapping.Update(cs, trans);
                                dhave += cs.cnnAvaQuantity;
                            }
                        }
                        rrd.cnnQuantity = pcl.cnnAssignCount * dchangerate_st / dchangerate;
                        EntityMapping.Create(rrd, trans);
                    }


                    //string strsql = "update tbMakeDetail set cnbCollar=1 where cnnMakeSerialNo="+strMakeSerialNo;
                    //SqlHelper.ExecuteNonQuery(trans,CommandType.Text,strsql);

                    string strsql4 = "update tbproducelog set cnvcproducestate='7' where cnnproduceserialno=" + strProduceSerialNo;
                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strsql4);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "生产流水:" + strProduceSerialNo;
                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Exemplo n.º 8
0
        private void btnCheck_Click(object sender, System.EventArgs e)
        {
            if (Session["tbProduceDetail"] == null)
            {
                this.Popup("请首先使用【盘点清单】按钮,查询计划情况");
                return;
            }
            if (this.JudgeIsNull(txtDays.Text))
            {
                this.Popup("请输入过期天数调整量");
                return;
            }
            DataTable dtpd = (DataTable)Session["tbProduceDetail"];

            ArrayList al             = new ArrayList();
            DataTable dtInv          = Application["tbInventory"] as DataTable;
            DataTable dtProductClass = Application["tbProductClass"] as DataTable;

//			string strSql = "select * from tbProduceCheckLog where cnnProduceSerialNo=" + txtProduceSerialNo.Text+" order by cnvcInvCode";
//			DataTable dtCheck = Helper.Query(strSql);

            //foreach(DataGridItem dgi in this.DataGrid1.Items)
            foreach (DataRow dr in dtpd.Rows)
            {
                //Entity.ProduceCheckLog pc = new ProduceCheckLog(dr);

                string strinvcode = dr["cnvcInvCode"].ToString();               //dgi.Cells[0].Text;
                string strinvname = dr["cnvcInvName"].ToString();               //dgi.Cells[1].Text;
                string strincount = dr["cnnInCount"].ToString();                //dgi.Cells[6].Text;
                //string strwhcount = dgi.Cells[7].Text;
                bool iswh = Convert.ToBoolean(dr["cnbInWh"].ToString());        //((CheckBox)dgi.Cells[7].Controls[1]).Checked;
                if (iswh)
                {
                    this.Popup("已经完成了盘点入库");
                    return;
                }
                decimal dincount          = Convert.ToDecimal(strincount);
                Entity.RdRecordDetail rrd = new RdRecordDetail();
                rrd.cnvcInvCode = strinvcode;
                rrd.cnnQuantity = Convert.ToDecimal(strincount);
                DataRow[] drInvs = dtInv.Select("cnvcInvCode='" + strinvcode + "'");
                if (drInvs.Length == 0)
                {
                    this.Popup(strinvname + "存货档案未找到");
                    return;
                }
                Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(drInvs[0]);

                DataRow[] drProductClasses = dtProductClass.Select("cnvcProductClassCode='" + inv.cnvcInvCCode + "'");
                if (drProductClasses.Length == 0)
                {
                    this.Popup(strinvname + "的存货类别未找到");
                    return;
                }
                Entity.ProductClass pc = new ProductClass(drProductClasses[0]);

                rrd.cnvcGroupCode   = inv.cnvcGroupCode;
                rrd.cnvcComunitCode = inv.cnvcSTComUnitCode;
                rrd.cnvcFlag        = "0";
                rrd.cndExpDate      = Convert.ToDateTime(this.txtProduceDate.Text).AddDays(pc.cnnDays).AddDays(Convert.ToDouble(txtDays.Text));           //Convert.ToDateTime(this.txtExpDate.Text);
                rrd.cndMdate        = Convert.ToDateTime(this.txtProduceDate.Text);

                //if(rrd.cnnQuantity == 0)continue;
                al.Add(rrd);
            }

            if (al.Count == 0)
            {
                this.Popup("无入库产品,不用生产入库!");
                return;
            }
            Entity.RdRecord rr = new RdRecord();
            rr.cnvcRdCode    = "RD009";
            rr.cnvcRdFlag    = "0";
            rr.cnvcWhCode    = this.ddlWarehouse.SelectedValue;
            rr.cnvcDepID     = this.ddlProduceDept.SelectedValue;
            rr.cnvcOperName  = this.oper.strOperName;
            rr.cnvcComments  = "生产入库";
            rr.cnvcMaker     = this.oper.strLoginID;
            rr.cnnProorderID = Convert.ToDecimal(this.txtProduceSerialNo.Text);
            rr.cnvcState     = "2";

            OperLog ol = new OperLog();

            ol.cnvcOperID   = this.oper.strLoginID;
            ol.cnvcDeptID   = this.oper.strDeptID;
            ol.cnvcOperType = "生产入库";
            string strWarehouse = this.ddlWarehouse.SelectedValue;

            try
            {
                ProduceFacade pf = new ProduceFacade();
                pf.CheckInWh(this.txtMakeSerialNo.Text, rr, al, ol, strWarehouse);
                this.Popup("生产入库成功");
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
            QueryProduceDetail();
            BindGrid();
        }
        private void Button2_Click(object sender, System.EventArgs e)
        {
            //领料单打印
            ArrayList al    = new ArrayList();
            DataTable dtInv = Application["tbInventory"] as DataTable;

            foreach (DataGridItem dgi in this.DataGrid1.Items)
            {
                string strinvcode  = dgi.Cells[0].Text;
                string strinvname  = dgi.Cells[1].Text;
                string stroutcount = dgi.Cells[6].Text;
                string strwhcount  = dgi.Cells[7].Text;
                bool   iscollar    = ((CheckBox)dgi.Cells[8].Controls[1]).Checked;
                if (iscollar)
                {
                    //this.Popup(strinvname+"已经完成了生产材料领用");
                    this.Popup("已经领用生产材料");
                    return;
                }

                if (!this.JudgeIsNum(strwhcount))
                {
                    this.Popup(strinvname + "无库存,不能领用原材料,请检查原材料库存");
                    return;
                }
                decimal doutcount = Convert.ToDecimal(stroutcount);
                decimal dwhcount  = Convert.ToDecimal(strwhcount);
                if (doutcount > dwhcount)
                {
                    this.Popup(strinvname + "库存数量不足,不能领用原材料进行生产,请检查原材料库存");
                    return;
                }
                Entity.RdRecordDetail rrd = new RdRecordDetail();
                rrd.cnvcInvCode = strinvcode;
                rrd.cnnQuantity = Convert.ToDecimal(stroutcount);
                DataRow[] drInvs = dtInv.Select("cnvcInvCode='" + strinvcode + "'");
                if (drInvs.Length == 0)
                {
                    this.Popup(strinvname + "存货档案未找到");
                    return;
                }
                Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(drInvs[0]);
                rrd.cnvcGroupCode   = inv.cnvcGroupCode;
                rrd.cnvcComunitCode = inv.cnvcSTComUnitCode;
                rrd.cnvcFlag        = "0";

                al.Add(rrd);
            }

            Entity.RdRecord rr = new RdRecord();
            rr.cnvcRdCode    = "RD008";
            rr.cnvcRdFlag    = "0";
            rr.cnvcWhCode    = this.ddlWarehouse.SelectedValue;
            rr.cnvcDepID     = this.ddlProduceDept.SelectedValue;
            rr.cnvcOperName  = this.oper.strOperName;
            rr.cnvcComments  = "生产材料领用";
            rr.cnvcMaker     = this.oper.strLoginID;
            rr.cnnProorderID = Convert.ToDecimal(this.txtProduceSerialNo.Text);
            rr.cnvcState     = "2";


            OperLog ol = new OperLog();

            ol.cnvcOperID   = this.oper.strLoginID;
            ol.cnvcDeptID   = this.oper.strDeptID;
            ol.cnvcOperType = "生产材料领用";

            string strWarehouse = this.ddlWarehouse.SelectedValue;

            try
            {
                ProduceFacade pf = new ProduceFacade();
                pf.Collar(this.txtMakeSerialNo.Text, rr, al, ol, strWarehouse);
                this.Popup("生产材料领用成功");
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
            BindGrid();
        }