Exemple #1
0
        public void HandleCardMessage(Device.CardReader device, string cardId)
        {
            QC_IC_Info icCard = QC_IC_Info.FindByCardId(cardId);

            if (icCard == null)
            {
                MessageBox.Show("此卡未注册");
                return;
            }
            if (!icCard.CardType.StartsWith("CUT_"))
            {
                MessageBox.Show("磁扣类型不对");
                return;
            }
            if (icCard.SampleId <= 0)
            {
                MessageBox.Show("此卡没有业务信息");
                return;
            }

            QC_Sample_Lab_Jy tempLab = QC_Sample_Lab_Jy.GetById(icCard.SampleId);

            if (tempLab == null)
            {
                MessageBox.Show("没有找到单据"); return;
            }


            tempLab.JyCode = DbContext.GetSeq("JY" + DateTime.Now.Date.ToString("yyyyMMdd"), 2);

            tempLab.Billtype = "开始检验";
            tempLab.LabState = "开始检验";
            tempLab.JyUser   = LocalInfo.Current.user.ID;
            tempLab.JyTime   = DateTime.Now;

            icCard.SampleId = 0;

            IDbConnection conn = DbContext.GetDefaultConnection();

            conn.Open();
            IDbTransaction trans = conn.BeginTransaction();

            icCard.Save(trans);
            tempLab.Save(trans);
            trans.Commit();
            conn.Close();

            this.curLab = QC_Sample_Lab_Jy.GetById(tempLab.Sample_Lab_ID);
            lableiji.Add(curLab);

            DbContext.ExeSql("insert into QC_LabLog(zycode,jycode,jytime) values('" + this.curLab.StoreCode + "','" + this.curLab.JyCode + "',getDate())");
            labTable1.LoadDataByWhere("labstate='送检' and checkgroupname like '化验样%' and  maketime>=@maketime", DateTime.Today.AddDays(-1));
            //  labTable2.LoadDataByWhere("labstate='送检' and checkgroupname like '角质层%' and  maketime>=@maketime", DateTime.Today.AddDays(-1));
            label2.Text = labTable1.Count.ToString();
            //   label4.Text = labTable2.Count.ToString();
            SetGridViewFocuse();
            this.printDocument1.Print(); //自动打印
            //this.printPreviewDialog1.ShowDialog();
        }
Exemple #2
0
        /// <summary>
        /// 扫卡
        /// </summary>
        public void HandleCardMessage(Device.CardReader device, string cardId)
        {
            if (string.IsNullOrEmpty(curData.NoticeBillId))
            {
                MessageBox.Show(string.Format("请先添加车辆消息"));
                return;
            }
            QC_IC_Info card = QC_IC_Info.FindByCardId(cardId);

            if (card == null)
            {
                Tb_IC ic = Tb_IC.GetByICNo(cardId);
                if (ic != null)
                {
                    MessageBox.Show(string.Format("此卡为车辆卡"));
                    return;
                }
                else
                {
                    MessageBox.Show(string.Format("此卡没有注册"));
                    return;
                }
            }
            if (card.CardType != QC_IC_Info.CardUseType_Mix)
            {
                MessageBox.Show("卡的类型不对");
                return;
            }
            if (card.SampleId > 0)
            {
                MessageBox.Show("此卡正在使用");
                return;
            }
            if (!string.IsNullOrEmpty(curData.CardID))
            {
                MessageBox.Show("已关联磁卡");
                return;
            }
            if (curData.WLLX == "精粉" && card.RegUser != "陈至立")
            {
                MessageBox.Show("精粉取样,需要刷黄扣");

                return;
            }
            if (curData.WLLX == "煤" && card.RegUser != "赵贺朝")
            {
                MessageBox.Show("煤取样,需要刷红扣");

                return;
            }
            curData.FangTong_User = LocalInfo.Current.user.ID;
            curData.FangTong_Time = DateTime.Now;
            curData.CardID        = cardId;
            curData.SaveIcInfo    = true;
            curData.IcInfo        = card;
            btnUnBindCard.Visible = true;
        }
Exemple #3
0
        /// <summary>
        /// 注册磁扣信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnInsert_Click(object sender, EventArgs e)
        {
            string         cardId  = txtCardId.Text.Trim();
            QC_CardUseType useType = cmbCardType.SelectedItem as QC_CardUseType;

            if (useType == null)
            {
                MessageBox.Show("使用类型不能为空");
                return;
            }
            string cardType = useType.CUTCode;

            if (string.IsNullOrEmpty(cardId))
            {
                MessageBox.Show("卡号不能为空");
                return;
            }
            if (string.IsNullOrEmpty(cardType))
            {
                MessageBox.Show("使用类型不能为空");
                return;
            }

            QC_IC_Info card = QC_IC_Info.FindByCardId(txtCardId.Text.Trim());

            if (card != null)
            {
                MessageBox.Show(string.Format("卡号{0}已经注册,不能重复注册。", cardId));
                return;
            }

            QC_IC_Info icCard = new QC_IC_Info();

            icCard.CardID   = cardId;
            icCard.CardType = cardType;
            icCard.RegUser  = FrmMain.localinfo.user.Name;
            icCard.RegTime  = DateTime.Now;
            icCard.Save();

            icInfoDatas.Insert(0, icCard);
            txtCardId.Text = "";
            //if (this.cmbCardType.Properties.Items.Count > 0)
            //{
            //    cmbCardType.SelectedIndex = 0;
            //}
            // MessageBox.Show("注册完成");
        }
Exemple #4
0
        /// <summary>
        /// 处理读卡
        /// </summary>
        public void HandleCardMessage(Device.CardReader device, string cardId)
        {
            QC_IC_Info card = QC_IC_Info.FindByCardId(cardId);

            if (card == null)
            {
                Tb_IC ic = Tb_IC.GetByICNo(cardId);
                if (ic != null)
                {
                    MessageBox.Show(string.Format("此卡为车辆卡"));
                    return;
                }
                else
                {
                    MessageBox.Show(string.Format("此卡没有注册"));
                    return;
                }
            }
            if (card.CardType != QC_IC_Info.CardUseType_Veh)
            {
                MessageBox.Show("卡的类型不对");
                return;
            }
            if (card.SampleId > 0)
            {
                MessageBox.Show("此卡正在使用");
                return;
            }
            foreach (var item in currentData.VehSamples)
            {
                if (item.CardID == cardId)
                {
                    MessageBox.Show("此卡已关联" + item.TempID + "号");
                    return;
                }
            }
            QC_Sample_Veh vsam = new QC_Sample_Veh();

            vsam.CardID     = cardId;
            vsam.TempID     = currentData.VehSamples.Count + 1;
            vsam.FetchTime  = DateTime.Now;
            vsam.IcInfo     = card;
            vsam.SaveIcInfo = true;
            vsam.SampleType = SampleType.校验样;
            vsam.Sample_JY  = true;
            currentData.VehSamples.Add(vsam);
        }
Exemple #5
0
        /// <summary>
        /// 扫卡
        /// </summary>
        public void HandleCardMessage(Device.CardReader device, string cardId)
        {
            if (curData.MainSampleMixId == 0)
            {
                MessageBox.Show(string.Format("请先获取留存样"));
                return;
            }

            QC_IC_Info card = QC_IC_Info.FindByCardId(cardId);

            if (card == null)
            {
                Tb_IC ic = Tb_IC.GetByICNo(cardId);
                if (ic != null)
                {
                    MessageBox.Show(string.Format("此卡为车辆卡"));
                    return;
                }
                else
                {
                    MessageBox.Show(string.Format("此卡没有注册"));
                    return;
                }
            }
            if (card.CardType != QC_IC_Info.CardUseType_Mix)
            {
                MessageBox.Show("卡的类型不对");
                return;
            }
            if (card.SampleId > 0)
            {
                MessageBox.Show("此卡正在使用");
                return;
            }
            if (!string.IsNullOrEmpty(curData.CardID))
            {
                MessageBox.Show("已关联磁卡");
                return;
            }
            curData.FangTong_User = LocalInfo.Current.user.ID;
            curData.FangTong_Time = DateTime.Now;
            curData.CardID        = cardId;
            curData.SaveIcInfo    = true;
            curData.IcInfo        = card;
            //   btnUnBindCard.Visible = true;
        }
Exemple #6
0
        /// <summary>
        /// 处理读卡
        /// </summary>
        public void HandleCardMessage(Device.CardReader device, string cardId)
        {
            QC_IC_Info card = QC_IC_Info.FindByCardId(cardId);

            if (card == null)
            {
                Tb_IC ic = Tb_IC.GetByICNo(cardId);
                if (ic != null)
                {
                    MessageBox.Show(string.Format("此卡为车辆卡"));
                    return;
                }
                else
                {
                    MessageBox.Show(string.Format("此卡没有注册"));
                    return;
                }
            }
            if (card.CardType != QC_IC_Info.CardUseType_Veh)
            {
                MessageBox.Show("卡的类型不对");
                return;
            }

            if (card.SampleId > 0)
            {
                MessageBox.Show("此卡正在使用");
                return;
            }

            if (!string.IsNullOrEmpty(curData.CardID))
            {
                MessageBox.Show("已经绑定磁卡");
                return;
            }

            curData.CardID        = cardId;
            curData.FetchTime     = DateTime.Now;
            curData.IcInfo        = card;
            btnUnBindCard.Visible = true;
        }
Exemple #7
0
        /// <summary>
        /// 刷卡
        /// </summary>
        public void HandleCardMessage(Device.CardReader device, string cardId)
        {
            QC_IC_Info icCard = QC_IC_Info.FindByCardId(cardId);

            if (icCard == null)
            {
                MessageBox.Show("此卡未注册");
                return;
            }
            if (icCard.CardType.StartsWith("CUT_"))
            {
                if (icCard.SampleId > 0)
                {
                    MessageBox.Show("此卡已绑定信息");
                    return;
                }
                if (curSelLab == null)
                {
                    MessageBox.Show("请先查询样品单号");
                    return;
                }
                if (curSelLab.CheckGroupType != "后续检验")
                {
                    MessageBox.Show("此样品单号不需要绑定磁卡");
                    return;
                }
                if (curSelLab.LabState != "制样")
                {
                    MessageBox.Show("此样品已绑定磁扣");
                    return;
                }

                string ckgCode = icCard.CardType.Substring(4);
                if (curSelLab.CheckGroupName.Contains("角质层"))
                {
                    if (ckgCode != "04" && ckgCode != "05")
                    {
                        MessageBox.Show("磁扣类型不对");
                        return;
                    }
                }
                else
                {
                    if (curSelLab.CheckGroupCode != ckgCode && !((curSelLab.CheckGroupCode == "14" || curSelLab.CheckGroupCode == "13") && (ckgCode == "04" || ckgCode == "05" || ckgCode == "14" || ckgCode == "13")))
                    {
                        MessageBox.Show("磁扣类型不对");
                        return;
                    }
                }

                QC_Sample_Lab tempLab = curSelLab;

                icCard.SampleId  = tempLab.Sample_Lab_ID;
                tempLab.CardId   = icCard.CardID;
                tempLab.MakeUser = LocalInfo.Current.user.ID;
                tempLab.MakeTime = DateTime.Now;
                tempLab.Billtype = "已扫样品扣";
                tempLab.LabState = "送检";
                tempLab.RefreshState();

                IDbConnection conn = DbContext.GetDefaultConnection();
                conn.Open();
                IDbTransaction trans = conn.BeginTransaction();
                tempLab.Save(trans);
                icCard.Save(trans);
                trans.Commit();
                conn.Close();

                //DbContext.ExeSql("update mix set mix.SampleState=4 from QC_SAMPLE_MIX mix where mix.SampleState=3 and not exists (select * from QC_SAMPLE_LAB t1 inner join QC_MIXCHECKGROUP t2 on t2.SAMPLE_LAB_ID= t1.SAMPLE_LAB_ID where t2.SAMPLE_MIX_ID=mix.SAMPLE_MIX_ID and t1.CheckGroupName!='水分样' and IsNull(t1.BILLTYPE,'')='未绑定样品扣')");
                lblLabMakeTime.Text = DateTime.Now.ToString("HH:mm:ss") + "完成刷卡";


                DlgZyInfo dlg = new DlgZyInfo(curSelLab.CheckGroupName, curSelLab.ShortStoreCode);

                dlg.ShowDialog();
            }
            else
            {
                MessageBox.Show("磁卡类型不对");
                return;
            }
        }