Пример #1
0
        //收桶
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            DbEntityTable <QC_Sample_Mix> qcvhs = new DbEntityTable <QC_Sample_Mix>();

            qcvhs.LoadDataByWhere("main.WpCode='" + workpointCode + "' and main.SampleState =@SampleState and main.ShouTong_Time is null and main.WLLX='煤'", SampleState.组批完成);
            foreach (var qcvh in qcvhs)
            {
                // qcvh.TempID = 0;
                qcvh.ShouTong_Time = System.DateTime.Now;
                //  qcvh.SampleState = SampleState.开始制样;
                qcvh.Save();

                //解绑小卡
                DbEntityTable <QC_Sample_Veh> vehcrds = new DbEntityTable <QC_Sample_Veh>();
                vehcrds.LoadDataByWhere("main.SAMPLE_MIX_ID=@SAMPLE_MIX_ID", qcvh.Sample_Mix_ID);
                foreach (var veh in vehcrds)
                {
                    DbEntityTable <QC_IC_Info> hycrds = new DbEntityTable <QC_IC_Info>();
                    hycrds.LoadDataByWhere("CARDID=@CARDID", veh.CardID);
                    foreach (var qcic in hycrds)
                    {
                        qcic.SampleId = 0;
                        qcic.Save();
                    }
                }
            }
            // 更新显示信息
            DbEntityTable <BC_DT_State> dtwzs = new DbEntityTable <BC_DT_State>();

            dtwzs.LoadDataByWhere("WpCode='" + workpointCode + "' and SHOUTONG_TIME IS NULL and WLLX='煤'");
            this.bCDTStateBindingSource.DataSource = dtwzs;
            qyts ts = new qyts("收桶成功!可以送去制样!");

            ts.ShowDialog();
        }
Пример #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            zupi();
            // 更新显示信息
            DbEntityTable <BC_DT_State> dtwzs = new DbEntityTable <BC_DT_State>();

            dtwzs.LoadDataByWhere("WpCode='" + workpointCode + "' and SHOUTONG_TIME IS NULL and WLLX='煤'");
            this.bCDTStateBindingSource.DataSource = dtwzs;
            QC_Sample_Mix.UpdateInspectMainSample();
            qyts ts = new qyts("组批成功!下一步放小样!");

            ts.ShowDialog();
        }
Пример #3
0
        //放桶
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            //放桶
            if (CardID == "")
            {
                MessageBox.Show("请刷卡");
                return;
            }
            yxcard = false;
            DbEntityTable <BC_DT_State> dtwzs  = new DbEntityTable <BC_DT_State>();
            DbEntityTable <QC_IC_Info>  hycrds = new DbEntityTable <QC_IC_Info>();

            hycrds.LoadDataByWhere("CardID=@CardID and CardType=@CardType ", CardID, "CUT002");
            foreach (var qcic in hycrds)
            {
                if (qcic.SampleId == 0)
                {
                    yxcard           = true;
                    label3.Text      = System.DateTime.Now + "扫卡成功";
                    label3.ForeColor = Color.Red;
                }
                else
                {
                    MessageBox.Show("该卡已经使用");
                    return;    //该卡已经注册
                }
            }
            if (yxcard == true)   //是有效卡
            {
                if (sum > sjtnum)
                {
                    sjtnum = sjtnum + 1;
                    dtgs   = dtgs - 1;
                    if (dtgs > 0)
                    {
                        label5.Text = "需要" + dtgs + "个大桶!";
                        qyts ts = new qyts(label5.Text);

                        ts.ShowDialog();
                    }
                    else
                    {
                        label5.Text = "大桶已经放好!";
                        qyts ts = new qyts(label5.Text);
                        ts.ShowDialog();
                    }
                    int a = sjtnum + 1;
                    label2.Text      = "选择位置" + a;
                    label2.ForeColor = Color.Red;
                }
                else
                {
                    isfangtong  = false;
                    label5.Text = "大桶已经放好!";
                    qyts ts = new qyts(label5.Text);
                    ts.ShowDialog();
                    dtwzs.LoadDataByWhere("WpCode='" + workpointCode + "' and SHOUTONG_TIME IS NULL and WLLX='煤'");
                    this.bCDTStateBindingSource.DataSource = dtwzs;
                    return;
                }
                QC_Sample_Mix hy = new QC_Sample_Mix();

                object result = DbContext.ExecuteScalar("select max(TempID) from QC_Sample_Mix where SampleState=" + Convert.ToInt32(SampleState.初始状态) + " and WpCode='" + workpointCode + "' and WLLX='煤'");
                if (result != null && result != DBNull.Value)
                {
                    hy.TempID = Convert.ToInt32(result) + 1;             //目前有的大桶个数
                }
                else
                {
                    hy.TempID = 1;
                }

                hy.SampleState   = SampleState.初始状态;
                hy.WpCode        = workpointCode;
                hy.WLLX          = "煤";
                hy.CardID        = CardID;
                hy.FangTong_Time = System.DateTime.Now;

                hy.Save();

                if (isfangtong == false)
                {
                    DbEntityTable <QC_Sample_Veh> sxks = new DbEntityTable <QC_Sample_Veh>();
                    sxks.LoadDataByWhere("main.SAMPLESTATE=@SAMPLESTATE and WLLX='煤'", SampleState.初始状态);
                    foreach (var sxk in sxks)
                    {
                        sxk.SampleState = SampleState.开始组批;
                        sxk.Save();
                    }
                }

                isfangtong = true;    //正在放大桶
                DbEntityTable <QC_IC_Info> qcics = new DbEntityTable <QC_IC_Info>();
                qcics.LoadDataByWhere("CardID=@CardID and CardType=@CardType ", hy.CardID, "CUT002");
                foreach (var qcic in qcics)
                {
                    qcic.SampleId = hy.Sample_Mix_ID;
                    qcic.Save();
                    label3.Text      = System.DateTime.Now + "保存成功";
                    label3.ForeColor = Color.Red;
                }
                if (sum <= sjtnum)
                {
                    label5.Text = "大桶已经放好";
                    label2.Text = "";
                    isfangtong  = false;
                    dtwzs.LoadDataByWhere("WpCode='" + workpointCode + "' and SHOUTONG_TIME IS NULL and WLLX='煤'");
                    this.bCDTStateBindingSource.DataSource = dtwzs;
                    return;
                }
                CardID = "";
            }

            dtwzs.LoadDataByWhere("WpCode='" + workpointCode + "' and SHOUTONG_TIME IS NULL and WLLX='煤'");
            this.bCDTStateBindingSource.DataSource = dtwzs;
        }