Exemplo n.º 1
0
 //查询大桶个数
 private void simpleButton4_Click(object sender, EventArgs e)
 {
     if (isfangtong == false)
     {
         sjtnum = 0;
         jsdtgs1();
         if (dtgs == 0)
         {
             jsdtgs();
         }
         DbEntityTable <QC_Sample_Mix> dty = new DbEntityTable <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)
         {
             sjtnum = Convert.ToInt32(result);             //目前有的大桶个数
         }
         if (sjtnum >= dtgs)
         {
             label5.Text = "大桶已经放好";
         }
         else
         {
             sum         = dtgs;
             dtgs        = dtgs - sjtnum;
             label5.Text = "需要" + dtgs + "个大桶";
             int a = sjtnum + 1;
             label2.Text = "选择位置" + a;
         }
     }
 }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        private void 完成取样_Click(object sender, EventArgs e)
        {
            foreach (var item in mixs)
            {
                if (item.WCQY == true)
                {
                    DbEntityTable <QC_Sample_Veh> itemvehs = new DbEntityTable <QC_Sample_Veh>();
                    itemvehs.LoadDataByWhere("main.Sample_Mix_ID=@Sample_Mix_ID", item.Sample_Mix_ID);

                    item.Mix_Time      = DateTime.Now;
                    item.FangTong_Time = DateTime.Now;
                    item.ShouTong_Time = DateTime.Now;
                    item.ShouTong_User = LocalInfo.Current.user.ID;
                    item.FangTong_User = LocalInfo.Current.user.ID;
                    item.MixCount      = itemvehs.Count;
                    item.MixPlanCount  = itemvehs.Count;
                    item.MixUser       = LocalInfo.Current.user.ID;
                    item.SampleState   = SampleState.组批完成;
                    item.Save();


                    foreach (var it in itemvehs)
                    {
                        it.Mix_Time    = DateTime.Now;
                        it.SampleState = SampleState.组批完成;
                        it.Save();
                    }
                }
            }
            vehs.LoadDataByWhere("main.WLLX='石子' and main.SampleState=@SampleState", SampleState.初始状态);
            mixs.LoadDataByWhere("main.WLLX='石子' and main.SampleState=@SampleState", SampleState.初始状态);
        }
Exemplo n.º 4
0
        private void UC_ICReg_Load(object sender, EventArgs e)
        {
            cardUseType = QC_CardUseType.LoadCardUseType();
            this.cmbCardType.Properties.Items.Clear();
            foreach (var item in cardUseType)
            {
                this.cmbCardType.Properties.Items.Add(item);
            }

            this.cmbCardType.SelectedIndex = 0;
            //reposCardUseType.DataSource = cardUseType;
            this.repositoryItemGridLookUpEdit1.DataSource = cardUseType;

            this.gridCtl_IC_Info.DataSource = icInfoDatas;
            icInfoDatas.LoadData();



            foreach (var useType in cardUseType)
            {
                ToolStripMenuItem tsmBtnItem = new ToolStripMenuItem();
                tsmBtnItem.Name = useType.CUTCode;
                tsmBtnItem.Size = new Size(0x98, 0x16);
                tsmBtnItem.Text = useType.CUTName;
                tsmBtnItem.Tag  = useType;

                this.tsmBtnGroup_UseType.DropDownItems.Add(tsmBtnItem);
                tsmBtnItem.Click += new EventHandler(tsmBtn_ChgUseType_Click);
            }
        }
Exemplo n.º 5
0
        public static DbEntityTable <QC_CardUseType> LoadCardUseType()
        {
            DbEntityTable <QC_CardUseType> result = new DbEntityTable <QC_CardUseType>();
            QC_CardUseType cut1 = new QC_CardUseType();

            cut1.CUTCode = QC_IC_Info.CardUseType_Veh;
            cut1.CUTName = "车取样扣";
            result.Add(cut1);
            QC_CardUseType cut2 = new QC_CardUseType();

            cut2.CUTCode = "CUT002";
            cut2.CUTName = "组批样扣";
            result.Add(cut2);

            DbEntityTable <QC_CheckGroup> groups = new DbEntityTable <QC_CheckGroup>();

            groups.LoadData();
            foreach (var item in groups)
            {
                QC_CardUseType cut = new QC_CardUseType();
                cut.CUTCode = "CUT_" + item.CheckGroupCode;
                cut.CUTName = item.CheckGroupName + "扣";
                result.Add(cut);
            }
            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 初始化NC到货单
        /// </summary>
        public void initArrivebill()
        {
            arrivebill = new DbEntityTable <View_arrivebill>();
            arrivebill.LoadDataByWhere(" 1=1 order by vdef5,custname,invname,varrordercode desc");

            string[] leibie = cmbHCPH.Text.Trim().Split('_');
            if (leibie.Count() != 2)
            {
                gridControl3.DataSource = arrivebill;
            }
            else
            {
                string fazhan = leibie[0].ToString();

                if (arrivebill.Where(o => o.vdef5 == fazhan).Count() > 0)
                {
                    gridControl3.DataSource = arrivebill.Where(o => o.vdef5 == fazhan).ToList();
                }
                else
                {
                    gridControl3.DataSource = arrivebill;
                }
            }


            // gridControl3.DataSource = arrivebill;
        }
Exemplo n.º 7
0
        public void exceptBill()
        {
            initPrintbill();
            if (printbill.Count > 0)
            {
                return;
            }

            DbEntityTable <QC_Sample_Mix> temp = new DbEntityTable <QC_Sample_Mix>();

            temp.LoadDataByWhere("main.samplestate = @samplestate and main.wllx=@wllx order by SAMPLE_MIX_ID desc", Xg.Lab.Sample.SampleState.组批完成, "火运");
            if (temp.Count < 1)
            {
                return;
            }
            int sid = temp[0].MainSampleMixId;

            printbill.Clear();

            if (sid == 0)
            {
                printbill.Add(temp[0]);
            }
            else
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Sample_Mix_ID >= sid)
                    {
                        printbill.Add(temp[i]);
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void Hunyang_Load(object sender, EventArgs e)
        {
            isfangtong = false;

            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;
        }
Exemplo n.º 9
0
        private void printDocument2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            List <ZupiData> printData = new List <ZupiData>();

            foreach (var mix in hjmixs)
            {
                List <string> vehnos = new List <string>();
                DbEntityTable <QC_Sample_Veh> vehs = new DbEntityTable <QC_Sample_Veh>();
                vehs.LoadDataByWhere("main.Sample_Mix_ID=@Sample_Mix_ID", mix.Sample_Mix_ID);
                foreach (var item in vehs)
                {
                    vehnos.Add(QC_Sample_Mix.ShortStoreCode(item.CardID));
                }

                if (vehnos.Count > 0)
                {
                    ZupiData zd = new ZupiData();
                    zd.Head      = QC_Sample_Mix.ShortStoreCode(mix.CardID);
                    zd.ZupiItems = vehnos;
                    printData.Add(zd);
                    ZupiData pbzd = new ZupiData();
                    pbzd.Head      = QC_Sample_Mix.ShortStoreCode("PB" + mix.CardID.Remove(0, 2));
                    pbzd.ZupiItems = vehnos;
                    printData.Add(pbzd);
                }
            }
            int totalPage = 1;

            foreach (var item in printData)
            {
                item.BeginPage = totalPage;
                totalPage     += item.NeadPage;
            }

            int printPage = totalPage - curZupiPrintPage;

            foreach (var item in printData)
            {
                if (printPage >= item.BeginPage && printPage < item.EndPage)
                {
                    item.Print(e.Graphics, printPage);
                    break;
                }
            }

            if (curZupiPrintPage < totalPage - 1)
            {
                curZupiPrintPage++;
                e.HasMorePages = true;
            }
            else
            {
                curZupiPrintPage = 1;
                e.HasMorePages   = false;
            }
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
0
        public static QC_CheckMaxMinVal GetMaxMinVal(string rq, string supplierCode, string matNcId)
        {
            DbEntityTable <QC_CheckMaxMinVal> table = new DbEntityTable <QC_CheckMaxMinVal>();

            table.LoadDataBySql("select max(cast(CheckVal as float)) as MaxVal,min(cast(CheckVal as float)) as MinVal from QC_MixSampleValue_V where SampleState>=" + (int)SampleState.化验审核完成 + " and SampleType=" + (int)SampleType.普通样 + "and CHECKITEMCODE='10001' and checkVal<>'' and convert(varchar(10),Mix_Time,120)=@rq and SUPPLIERCODE=@SUPPLIERCODE and MATPK=@MATPK", rq, supplierCode, matNcId);
            if (table.Count > 0)
            {
                return(table[0]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 12
0
        public static QC_NoticeDhdItem_View GetByNoticeId(string noticeId)
        {
            DbEntityTable <QC_NoticeDhdItem_View> noticeDhd = new DbEntityTable <QC_NoticeDhdItem_View>();

            noticeDhd.LoadDataByWhere("NoticeId=@NoticeId", noticeId);
            if (noticeDhd.Count > 0)
            {
                return(noticeDhd[0]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 13
0
        public static QC_ChgWater GetByMatCust(string matNcId, string custCode)
        {
            DbEntityTable <QC_ChgWater> table = new DbEntityTable <QC_ChgWater>();

            table.LoadDataByWhere("MatNcId=@MatNcId and CustCode=@CustCode", matNcId, custCode);
            if (table.Count > 0)
            {
                return(table[0]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 14
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            cardUseType = QC_CardUseType.LoadCardUseType();
            this.cmbCardType.Properties.Items.Clear();
            foreach (var item in cardUseType)
            {
                this.cmbCardType.Properties.Items.Add(item);
            }

            this.cmbCardType.SelectedIndex = 0;
            //reposCardUseType.DataSource = cardUseType;
            this.repositoryItemGridLookUpEdit1.DataSource = cardUseType;
            icInfoDatas.LoadData();
        }
Exemplo n.º 15
0
        public static QC_Material GetByCode(string matCode)
        {
            DbEntityTable <QC_Material> ds = new DbEntityTable <QC_Material>();

            ds.LoadDataByWhere("inv.INVCODE=@MatCode", matCode);

            if (ds.Count > 0)
            {
                return(ds[0]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 16
0
        public static QC_Material GetByID(string id)
        {
            DbEntityTable <QC_Material> ds = new DbEntityTable <QC_Material>();

            ds.LoadDataByWhere("MatNcId=@MatNcId", id);

            if (ds.Count > 0)
            {
                return(ds[0]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 17
0
        //private string _Djh = "";

        //public string Djh
        //{
        //    get { return _Djh; }
        //    set
        //    {
        //        if (_Djh != value)
        //        {
        //            _Djh = value;
        //            RaisePropertyChanged("Djh");
        //        }
        //    }
        //}

        //private DateTime? _RegTime;

        //public DateTime? RegTime
        //{
        //    get { return _RegTime; }
        //    set
        //    {
        //        if (_RegTime != value)
        //        {
        //            _RegTime = value;
        //            RaisePropertyChanged("RegTime");
        //        }
        //    }
        //}

        //private string _RegUser = "";

        //public string RegUser
        //{
        //    get { return _RegUser; }
        //    set
        //    {
        //        if (_RegUser != value)
        //        {
        //            _RegUser = value;
        //            RaisePropertyChanged("RegUser");
        //        }
        //    }
        //}

        //private int _Status;

        //public int Status
        //{
        //    get { return _Status; }
        //    set
        //    {
        //        if (_Status != value)
        //        {
        //            _Status = value;
        //            RaisePropertyChanged("Status");
        //        }
        //    }
        //}

        //private int _IcType;

        //public int IcType
        //{
        //    get { return _IcType; }
        //    set
        //    {
        //        if (_IcType != value)
        //        {
        //            _IcType = value;
        //            RaisePropertyChanged("IcType");
        //        }
        //    }
        //}

        public static Tb_IC GetByICNo(string id)
        {
            DbEntityTable <Tb_IC> ds = new DbEntityTable <Tb_IC>();

            ds.LoadDataByWhere("ICNo=@ICNo", id);

            if (ds.Count > 0)
            {
                return(ds[0]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 18
0
        public static QC_NoticeDhdItem_View GetByIcNo(string icno)
        {
            DbEntityTable <QC_NoticeDhdItem_View> noticeDhd = new DbEntityTable <QC_NoticeDhdItem_View>();

            noticeDhd.LoadDataByWhere("icno=@icno and status = 0", icno);
            DbEntityTable <QC_NoticeDhdItem_View> noticeDhddui = new DbEntityTable <QC_NoticeDhdItem_View>();
            DbEntityTable <TB_TaskFlow>           tt           = new DbEntityTable <TB_TaskFlow>();

            for (int i = 0; i < noticeDhd.Count; i++)
            {
                bool chumen = false;
                tt.LoadDataByWhere("NoticeId=@NoticeId", noticeDhd[i].NoticeId);
                for (int j = 0; j < tt.Count; j++)
                {
                    if (tt[j].Result == "出门")
                    {
                        chumen = true;
                    }
                }
                if (chumen == false)
                {
                    noticeDhddui.Add(noticeDhd[i]);
                }
            }



            if (noticeDhddui.Count > 1)
            {
                QC_NoticeDhdItem_View noticeDhd1 = new QC_NoticeDhdItem_View();
                Xuanze dlg = new Xuanze(noticeDhddui);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    noticeDhd1 = dlg.SelectedDhdItem;
                }
                return(noticeDhd1);
            }


            else if (noticeDhddui.Count == 1)
            {
                return(noticeDhddui[0]);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 从视图读取集中计量火车信息,保存到QC_Sample_Veh表中
        /// </summary>
        public void initdata()
        {
            trainData = new DbEntityTable <View_train_to_sample>();
            trainData.LoadData();
            //没有数据时,返回
            if (trainData.Count < 1)
            {
                return;
            }
            DbEntityTable <QC_Sample_Veh> veh = new DbEntityTable <QC_Sample_Veh>();

            foreach (var item in trainData)
            {
                QC_Sample_Veh sample = new QC_Sample_Veh();
                //物流的主键
                sample.FetchPlace = item.matchid;
                //发站
                sample.zpdh = item.FAZHAN;
                //物料名称
                sample.rwdh        = item.WLMC;
                sample.VehNo       = item.CPH;
                sample.CardID      = item.HCPH;
                sample.begintime   = item.GROSSTIME;
                sample.SampleState = Xg.Lab.Sample.SampleState.初始状态;
                //加入noticebillid
                sample.NoticeBillId = System.Guid.NewGuid().ToString();
                sample.WLLX         = "火运";
                veh.Add(sample);
            }
            veh.Save();

            //trans_train_sample = new DbEntityTable<QC_Sample_Veh>();
            //foreach (var item in trainData)
            //{
            //    QC_Sample_Veh sample = new QC_Sample_Veh();
            //    sample.Sample_Veh_ID = item.matchid;
            //    sample.FAZHAN = item.FAZHAN;
            //    sample.WLMC = item.WLMC;
            //    sample.VehNo = item.CPH;
            //    sample.CardID = item.HCPH;
            //    sample.begintime = item.GROSSTIME.ToString("yyyy-MM-dd HH:mm:ss");
            //    sample.SampleState = Xg.Lab.Sample.SampleState.初始状态;
            //    trans_train_sample.Add(sample);

            //}
            //trans_train_sample.Save();
        }
Exemplo n.º 20
0
        public void jsdtgs1()
        {
            dtgs = 0;
            int fzcs = 0;
            //组抽样的
            DbEntityTable <cheshu> cheshucy = new DbEntityTable <cheshu>();

            cheshucy.LoadDataBySql("select SUPPLIERCODE as cj,MATCODE as wl,WPCODE as dd,COUNT(*) as num from QC_Sample_Veh where sample_mix_id=0 and sample_tbzd=1 and SampleState=@SampleState and WLLX='精粉' group by SUPPLIERCODE,MATCODE,WPCODE", SampleState.开始组批);
            foreach (var x in cheshucy)
            {
                dtgs = dtgs + x.num;
            }

            DbEntityTable <cheshu> cheshufl = new DbEntityTable <cheshu>();

            cheshufl.LoadDataBySql("select SUPPLIERCODE as cj,MATCODE as wl,WPCODE as dd,COUNT(*) as num from QC_Sample_Veh where sample_mix_id=0 and (sample_jy is null or sample_jy<>1) and sample_tbzd<>1 and SampleState=@SampleState and WLLX='精粉' group by SUPPLIERCODE,MATCODE,WPCODE", SampleState.开始组批);
            foreach (var x in cheshufl)
            {
                fzcs = 0;
                QC_Material matInfo = QC_Material.GetByCode(x.wl);
                if (matInfo != null)
                {
                    //  if (matInfo.InUse)
                    //  {

                    DbEntityTable <QC_MixRule> labrule = new DbEntityTable <QC_MixRule>();
                    labrule.LoadDataByWhere("MatNcId=@MatNcId and (CustCode=@CustCode or CustCode='' or CustCode is null) and VehNumber<=@VehNumber", matInfo.MatNcId, x.cj, x.num);
                    if (labrule.Count > 0)
                    {
                        if (labrule[0].PlanMixCount > 0)
                        {
                            fzcs = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(x.num) / labrule[0].PlanMixCount));
                        }
                    }
                    if (fzcs > 0)
                    {
                        dtgs = fzcs + dtgs;
                    }
                    else
                    {
                        dtgs = dtgs + Convert.ToInt32(Math.Ceiling(Convert.ToDouble(x.num) / matInfo.BatchNum));
                    }
                    //  }
                }
            }
        }
Exemplo n.º 21
0
        private void btnImportJudgeRule_Click(object sender, EventArgs e)
        {
            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                DbEntityTable <QC_QualityRule> rules = new DbEntityTable <QC_QualityRule>();
                DataTable dt = Xg.Tools.ExcelHelper.ImportExcelFile(this.openFileDialog1.FileName);
                DbEntityTable <QC_Material> mats = new DbEntityTable <QC_Material>();
                mats.LoadData();

                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    string matCode = dt.Rows[i][0].ToString().Trim();

                    var mat = from m in mats
                              where m.MatCode == matCode
                              select m;

                    QC_QualityRule rule = new QC_QualityRule();
                    rule.MatNcId      = mat.First <QC_Material>().MatNcId;
                    rule.LocalQcLevel = dt.Rows[i][2].ToString().Trim();
                    switch (rule.LocalQcLevel)
                    {
                    case "一级":
                        rule.RuleOrder = 1;
                        break;

                    case "二级":
                        rule.RuleOrder = 2;
                        break;

                    case "三级":
                        rule.RuleOrder = 3;
                        break;

                    default:
                        rule.RuleOrder = 4;
                        break;
                    }
                    string ruleContent = dt.Rows[i][3].ToString().Trim();
                    rule.RuleStr2Contents(ruleContent);
                    rule.QualityLevelID = "1001NC100000002GF3MN";
                    rules.Add(rule);
                }
                rules.Save();
            }
        }
Exemplo n.º 22
0
        public static QC_IC_Info FindByCardId(string cardId)
        {
            DbEntityTable <QC_IC_Info> table = new DbEntityTable <QC_IC_Info>();

            table.LoadDataByWhere("CardID=@CardID", cardId);
            if (table.Count == 1)
            {
                return(table[0]);
            }
            else if (table.Count > 1)
            {
                throw new Exception(string.Format("根据卡号:{0}找到多条记录,但是不允许出现这种情况", cardId));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 初始化火车皮号选择下拉框
        /// </summary>
        public void initcmbHCPH()
        {
            DbEntityTable <View_train> train_num = new DbEntityTable <View_train>();

            // train_num.LoadDataBySql("select distinct(cardid) from  QC_Sample_Veh where samplestate=@samplestate and wllx=@wllx", Xg.Lab.Sample.SampleState.初始状态,"火运");
            train_num.LoadDataBySql("select distinct(zpdh+'_'+rwdh) as cardid from  QC_Sample_Veh where samplestate=@samplestate and wllx=@wllx", Xg.Lab.Sample.SampleState.初始状态, "火运");
            cmbHCPH.DataSource = train_num;

            if (train_num.Count > 0)
            {
                cmbHCPH.SelectedIndex = 0;
            }
            else
            {
                cmbHCPH.Text = "";
                initHCgrid();
            }
        }
Exemplo n.º 24
0
        public void zupi()
        {
            //按厂家,地点,物料分类
            int dtmax = 0;

            //组抽样的
            DbEntityTable <cheshu> cheshucy = new DbEntityTable <cheshu>();

            cheshucy.LoadDataBySql("select SUPPLIERCODE as cj,MATCODE as wl,WPCODE as dd  from QC_Sample_Veh where sample_mix_id=0 and sample_tbzd=1 and SampleState=@SampleState and WLLX='精粉'", SampleState.开始组批);
            foreach (var x in cheshucy)
            {
                dtmax = 1;
                zupiduoche(x.cj, x.wl, x.dd, dtmax, "抽样");
            }

            DbEntityTable <cheshu> cheshufl = new DbEntityTable <cheshu>();

            cheshufl.LoadDataBySql("select SUPPLIERCODE as cj,MATCODE as wl,WPCODE as dd,COUNT(*) as num from QC_Sample_Veh where sample_mix_id=0 and (sample_jy is null or sample_jy<>1) and sample_tbzd<>1 and SampleState=@SampleState and WLLX='精粉' group by SUPPLIERCODE,MATCODE,WPCODE ", SampleState.开始组批);

            foreach (var x in cheshufl)
            {
                //判定是否有车数比较多

                QC_Material matInfo = QC_Material.GetByCode(x.wl);
                if (matInfo != null)
                {
//                    if (matInfo.InUse)
//                  {
                    dtmax = matInfo.BatchNum;
                    DbEntityTable <QC_MixRule> labrule = new DbEntityTable <QC_MixRule>();
                    labrule.LoadDataByWhere("MatNcId=@MatNcId and (CustCode=@CustCode or CustCode='' or CustCode is null) and VehNumber<=@VehNumber", matInfo.MatNcId, x.cj, x.num);
                    if (labrule.Count > 0)
                    {
                        if (labrule[0].PlanMixCount > 0)
                        {
                            dtmax = labrule[0].PlanMixCount;
                        }
                    }

                    //                  }
                }
                zupiduoche(x.cj, x.wl, x.dd, dtmax, "正常样");
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 查找留存样
        /// </summary>
        private void btnLoadVehData_Click(object sender, EventArgs e)
        {
            QC_Sample_Mix sample = null;
            DbEntityTable <QC_MixCheckGroup> mixCgrp = new DbEntityTable <QC_MixCheckGroup>();

            mixCgrp.LoadDataByWhere("main.StoreCode=@StoreCode", txtStoreCode.Text.Trim());
            if (mixCgrp.Count > 0)
            {
                sample = QC_Sample_Mix.GetByID(mixCgrp[0].Sample_Mix_ID);
            }
            if (sample != null)
            {
                currentData.CopyData(sample);
            }
            else
            {
                MessageBox.Show("没有找到");
            }
        }
Exemplo n.º 26
0
        public void LoadByMatNcId(string matNcId)
        {
            this.LoadDataByWhere("MATNCID=@MATNCID", matNcId);
            DbEntityTable <QC_MatCheckGroup_View> matCheckGroups = new DbEntityTable <QC_MatCheckGroup_View>();

            matCheckGroups.LoadDataByWhere("MATNCID=@MATNCID", matNcId);
            foreach (var item in matCheckGroups)
            {
                QC_MatCheckGroup gp = new QC_MatCheckGroup();
                gp.Id             = -1;
                gp.MatNcId        = matNcId;
                gp.CheckGroupCode = item.CheckGroupCode;
                gp.CheckGroupName = item.CheckGroupName;
                gp.CheckGroupType = item.CheckGroupType;
                gp.ShortWord      = item.ShortWord;
                gp.SetDataStateAsUnchanged();
                this.Add(gp);
            }
        }
Exemplo n.º 27
0
        public void HandleCardMessage(Device.CardReader device, string cardId)
        {
            CardID = cardId;

            DbEntityTable <QC_IC_Info> hycrds = new DbEntityTable <QC_IC_Info>();

            hycrds.LoadDataByWhere("CardID=@CardID and CardType=@CardType ", CardID, "CUT002");

            if (hycrds.Count == 0)
            {
                CardID           = "";
                label2.Text      = "该扣类型不对!";
                label2.ForeColor = Color.Red;
            }

            foreach (var qcic in hycrds)
            {
                if (qcic.SampleId == 0)
                {
                    label2.Text = System.DateTime.Now.ToString("HH:mm:ss") + "扫扣成功!";

                    label2.ForeColor = Color.Red;
                }
                else
                {
                    label2.Text      = "该扣已经使用!";
                    label2.ForeColor = Color.Red;
                    CardID           = "";
                }
            }



            //icCard.SampleId = 0;

            //IDbConnection conn = DbContext.GetDefaultConnection();
            //conn.Open();
            //IDbTransaction trans = conn.BeginTransaction();
            //icCard.Save(trans);
            //tempLab.Save(trans);
            //trans.Commit();
            //conn.Close();
        }
Exemplo n.º 28
0
        public static QC_Sample_Lab_Jy GetById(int id)
        {
            DbEntityTable <QC_Sample_Lab_Jy> table = new DbEntityTable <QC_Sample_Lab_Jy>();

            table.LoadInfo = "CheckVals";
            table.LoadDataByWhere("main.Sample_Lab_ID = @Sample_Lab_ID", id);
            if (table.Count == 1)
            {
                return(table[0]);
            }
            else if (table.Count > 1)
            {
                throw new Exception(string.Format("主键不唯一:{0}", id));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 29
0
        private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            int hand = e.RowHandle;

            if (hand < 0)
            {
                return;
            }
            QC_Sample_Mix mix = (QC_Sample_Mix)gridView1.GetRow(hand);
            DbEntityTable <QC_Sample_Mix> mixs = new DbEntityTable <QC_Sample_Mix>();

            mixs.LoadDataByWhere("main.SupplierCode=@SupplierCode and Month(main.Mix_Time)=@Mix_Time and Year(main.Mix_Time)=@year and main.MatCode=@MatCode order by Mix_Time", mix.SupplierCode, mix.Mix_Time.Value.Month, mix.Mix_Time.Value.Year, mix.MatCode);
            if (mixs.Count > 0)
            {
                if (mix.Sample_Mix_ID == mixs[0].Sample_Mix_ID)
                {
                    e.Appearance.ForeColor = Color.Red;
                }
            }
        }
Exemplo n.º 30
0
        public void CopyData(QC_Sample_Mix original)
        {
            head.MatPK   = original.MatPK;
            head.MatCode = original.MatCode;
            head.MatName = original.MatName;

            body2.Empty();
            DbEntityTable <QC_Sample_Value> orignalSample_CheckVals = new DbEntityTable <QC_Sample_Value>();

            orignalSample_CheckVals.LoadDataByWhere("Sample_Mix_ID=@Sample_Mix_ID", original.Sample_Mix_ID);
            foreach (var item in orignalSample_CheckVals)
            {
                QC_Sample_Value sv = new QC_Sample_Value();
                sv.Sample_Lab_ID = -1;
                sv.CheckItemNcId = item.CheckItemNcId;
                sv.CheckItemCode = item.CheckItemCode;
                sv.CheckItemName = item.CheckItemName;
                sv.CheckItemUnit = item.CheckItemUnit;
                sv.CheckUser     = item.CheckUser;
                sv.CheckTime     = item.CheckTime;
                body2.Add(sv);
            }
        }