예제 #1
0
파일: FFq.cs 프로젝트: sungxgit/sun_code
        private void dataGridView1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter & dataGridView1.CurrentCell.ColumnIndex == 0)//是否选择的是第一个单元格
            {
                //验证不通过
                try
                {
                    if (!yanzheng(dataGridView1.CurrentRow.Cells["tm"].Value.ToString(), dataGridView1.CurrentCell.RowIndex))
                    {
                        dataGridView1.CurrentRow.Cells["tm"].Value = "";
                        return;
                    }

                    // dataGridView1.CurrentCell
                    //扫描原料条码  在dt_ycl中 查询
                    if (dt_gxl.Rows.Count != 0)
                    {
                        try
                        {
                            DataRow[] drArr = dt_gxl.Select("条码 = '" + dataGridView1.CurrentCell.Value.ToString().Trim() + "'");

                            dataGridView1.CurrentRow.Cells["kycd"].Value = drArr[0]["可用长度"];//膜长
                            // dataGridView1.CurrentRow.Cells["sycd1"].Value = drArr[0]["kycd"];//膜长
                            dataGridView1.CurrentCell = dataGridView1[4, dataGridView1.CurrentCell.RowIndex];
                            dataGridView1.CurrentRow.Cells["mk"].Value = drArr[0]["膜宽"];
                            dataGridView1.CurrentRow.Cells["mh"].Value = drArr[0]["膜厚"];
                            //dataGridView1.CurrentRow.Cells[""].Value = drArr[0][""];
                            //dataGridView1.CurrentRow.Cells[""].Value = drArr[0][""];
                            //dataGridView1.CurrentRow.Cells[""].Value = drArr[0][""];
                        }
                        catch
                        {
                            MessageBox.Show("错误的条码,请重新扫描");
                            dataGridView1.CurrentRow.Cells["tm"].Value = "";
                        }
                        return;
                    }
                    else
                    {
                        MessageBox.Show("请先做生产领料单");
                    }
                }
                catch {
                    MessageBox.Show("错误的条码");
                    return;
                }
            }
            if (e.KeyCode == Keys.Enter & dataGridView1.CurrentCell.ColumnIndex == 4)//是否选择的是第6个单元格
            {
                if (!Globals.CheckNumber(dataGridView1.CurrentRow.Cells["sycd1"].Value.ToString().Trim()))
                {
                    MessageBox.Show("请输入数字");
                    dataGridView1.CurrentRow.Cells["sycd1"].Value = null;
                    return;
                }
                if (decimal.Parse(dataGridView1.CurrentRow.Cells["sycd1"].Value.ToString().Trim()) > decimal.Parse(dataGridView1.CurrentRow.Cells["kycd"].Value.ToString().Trim()))
                {
                    MessageBox.Show("使用长度不能超过膜长度");
                    dataGridView1.CurrentRow.Cells["sycd1"].Value = null;
                    return;
                }
            }
        }
예제 #2
0
파일: FFq.cs 프로젝트: sungxgit/sun_code
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("任务完成后批量入库", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                return;  //否就退出操作
            }

            //sqlcmd.Connection.Open();
            try
            {
                // DataSet ds = new DataSet();
                try
                {
                    conn.Open();
                }
                catch { }
                //统计产量
                string         cl  = "select sum(FMcd) cl from  tgx  where FICMOBillNo='" + comboBox1.Text + "'  and FSfrk=0  and frkd=1";
                SqlDataAdapter sd2 = new SqlDataAdapter(cl, conn);

                try
                {
                    ds.Tables["cl"].Clear();
                }
                catch { }
                sd2.Fill(ds, "cl");
                try
                {
                    if (ds.Tables["cl"].Rows[0][0].ToString() == "")
                    {
                        MessageBox.Show("没有符合入库的数据");
                        conn.Close();
                        return;
                    }
                }
                catch
                {
                    MessageBox.Show("没有符合入库的数据");
                    conn.Close();
                    return;
                }
                //获取单号
                //tj tj = new tj();
                //RK ck = new RK(tj);
                //ck.ShowDialog();

                //获取单据号和内码
                ArrayList al = Globals.Return_proc(conn);
                string    sql_icstockbill = "select FBillerID,FSelTranType, FBrNo, FInterID, FTranType, FBillNo, FDate, FDeptID  from ICStockBill  where  1=2";

                SqlDataAdapter icstockbill = new SqlDataAdapter(sql_icstockbill, conn);
                try
                {
                    ds.Tables["icstockbill"].Clear();
                    ds.Tables["icstockbillentry"].Clear();
                }
                catch { }

                icstockbill.Fill(ds, "icstockbill");
                DataRow rk = ds.Tables["icstockbill"].NewRow();
                rk["FBillerID"]    = 16394; //制单人
                rk["FSelTranType"] = 85;
                rk["FBrNo"]        = 0;
                rk["FInterID"]     = al[1];
                rk["FTranType"]    = 2;
                rk["FBillNo"]      = al[0];
                rk["fdate"]        = DateTime.Now.ToString("d");
                rk["FDeptID"]      = comboBox2.SelectedValue;
                ds.Tables["icstockbill"].Rows.Add(rk);
                SqlCommandBuilder sb = new SqlCommandBuilder(icstockbill);
                icstockbill.Update(ds.Tables["icstockbill"]);
                string         sql_icstockbillentry = "select FChkPassItem,FSourceInterId,FDCStockID,FDCSPID,FBrNo,FEntryID,FUnitID,FQty,FAuxQty,FItemID,FInterID,FQtyMust,FAuxQtyMust,FBatchNo,FSourceTranType,FSourceBillNo,FICMOBillNo,FICMOInterID from  ICStockBillEntry where 1=2";
                SqlDataAdapter icstockbillentry     = new SqlDataAdapter(sql_icstockbillentry, conn);
                icstockbillentry.Fill(ds, "icstockbillentry");
                rk = ds.Tables["icstockbillentry"].NewRow();
                rk["FChkPassItem"]   = 1058;
                rk["FSourceInterId"] = ydnm.Text;
                rk["FDCStockID"]     = ck.Text;
                //rk["FDCStockID"] = tj.ck;//仓库
                rk["FDCSPID"]     = cw.Text;//仓位
                rk["FBrNo"]       = 0;
                rk["FEntryID"]    = 1;
                rk["FUnitID"]     = 783;
                rk["FAuxQty"]     = rk["FQty"] = ds.Tables["cl"].Rows[0][0];
                rk["FItemID"]     = wl.Text;
                rk["FInterID"]    = al[1];
                rk["FAuxQtyMust"] = rk["FQtyMust"] = rwl.Text;

                rk["FBatchNo"]        = label6.Text;
                rk["FSourceTranType"] = 85;
                rk["FSourceBillNo"]   = comboBox1.Text;
                rk["FICMOBillNo"]     = comboBox1.Text;
                rk["FICMOInterID"]    = ydnm.Text;
                ds.Tables["icstockbillentry"].Rows.Add(rk);
                sb = new SqlCommandBuilder(icstockbillentry);
                icstockbillentry.Update(ds.Tables["icstockbillentry"]);
                //修改入库任务的工序数据入库状态
                Globals.E_proc(conn, comboBox1.Text);

                conn.Close();
                MessageBox.Show("入库完成");
            }
            catch
            {
                MessageBox.Show("入库失败");
            }
        }
예제 #3
0
파일: Fjp.cs 프로젝트: sungxgit/sun_code
        public void tlbl(string sql, SqlConnection conn, int zt, string msg)
        {
            try { conn.Open(); } catch { }
            SqlDataAdapter sd2 = new SqlDataAdapter(sql, conn);

            try
            {
                ds.Tables["ylsyl"].Clear();
            }
            catch { }
            sd2.Fill(ds, "ylsyl");
            try
            {   //与领用做比对
                if (ds.Tables["ylsyl"].Rows[0][0].ToString() == "")
                {
                    MessageBox.Show("没有符合" + msg + "的数据");
                    conn.Close();
                    return;
                }
            }
            catch
            {
                MessageBox.Show("没有符合" + msg + "的数据");
                conn.Close();
                return;
            }
            tj tj = new tj();
            RK ck = new RK(tj);

            ck.ShowDialog();



            /***************************************************/

            ArrayList al = Globals.Return_proc(conn, "24");
            string    sql_icstockbill = "select FBillerID,FSelTranType, FBrNo, FInterID, FTranType, FBillNo, FDate, FDeptID,Frob,FPurposeID  from ICStockBill  where  1=2";

            SqlDataAdapter icstockbill = new SqlDataAdapter(sql_icstockbill, conn);

            try
            {
                ds.Tables["icstockbill"].Clear();
                ds.Tables["icstockbillentry"].Clear();
            }
            catch { }

            icstockbill.Fill(ds, "icstockbill");
            DataRow rk = ds.Tables["icstockbill"].NewRow();

            rk["FPurposeID"]   = 12000;
            rk["FBillerID"]    = 16394; //制单人
            rk["FSelTranType"] = 85;
            rk["FBrNo"]        = 0;
            rk["FInterID"]     = al[1];
            rk["FTranType"]    = 24;
            rk["FBillNo"]      = al[0];
            rk["fdate"]        = DateTime.Now.ToString("d");
            rk["FDeptID"]      = comboBox2.SelectedValue;
            rk["Frob"]         = zt;
            ds.Tables["icstockbill"].Rows.Add(rk);
            SqlCommandBuilder sb = new SqlCommandBuilder(icstockbill);


            string         sql_icstockbillentry = "select FChkPassItem,FSourceInterId,FDCStockID,FSCStockID, FDCSPID,FBrNo,FEntryID,FUnitID,FQty,FAuxQty,FItemID,FInterID,FQtyMust,FAuxQtyMust,FBatchNo,FSourceTranType,FSourceBillNo,FICMOBillNo,FICMOInterID,FCostOBJID from  ICStockBillEntry where 1=2";
            SqlDataAdapter icstockbillentry     = new SqlDataAdapter(sql_icstockbillentry, conn);

            icstockbillentry.Fill(ds, "icstockbillentry");
            sb = new SqlCommandBuilder(icstockbillentry);
            for (int i = 0; i < ds.Tables["ylsyl"].Rows.Count; i++)
            {
                rk = ds.Tables["icstockbillentry"].NewRow();
                rk["FChkPassItem"]   = 1058;
                rk["FSourceInterId"] = ydnm.Text;
                rk["FSCStockID"]     = tj.ck;//仓库
                if (tj.cw != "0")
                {
                    rk["FDCSPID"] = tj.cw;//仓位
                }
                rk["FCostOBJID"] = cbdx.Text;

                rk["FBrNo"]       = 0;
                rk["FEntryID"]    = i + 1;
                rk["FUnitID"]     = 259;
                rk["FAuxQty"]     = rk["FQty"] = ds.Tables["ylsyl"].Rows[i][0];
                rk["FItemID"]     = ds.Tables["ylsyl"].Rows[i][1];
                rk["FInterID"]    = al[1];
                rk["FAuxQtyMust"] = rk["FQtyMust"] = ds.Tables["ylsyl"].Rows[i][0];
                rk["FBatchNo"]    = ds.Tables["ylsyl"].Rows[i][2];
                //rk["FBatchNo"] = label6.Text;
                rk["FSourceTranType"] = 85;
                rk["FSourceBillNo"]   = comboBox1.Text;
                rk["FICMOBillNo"]     = comboBox1.Text;
                rk["FICMOInterID"]    = ydnm.Text;
                ds.Tables["icstockbillentry"].Rows.Add(rk);
            }
            icstockbill.Update(ds.Tables["icstockbill"]);
            icstockbillentry.Update(ds.Tables["icstockbillentry"]);
            //修改入库任务的工序数据入库状态

            MessageBox.Show(msg + "完成。");
            conn.Close();
        }
예제 #4
0
파일: FFq.cs 프로젝트: sungxgit/sun_code
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            // FPt pt1 = new FPt("", 1);
            if (dataGridView1.RowCount <= 1)
            {
                MessageBox.Show("信息不全不能保存");
                return;
            }
            for (int i = 0; i < dataGridView1.RowCount - 1; i++)
            {
                if (dataGridView1.Rows[i].Cells["sycd1"].Value == null)
                {
                    MessageBox.Show("使用长度必须为数字");

                    return;
                }

                if (!Globals.CheckNumber(dataGridView1.Rows[i].Cells["sycd1"].Value.ToString().Trim()))
                {
                    MessageBox.Show("使用长度必须为数字");

                    return;
                }
                if (decimal.Parse(dataGridView1.Rows[i].Cells["sycd1"].Value.ToString().Trim()) > decimal.Parse(dataGridView1.Rows[i].Cells["kycd"].Value.ToString().Trim()))
                {
                    MessageBox.Show("使用长度不能超可用长度");
                    dataGridView1.Rows[i].Cells["sycd1"].Value           = null;
                    dataGridView1.Rows[i].Cells["sycd1"].Style.BackColor = Color.Red;

                    return;
                }
            }


            if (MessageBox.Show("是否需要保存", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                return;  //否就退出操作
            }

            if (js.Text != "")
            {
                if (!Globals.CheckNumber(js.Text.ToString().Trim()))
                {
                    MessageBox.Show("卷数必须为数字");
                    js.Text = null;
                    return;
                }
            }
            else
            {
                MessageBox.Show("卷数必须录入");
                // mkd.Text = null;
                return;
            }
            if (mcd.Text != "")
            {
                if (!Globals.CheckNumber(mcd.Text.ToString().Trim()))
                {
                    MessageBox.Show("膜长度必须为数字");
                    mkd.Text = null;
                    return;
                }
            }
            else
            {
                MessageBox.Show("膜长度必须录入");
                return;
            }
            if (qds.Text != "")
            {
                if (!Globals.CheckNumber(qds.Text.ToString().Trim()))
                {
                    MessageBox.Show("刀数必须为数字");
                    qds.Text = null;
                    return;
                }
            }
            else
            {
                MessageBox.Show("刀数必须录入");
                return;
            }
            if (dataGridView1.RowCount < 1)
            {
                MessageBox.Show("信息不全不能保存");
                return;
            }
            try
            {
                ds.Tables["tgx"].Clear();
            }
            catch { }
            try
            {
                ds.Tables["gxb"].Clear();
            }
            catch { }
            string         insertsql = "SELECT  FBarcode, FWork, FQty, FMcd, FMkd, FMhd, FJs, FBc, FJyy, FBz, FUnitID, FICMOID, FItemID, FJlr, FJlrq,FRkd, FSfrk, FSfyw, FICMOBillNo ,FBatchNo ,FMustSh,Fjh,Fds,FXh FROM  Tgx where 1=2 ";
            SqlDataAdapter gxjl      = new SqlDataAdapter(insertsql, conn);

            gxjl.Fill(ds, "tgx");
            SqlCommandBuilder sb1    = new SqlCommandBuilder(gxjl);
            string            sql    = "select fyctm,fsycd,FCptm from Tylcpgx  where 1=2";//保存对应关系到Tylcpgx表
            SqlDataAdapter    dtylgx = new SqlDataAdapter(sql, conn);

            dtylgx.Fill(ds, "gxb");//过程记录表

            SqlCommandBuilder sb = new SqlCommandBuilder(dtylgx);
            DataRow           newrowgx;
            DataRow           newrow;
            string            tm;
            string            tmhb = "";


            string    sqlmax  = "select FXh ,FJlrq from tgx  where FICMOBillNo='" + comboBox1.SelectedValue + "' and FWork='分切'  order  by FXh desc";
            DataTable maxdata = sj.ds(sqlmax, "zdz", conn);

            if (maxdata.Rows.Count < 1)
            {
                zxh.Text  = "1";
                jlrq.Text = DateTime.Now.ToString();
            }
            else
            {
                zxh.Text  = (int.Parse(maxdata.Rows[0][0].ToString()) + 1).ToString();
                jlrq.Text = maxdata.Rows[0][1].ToString();
            }



            for (int j = 0; j < int.Parse(qds.Text.Trim()); j++)    //刀数控制
            {
                for (int i = 0; i < int.Parse(js.Text.Trim()); i++) //卷数控制
                {
                    newrowgx = ds.Tables["tgx"].NewRow();

                    newrowgx["FBarcode"] = tm = wl.Text.PadLeft(5, '0') + Globals.GetTimeStamp();
                    for (int k = 0; k < dataGridView1.RowCount - 1; k++)
                    {
                        newrow          = ds.Tables["gxb"].NewRow();
                        newrow["fcptm"] = newrowgx["FBarcode"];
                        newrow["fyctm"] = dataGridView1.Rows[k].Cells["tm"].Value.ToString();

                        try
                        {
                            if (dataGridView1.Rows[i].Cells["yw"].Value.ToString() == "是")
                            {
                                newrow["fsycd"] = (decimal.Parse(dataGridView1.Rows[k].Cells["kycd"].Value.ToString()) / int.Parse(js.Text.Trim()) / int.Parse(qds.Text.Trim())).ToString(("#0.0000"));
                            }
                            else
                            {
                                newrow["fsycd"] = (decimal.Parse(dataGridView1.Rows[k].Cells["sycd1"].Value.ToString()) / int.Parse(js.Text.Trim()) / int.Parse(qds.Text.Trim())).ToString(("#0.0000"));
                            }
                        }
                        catch
                        {
                            newrow["fsycd"] = (decimal.Parse(dataGridView1.Rows[k].Cells["sycd1"].Value.ToString()) / int.Parse(js.Text.Trim()) / int.Parse(qds.Text.Trim())).ToString(("#0.0000"));
                        }


                        // newrow["fsycd"] = (decimal.Parse(dataGridView1.Rows[k].Cells["sycd1"].Value.ToString()) / int.Parse(js.Text.Trim()) / int.Parse(qds.Text.Trim())).ToString(("#0.0000"));
                        ds.Tables["gxb"].Rows.Add(newrow);
                    }

                    tmhb += tm + "|";
                    Thread.Sleep(1);
                    newrowgx["FWork"] = "分切";
                    if (mzl.Text != "")
                    {
                        newrowgx["fqty"] = mzl.Text.Trim();
                    }
                    if (mcd.Text != "")
                    {
                        newrowgx["fmcd"] = mcd.Text.Trim();
                    }
                    if (mkd.Text != "")
                    {
                        newrowgx["fmkd"] = mkd.Text.Trim();
                    }
                    if (mhd.Text != "")
                    {
                        newrowgx["FMhd"] = mhd.Text.Trim();
                    }
                    newrowgx["fbc"]         = bc.Text;
                    newrowgx["FJyy"]        = jyy.Text;
                    newrowgx["fbz"]         = bz.Text;
                    newrowgx["FJlr"]        = jlr.Text;
                    newrowgx["FJlrq"]       = jlrq.Text;
                    newrowgx["FItemID"]     = wl.Text;
                    newrowgx["FRkd"]        = (rkd.Text == "1") ? true : false;
                    newrowgx["FICMOBillNo"] = comboBox1.Text;
                    newrowgx["FBatchNo"]    = label6.Text;
                    newrowgx["FXh"]         = zxh.Text;
                    newrowgx["Fjh"]         = i + 1; //  卷号
                    newrowgx["FDs"]         = j + 1; //刀数
                    ds.Tables["tgx"].Rows.Add(newrowgx);
                    //  newrow["fyctm"] = dataGridView1.Rows[0].Cells["tm"].Value.ToString();
                    // newrow["fsycd"] =     (decimal.Parse(dataGridView1.Rows[0].Cells["sycd1"].Value.ToString()) / int.Parse(js.Text.Trim())/int.Parse(qds.Text.Trim())).ToString(("#0.0000"));
                    // newrow["flx"] = true;
                    // newrow["fcptm"] = gctm.Text;
                }
            }

            gxjl.Update(ds.Tables["tgx"]);
            dtylgx.Update(ds.Tables["gxb"]);


            //打印标签
            for (int j = 0; j < int.Parse(qds.Text.Trim()); j++)
            {
                for (int i = 0; i < int.Parse(js.Text.Trim()); i++)
                {
                    string ptnr = label6.Text + "-" + zxh.Text + "-" + (j + 1).ToString() + "-" + (i + 1).ToString() + "(" + Globals.userid + ")" + "|" + tmhb.Split('|')[i] + "|" + label8.Text;
                    FPt    pt   = new FPt(ptnr, 1);
                }
            }

            conn.Close();


            try
            {
                yscl.Text = (decimal.Parse(yscl.Text.Trim()) + decimal.Parse(mcd.Text.Trim()) * int.Parse(js.Text.Trim()) * int.Parse(qds.Text.Trim())).ToString();
            }
            catch
            {
                yscl.Text = (decimal.Parse(mcd.Text.Trim()) * int.Parse(js.Text.Trim()) * int.Parse(qds.Text.Trim())).ToString();
            }
            clearjm();
            label14.Text = "";
            label5.Text  = "";
            zxh.Clear();
            qds.Clear();
            dataGridView1.Rows.Clear();
            if (!lgxl())
            {
                MessageBox.Show("料已用完");
            }
        }
예제 #5
0
파일: Fjp.cs 프로젝트: sungxgit/sun_code
        //保存
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (!Globals.CheckNumber(mcd.Text.ToString().Trim()))
            {
                MessageBox.Show("膜长度必须为数字");
                mcd.Text = null;
                return;
            }
            if (mkd.Text != "")
            {
                if (!Globals.CheckNumber(mkd.Text.ToString().Trim()))
                {
                    MessageBox.Show("膜宽度必须为数字");
                    mkd.Text = null;
                    return;
                }
            }

            if (dataGridView1.RowCount <= 1 | gctm.Text == "")
            {
                MessageBox.Show("信息不全不能保存");
                return;
            }
            for (int i = 0; i < dataGridView1.RowCount - 1; i++)
            {
                if (dataGridView1.Rows[i].Cells["sycd1"].Value == null)
                {
                    MessageBox.Show("使用长度必须为数字");

                    return;
                }

                if (!Globals.CheckNumber(dataGridView1.Rows[i].Cells["sycd1"].Value.ToString().Trim()))
                {
                    MessageBox.Show("使用长度必须为数字");

                    return;
                }

                if (decimal.Parse(dataGridView1.Rows[i].Cells["sycd1"].Value.ToString().Trim()) > decimal.Parse(dataGridView1.Rows[i].Cells["kycd"].Value.ToString().Trim()))
                {
                    MessageBox.Show("使用长度不能超可用长度");
                    dataGridView1.Rows[i].Cells["sycd1"].Value           = null;
                    dataGridView1.Rows[i].Cells["sycd1"].Style.BackColor = Color.Red;
                    return;
                }
            }

            if (MessageBox.Show("是否需要保存", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                return;  //否就退出操作
            }
            try
            {
                ds.Tables["tgx"].Clear();
            }
            catch { }
            try
            {
                ds.Tables["gxb"].Clear();
            }
            catch { }
            //try
            //{
            //    conn.Open();
            //}
            //catch { }
            //DataSet ds = new DataSet();
            //修改tyl表的 FSylength=FSylength-sycd
            string         insertsql = "SELECT  FBarcode, FWork, FQty, FMcd, FMkd, FMhd, FJs, FBc, FJyy, FBz, FUnitID, FICMOID, FItemID, FJlr, FJlrq,FRkd, FSfrk, FSfyw, FICMOBillNo ,FBatchNo,fscjt FROM  Tgx where 1=2 ";
            SqlDataAdapter gxjl      = new SqlDataAdapter(insertsql, conn);

            gxjl.Fill(ds, "tgx");
            DataRow newrowgx = ds.Tables["tgx"].NewRow();

            newrowgx["FBarcode"] = gctm.Text.Trim();
            newrowgx["FWork"]    = "检品";
            if (mzl.Text != "")
            {
                newrowgx["fqty"] = mzl.Text.Trim();
            }
            if (mcd.Text != "")
            {
                newrowgx["fmcd"] = mcd.Text.Trim();
            }
            if (mkd.Text != "")
            {
                newrowgx["fmkd"] = mkd.Text.Trim();
            }
            if (mhd.Text != "")
            {
                newrowgx["FMhd"] = mhd.Text.Trim();
            }
            newrowgx["fbc"]         = bc.Text;
            newrowgx["FJyy"]        = jyy.Text;
            newrowgx["fbz"]         = bz.Text;
            newrowgx["FJlr"]        = jlr.Text;
            newrowgx["FJlrq"]       = jlrq.Text;
            newrowgx["Fscjt"]       = jtmc.Text;
            newrowgx["FItemID"]     = wl.Text;
            newrowgx["FRkd"]        = (rkd.Text == "1") ? true : false;
            newrowgx["FICMOBillNo"] = comboBox1.Text;
            newrowgx["FBatchNo"]    = label6.Text;

            ds.Tables["tgx"].Rows.Add(newrowgx);

            SqlCommandBuilder sb1 = new SqlCommandBuilder(gxjl);
            //gxjl.Update(ds.Tables["tgx"]);

            //插入数据到tycpgx  原料产品关系对照表   FYctm    FSycd   FCptm
            string sql = "select fyctm,fsycd,FCptm from Tylcpgx  where 1=2";

            SqlDataAdapter dtylgx = new SqlDataAdapter(sql, conn);

            dtylgx.Fill(ds, "gxb");
            //批量写入原料与产品关系表
            for (int i = 0; i < dataGridView1.RowCount - 1; i++)
            {
                if (dataGridView1.Rows[i].Cells["kycd"].Value == null)
                {
                    MessageBox.Show("必须录入膜使用长度");
                    ds.Tables["gxb"].Clear();
                    return;
                }
                DataRow newrow = ds.Tables["gxb"].NewRow();
                newrow["fyctm"] = dataGridView1.Rows[i].Cells["tm"].Value.ToString();
                try
                {
                    if (dataGridView1.Rows[i].Cells["yw"].Value.ToString() == "是")
                    {
                        newrow["fsycd"] = dataGridView1.Rows[i].Cells["kycd"].Value.ToString();
                    }
                    else
                    {
                        newrow["fsycd"] = dataGridView1.Rows[i].Cells["sycd1"].Value.ToString();
                    }
                }
                catch { newrow["fsycd"] = dataGridView1.Rows[i].Cells["sycd1"].Value.ToString(); }
                newrow["fcptm"] = gctm.Text;
                ds.Tables["gxb"].Rows.Add(newrow);
            }
            SqlCommandBuilder sb = new SqlCommandBuilder(dtylgx);

            gxjl.Update(ds.Tables["tgx"]);
            dtylgx.Update(ds.Tables["gxb"]);
            conn.Close();
            string ptnr = "检品|" + label6.Text + "|" + label8.Text + "|" + gctm.Text + "|" + jtmc.Text + "|" + Globals.usernm + "|" + jlrq.Text + "|" + jyy.Text + "|" + bc.Text + "|" + mcd.Text + "|" + ngx.Text + "|" + wlkd.Text;
            FPt    pt   = new FPt(ptnr);

            try
            {
                yscl.Text = (decimal.Parse(yscl.Text.Trim()) + decimal.Parse(mcd.Text.Trim())).ToString();
            }
            catch {
                yscl.Text = (decimal.Parse(mcd.Text.Trim())).ToString();
            }
            clearjm();
            dataGridView1.Rows.Clear();
            if (!lgxl())
            {
                MessageBox.Show("领料失败");
            }
        }