コード例 #1
0
ファイル: Frksj.cs プロジェクト: sungxgit/sun_code
 public Frksj(DataTable dt, tj gxtj)
 {
     InitializeComponent();
     dataGridView1.DataSource = dt;
     this.gxtj   = gxtj;
     gxtj.cancel = true;
 }
コード例 #2
0
        public RK(tj tj1)
        {
            InitializeComponent();
            string sql = "select FItemID,fname,FNumber,FSPGroupID from  t_Stock  ";

            conn    = new SqlConnection(Globals.connstr);
            this.tj = tj1;
            comboBox1.DataSource    = dt = sj.ds(sql, "ck", conn);
            comboBox1.DisplayMember = "fname";
            comboBox1.ValueMember   = "FSPGroupID";
        }
コード例 #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
ファイル: FZd.cs プロジェクト: sungxgit/sun_code
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("任务完成后批量退料", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                return;  //否就退出操作
            }
            SqlCommand sqlcmd = new SqlCommand();

            sqlcmd.Connection = conn;
            //sqlcmd.Connection.Open();
            try
            {
                // DataSet ds = new DataSet();
                try
                {
                    conn.Open();
                }
                catch { }
                //统计材料用量
                //string ylsyl = "select sum(FSycd) from  Tylcpgx  where FCptm in(select FBarcode from  Tgx  where FICMOBillNo ='"+comboBox1.Text+"' and FWork='印刷')";
                // string ylsyl = "select sum( fsycd) * ISNULL(fcoefficient , 1) as yl,fitemid,fcoefficient from  V_ylgx where FCptm in(select FBarcode from  Tgx  where FICMOBillNo ='" + comboBox1.Text + "' and FWork='印刷')  group by fitemid,coefficient";
                //领用量
                // string ly = "select sum(fqty)lyl ,FItemID from  v_flrw where FICMOBillNo='"+comboBox1.Text+"' group by FItemID";
                // string ylsyl = "select 0-lyl+yl tll,tb1.FItemID,FBatchNo from (select sum( fsycd) * ISNULL(fcoefficient , 1) as yl,fitemid,fcoefficient,FBatchNo from  V_ylgx where FCptm in(select FBarcode from  Tgx  where FICMOBillNo ='" + comboBox1.Text + "' and FWork='分切' and FHj=0)  group by fitemid,fcoefficient,FBatchNo)tb1  left join(select sum(fqty)lyl ,FItemID from  v_flrw where FICMOBillNo='" + comboBox1.Text + "' group by FItemID )tb2 on tb1.fitemid= tb2.FItemID  where tb1.FItemID is not null";
                string ylsyl = "select 0-lyl+yl tll,tb1.FItemID,tb1.FBatchNo from (select sum( fsycd) * ISNULL(fcoefficient , 1) as yl,fitemid,fcoefficient,FBatchNo  from  V_ylgx where FCptm in(select FBarcode from  Tgx  where FICMOBillNo ='" + comboBox1.Text + "' and FWork='分切' and FHj=0)  group by fitemid,fcoefficient,FBatchNo)tb1  left join(select sum(fqty)lyl ,FItemID,FBatchNo from  v_flrw where FICMOBillNo='" + comboBox1.Text + "' group by FItemID,FBatchNo ) tb2 on tb1.fitemid= tb2.FItemID  and tb1.Fbatchno=tb2.FBatchNo  where tb1.fitemid  is not null and 0-lyl+yl<0";

                SqlDataAdapter sd2 = new SqlDataAdapter(ylsyl, conn);

                try
                {
                    ds.Tables["ylsyl"].Clear();
                }
                catch { }
                sd2.Fill(ds, "ylsyl");
                try
                {   //与领用做比对
                    if (ds.Tables["ylsyl"].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);

                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"]         = -1;
                ds.Tables["icstockbill"].Rows.Add(rk);
                SqlCommandBuilder sb = new SqlCommandBuilder(icstockbill);


                string         sql_icstockbillentry = "select FChkPassItem,FSourceInterId,FDCStockID,FDCSPID,FSCStockID,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;//仓库
                    rk["FCostOBJID"]     = cbdx.Text;
                    if (tj.cw != "0")
                    {
                        rk["FDCSPID"] = tj.cw;//仓位
                    }
                    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"]);
                //修改入库任务的工序数据入库状态
                Globals.E_proc_closeicmo(conn, comboBox1.Text);

                conn.Close();

                /***************************************************/
            }
            catch { }
            string sql = "select FBillNo,FName,khmc,xsdd,fworkshop,fitemid,FNumber,finterid,fqty,FDefaultLoc,FSPID,FGMPBatchNo,FModel,FApproveNo,FWidth,jg,zxbz from  v_xdxx where FBillNo in(select FICMOBillNo from  V_Flrw)  and fworkshop='" + comboBox2.SelectedValue + "'";

            comboBox1.DataSource    = null;
            comboBox1.DataSource    = dt = sj.ds(sql, "rw", conn);
            comboBox1.DisplayMember = "FBillNo";
            comboBox1.ValueMember   = "FBillNo";
            MessageBox.Show("退料完成");
        }
コード例 #5
0
ファイル: FFh.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";
                string cl = "select fBarcode 条码,FWork 工序,FMcd 长度,FBatchNo 批次, fjlrq 创建日期  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");
                tj    tj1 = new tj();
                Frksj rkd = new Frksj(ds.Tables["cl"], tj1);
                rkd.ShowDialog();
                if (tj1.cancel)
                {
                    return;
                }
                try
                {
                    if (tj1.cl <= 0)
                    {
                        MessageBox.Show("没有符合入库的数据");
                        conn.Close();
                        return;
                    }
                    //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,FStatus, 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["FBillerID"] = Globals.userid;   //制单人
                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;
                // rk["FStatus"] = 1;        //审核标志
                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"] = tj1.ck;//仓库
                rk["FDCSPID"]         = cw.Text;//仓位
                rk["FBrNo"]           = 0;
                rk["FEntryID"]        = 1;
                rk["FUnitID"]         = 783;
                rk["FAuxQty"]         = rk["FQty"] = tj1.cl; //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_1(conn, tj1.gxtj);
                conn.Close();
                MessageBox.Show("入库完成");
            }
            catch
            {
                MessageBox.Show("入库失败");
            }
        }