Example #1
0
        private void FrmWorkshooGR_Load(object sender, EventArgs e)
        {
            RFID_15693.InitModule();

            if (!System.IO.File.Exists(CommonClass.Path))//如果文件不存在,表示首次打开程序,将扫描头未开启的常用条码保存在文件里面
            {
                List <string> listData = new List <string>();
                for (int k = 0; k < CommonClass.strCodeType.Length / 3; k++)
                {
                    if (CommonClass.strCodeType[k, 0, 0] != "Composite CC-A/B")//Composite CC-A/B默认不开启,所以不记录
                    {
                        listData.Add(CommonClass.strCodeType[k, 0, 0] + "," + CommonClass.strCodeType[k, 0, 1] + ",1");
                    }
                }
                CommonClass.SaveFile(CommonClass.Path, listData);
            }

            byte[]        by           = new byte[6];
            List <string> listCodeType = new List <string>();//得到上次保存的条码类型的数据

            CommonClass.ReadFile(CommonClass.Path, ref listCodeType);
            for (int k = 0; k < listCodeType.Count; k++)
            {
                byte[] data = BitConverter.GetBytes(Int32.Parse(listCodeType[k].Split(',')[1]));
                for (int t = 0; t < data.Length; t++)
                {
                    by[t] = data[t];
                }
                by[4] = 1;
                by[5] = 1;
                CommonClass.SoftDecoding_BarcodeType_OnOff(by, by.Length);
                System.Threading.Thread.Sleep(10);
            }
            byte[] data2 = BitConverter.GetBytes(716);
            byte[] by2   = new byte[] { 0, 0, 0, 0, 1, 0 };//402,2开启
            Array.Copy(data2, 0, by2, 0, 4);
            CommonClass.SoftDecoding_BarcodeType_OnOff(by2, by2.Length);

            //DataTable dt = FunPublic.GetDt("exec [dbo].[PDA_OSGoodsRecQuery] 'Vendor','','',''");
            //if (dt.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        cmbCardCode.Items.Add(dr["outsourcBP"].ToString() + "-" + dr["outsourcBPNM"].ToString());
            //    }
            //}
            if (model == "弹窗")
            {
                txtRFID2.Focus();
            }
        }
Example #2
0
        private void FrmDailyReport_Load(object sender, EventArgs e)
        {
            RFID_15693.InitModule();

            if (!System.IO.File.Exists(CommonClass.Path))//如果文件不存在,表示首次打开程序,将扫描头未开启的常用条码保存在文件里面
            {
                List <string> listData = new List <string>();
                for (int k = 0; k < CommonClass.strCodeType.Length / 3; k++)
                {
                    if (CommonClass.strCodeType[k, 0, 0] != "Composite CC-A/B")//Composite CC-A/B默认不开启,所以不记录
                    {
                        listData.Add(CommonClass.strCodeType[k, 0, 0] + "," + CommonClass.strCodeType[k, 0, 1] + ",1");
                    }
                }
                CommonClass.SaveFile(CommonClass.Path, listData);
            }

            byte[]        by           = new byte[6];
            List <string> listCodeType = new List <string>();//得到上次保存的条码类型的数据

            CommonClass.ReadFile(CommonClass.Path, ref listCodeType);
            for (int k = 0; k < listCodeType.Count; k++)
            {
                byte[] data = BitConverter.GetBytes(Int32.Parse(listCodeType[k].Split(',')[1]));
                for (int t = 0; t < data.Length; t++)
                {
                    by[t] = data[t];
                }
                by[4] = 1;
                by[5] = 1;
                CommonClass.SoftDecoding_BarcodeType_OnOff(by, by.Length);
                System.Threading.Thread.Sleep(10);
            }
            byte[] data2 = BitConverter.GetBytes(716);
            byte[] by2   = new byte[] { 0, 0, 0, 0, 1, 0 };//402,2开启
            Array.Copy(data2, 0, by2, 0, 4);
            CommonClass.SoftDecoding_BarcodeType_OnOff(by2, by2.Length);

            btnScan.Focus();
        }
Example #3
0
 private void FrmWorkshooGR_Closed(object sender, EventArgs e)
 {
     RFID_15693.freeMode();
     CommonClass.SoftDecoding_Deinit();
 }
Example #4
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];
            try
            {
                if (RFID_15693.ScanSingleTag(ref data))
                {
                    //CommonClass.PlaySound();
                }
                else
                {
                    MessageBox.Show("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区");
                    return;
                }

                string RFID_ID = RFID_15693.RFID_ID();

                if (RFID_ID == "")
                {
                    txtMappingCode.Text = "";
                    txtEBNum.Text       = "";
                    txtPackageCode.Text = "";
                    txtSN.Text          = "";
                    txtQuantity.Text    = "";
                    MessageBox.Show("刷卡失败!");
                }
                else
                {
                    int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

                    if (res == 0)
                    {
                        if (BitConverter.ToString(pszData, 11, 1) == "0B")
                        {//物料卡
                            if (!CommonClass.ValidateRFID(RFID_ID))
                            {
                                throw new Exception("此卡已经被回收!");
                            }
                            if (txtRFID1.Focused)
                            {
                                DataTable dt = FunPublic.GetDt("exec [PDA_MappingQuery] '" + RFID_ID + "','4','',''");
                                if (dt.Rows.Count > 0)
                                {
                                    DataRow[] dr = dt.Select("MappingCode='" + txtMappingCode.Text + "'");
                                    if (dr.Length > 0)
                                    {
                                        txtRFID1.Text = RFID_ID;
                                        if (txtRFID2.Text != "")
                                        {
                                            this.panel1.Visible = true;
                                        }
                                        else
                                        {
                                            txtRFID2.Focus();
                                            return;
                                        }
                                    }
                                    else if (dr.Length == 0 && txtMappingCode.Text == "")
                                    {
                                        txtRFID1.Text       = RFID_ID;
                                        txtMappingCode.Text = dt.Rows[0]["MappingCode"].ToString();
                                        txtEBNum.Text       = dt.Rows[0]["EBDOC"].ToString();
                                        txtPackageCode.Text = dt.Rows[0]["PackageCode"].ToString();
                                        txtSN.Text          = dt.Rows[0]["SN"].ToString();
                                        txtQuantity.Text    = dt.Rows[0]["Quantity"].ToString();
                                        if (txtRFID2.Text != "")
                                        {
                                            this.panel1.Visible = true;
                                        }
                                        else
                                        {
                                            txtRFID2.Focus();
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("无匹配!");
                                        return;
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("未做收货!");
                                    return;
                                }
                            }
                            if (txtRFID2.Focused)
                            {
                                DataTable dt = FunPublic.GetDt("exec [PDA_MappingQuery] '" + RFID_ID + "','5','',''");
                                if (dt.Rows.Count > 0)
                                {
                                    DataRow[] dr = dt.Select("MappingCode='" + txtMappingCode.Text + "'");
                                    if (dr.Length > 0)
                                    {
                                        txtRFID2.Text = RFID_ID;
                                        if (txtRFID1.Text != "")
                                        {
                                            this.panel1.Visible = true;
                                        }
                                        else
                                        {
                                            txtRFID1.Focus();
                                        }
                                    }
                                    else if (dr.Length == 0 && txtMappingCode.Text == "")
                                    {
                                        txtRFID2.Text       = RFID_ID;
                                        txtMappingCode.Text = dt.Rows[0]["MappingCode"].ToString();
                                        txtEBNum.Text       = dt.Rows[0]["EBDOC"].ToString();
                                        txtPackageCode.Text = dt.Rows[0]["PackageCode"].ToString();
                                        txtSN.Text          = dt.Rows[0]["SN"].ToString();
                                        txtQuantity.Text    = dt.Rows[0]["Quantity"].ToString();
                                        if (txtRFID1.Text != "")
                                        {
                                            this.panel1.Visible = true;
                                        }
                                        else
                                        {
                                            txtRFID1.Focus();
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("无匹配!");
                                        return;
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("未做收货!");
                                    return;
                                }
                            }
                        }
                        else if (BitConverter.ToString(pszData, 11, 1) == "0D")
                        {//员工卡
                            MessageBox.Show("请刷物料卡!");
                            return;
                        }
                        CommonClass.PlaySoundBeep();
                    }
                    else
                    {
                        txtRFID2.Text       = "";
                        txtMappingCode.Text = "";
                        txtEBNum.Text       = "";
                        txtPackageCode.Text = "";
                        txtSN.Text          = "";
                        txtQuantity.Text    = "";
                        MessageBox.Show("刷卡失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                txtRFID2.Text       = "";
                txtMappingCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                MessageBox.Show("刷卡失败!" + ex.Message);
            }
        }
Example #5
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];
            try
            {
                if (RFID_15693.ScanSingleTag(ref data))
                {
                    //CommonClass.PlaySound();
                }
                else
                {
                    MessageBox.Show("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区");
                    return;
                }

                string RFID_ID = RFID_15693.RFID_ID();

                if (RFID_ID == "")
                {
                    txtRFID.Text = "";
                    //cmbCardCode.Text = "";
                    txtEBNum.Text         = "";
                    txtPackageCode.Text   = "";
                    txtCSKU_CODE.Text     = "";
                    txtQuantity.Text      = "";
                    txtWORKSHOP_CODE.Text = "";
                    txtLastStep.Text      = "";
                    txtNextStep.Text      = "";
                    Type      = "";
                    BaseEntry = "";
                    MessageBox.Show("刷卡失败!");
                }
                else
                {
                    int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

                    if (res == 0)
                    {
                        if (BitConverter.ToString(pszData, 11, 1) == "0B")
                        {//物料卡
                            txtRFID.Text = RFID_ID;
                            if (!CommonClass.ValidateRFID(RFID_ID))
                            {
                                throw new Exception("此卡已经被回收!");
                            }
                            //查询13表
                            string    sql = @"SELECT  DocEntry,Doc1_LINE_ID,Doc11_LINE_ID,Doc12_LINE_ID,EBDOC,RFID_ID,MappingCode,PackageCode,PackagesQty,QtyinPackage,ProRtEntry,ProRtLine,SN,CSKU_CODE,CSKU_NAME,STEPCode,STEPName,Quantity,WORKSHOP_CODE,WORKSHOPSEQ,STEPSEQ,roumap,QtyofSize,Type,STEP_PRICE
FROM Doc_Prodcutpackage13 T WHERE T.RFID_ID='" + RFID_ID + "' order by STEPSEQ";
                            DataTable dt  = FunPublic.GetDt(sql);

                            if (dt.Rows.Count > 0)
                            {
                                Type      = dt.Rows[0]["Type"].ToString();
                                BaseEntry = dt.Rows[0]["DocEntry"].ToString();

                                txtEBNum.Text         = dt.Rows[0]["EBDOC"].ToString();
                                txtPackageCode.Text   = dt.Rows[0]["PackageCode"].ToString();
                                txtCSKU_CODE.Text     = dt.Rows[0]["CSKU_CODE"].ToString();
                                txtQuantity.Text      = dt.Rows[0]["QtyinPackage"].ToString();
                                txtWORKSHOP_CODE.Text = dt.Rows[0]["WORKSHOP_CODE"].ToString();
                                txtLastStep.Text      = dt.Rows[0]["STEPCode"].ToString();
                                DataTable dt1 = FunPublic.GetDt("select STEPCode from Doc_Prodcutpackage14 where RFID_ID='" + RFID_ID + "' and EBDOC = '" + dt.Rows[0]["EBDOC"].ToString() + "' and SN = '" + dt.Rows[0]["SN"].ToString() + "' order by STEPSEQ desc");
                                if (dt1.Rows.Count > 0)
                                {
                                    txtNextStep.Text = dt1.Rows[0]["STEPCode"].ToString();
                                }
                            }
                            else
                            {
                                txtEBNum.Text         = "";
                                txtPackageCode.Text   = "";
                                txtCSKU_CODE.Text     = "";
                                txtQuantity.Text      = "";
                                txtWORKSHOP_CODE.Text = "";
                                txtLastStep.Text      = "";
                                txtNextStep.Text      = "";
                                Type      = "";
                                BaseEntry = "";
                                MessageBox.Show("查不到明细!");
                                return;
                            }
                        }
                        else if (BitConverter.ToString(pszData, 11, 1) == "0D")
                        {//员工卡
                            MessageBox.Show("请刷物料卡!");
                            return;
                        }
                        CommonClass.PlaySoundBeep();
                    }
                    else
                    {
                        txtRFID.Text = "";
                        //cmbCardCode.Text = "";
                        txtEBNum.Text         = "";
                        txtPackageCode.Text   = "";
                        txtCSKU_CODE.Text     = "";
                        txtQuantity.Text      = "";
                        txtWORKSHOP_CODE.Text = "";
                        txtLastStep.Text      = "";
                        txtNextStep.Text      = "";
                        Type      = "";
                        BaseEntry = "";
                        MessageBox.Show("刷卡失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                txtRFID.Text = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text         = "";
                txtPackageCode.Text   = "";
                txtCSKU_CODE.Text     = "";
                txtQuantity.Text      = "";
                txtWORKSHOP_CODE.Text = "";
                txtLastStep.Text      = "";
                txtNextStep.Text      = "";
                Type      = "";
                BaseEntry = "";
                MessageBox.Show("刷卡失败!" + ex.Message);
            }
        }
Example #6
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];
            try
            {
                if (RFID_15693.ScanSingleTag(ref data))
                {
                    //CommonClass.PlaySound();
                }
                else
                {
                    MessageBox.Show("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区");
                    return;
                }

                string RFID_ID = RFID_15693.RFID_ID();

                if (RFID_ID == "")
                {
                    txtWORKSHOP_CODE.Text = "";
                    txtRFID.Text          = "";
                    //cmbCardCode.Text = "";
                    txtEBNum.Text       = "";
                    txtPackageCode.Text = "";
                    txtCSKU_CODE.Text   = "";
                    txtQuantity.Text    = "";
                    txtLastStep.Text    = "";
                    txtNextStep.Text    = "";
                    MessageBox.Show("刷卡失败!");
                }
                else
                {
                    int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

                    if (res == 0)
                    {
                        if (BitConverter.ToString(pszData, 11, 1) == "0B")
                        {//物料卡
                            txtRFID.Text = RFID_ID;
                            if (!CommonClass.ValidateRFID(RFID_ID))
                            {
                                throw new Exception("此卡已经被回收!");
                            }
                            string    DeviceName = FunPublic.GetDeviceName();
                            DataTable dt         = FunPublic.GetDt("exec [PDA_SearchPDAQuery] '" + RFID_ID + "'");
                            if (dt.Rows.Count > 0)
                            {
                                foreach (DataRow dr in dt.Rows)
                                {
                                    txtWORKSHOP_CODE.Text = dr["roumap"].ToString();
                                    txtEBNum.Text         = dr["EBDOC"].ToString();
                                    txtPackageCode.Text   = dr["PackageCode"].ToString();
                                    txtCSKU_CODE.Text     = dr["CSKU_CODE"].ToString();
                                    txtQuantity.Text      = dr["QtyinPackage"].ToString();
                                    txtLastStep.Text      = dr["txtLastStep"].ToString();
                                    txtNextStep.Text      = dr["txtNextStep"].ToString();
                                }
                            }
                            else
                            {
                                txtWORKSHOP_CODE.Text = "";
                                txtEBNum.Text         = "";
                                txtPackageCode.Text   = "";
                                txtCSKU_CODE.Text     = "";
                                txtQuantity.Text      = "";
                                txtLastStep.Text      = "";
                                txtNextStep.Text      = "";
                                //MessageBox.Show("此车间上无此包收货!");
                            }
                        }
                        else if (BitConverter.ToString(pszData, 11, 1) == "0D")
                        {//员工卡
                            MessageBox.Show("请刷物料卡!");
                            return;
                        }
                        CommonClass.PlaySoundBeep();
                    }
                    else
                    {
                        txtWORKSHOP_CODE.Text = "";
                        txtRFID.Text          = "";
                        //cmbCardCode.Text = "";
                        txtEBNum.Text       = "";
                        txtPackageCode.Text = "";
                        txtCSKU_CODE.Text   = "";
                        txtQuantity.Text    = "";
                        txtLastStep.Text    = "";
                        txtNextStep.Text    = "";
                        MessageBox.Show("刷卡失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                txtWORKSHOP_CODE.Text = "";
                txtRFID.Text          = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtCSKU_CODE.Text   = "";
                txtQuantity.Text    = "";
                txtLastStep.Text    = "";
                txtNextStep.Text    = "";
                MessageBox.Show("刷卡失败!" + ex.Message);
            }
        }
Example #7
0
 private void FrmDailyReport_Closed(object sender, EventArgs e)
 {
     RFID_15693.freeMode();
     CommonClass.SoftDecoding_Deinit();
 }
Example #8
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];
            try
            {
                if (RFID_15693.ScanSingleTag(ref data))
                {
                    //CommonClass.PlaySound();
                }
                else
                {
                    MessageBox.Show("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区");
                    return;
                }

                string RFID_ID = RFID_15693.RFID_ID();

                if (txtRFID_New.Focused == true)
                {//刷新卡
                    if (RFID_ID == "")
                    {
                        txtRFID_New.Text = "";
                        MessageBox.Show("刷卡失败!");
                    }
                    else
                    {
                        int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

                        if (res == 0)
                        {
                            if (BitConverter.ToString(pszData, 11, 1) == "0B")
                            {//物料卡
                             //txtRFID_New.Text = RFID_ID;

                                DataTable dt = FunPublic.GetDt("select * from Tm_RFID WHERE RFIDLUN = '" + RFID_ID + "' and STATUS = 'O'");
                                if (dt.Rows.Count == 0)
                                {
                                    MessageBox.Show("物料卡" + RFID_ID + "状态错误,请换一张卡!", "提示");
                                    return;
                                }

                                string DocEntry = FunPublic.GetDt("select isnull(max(DocEntry)+1,1) DocEntry from Doc_RejectPackage").Rows[0][0].ToString();

                                DataTable dt1 = new DataTable();
                                if ("B".Equals(cmbType.Text.Substring(0, 1)))
                                {
                                    dt1 = FunPublic.GetDt("select * from Doc_Prodcutpackage14 where RFID_ID = '" + txtRFID.Text + "' and EBDOC = '" + txtEBNum.Text + "' and CSKU_CODE = '" + txtCSKU_CODE.Text + "'");
                                }
                                else if ("A".Equals(cmbType.Text.Substring(0, 1)))
                                {
                                    dt1 = FunPublic.GetDt("select * from Doc_Prodcutpackage14 where RFID_ID = '" + txtRFID.Text + "' and EBDOC = '" + txtEBNum.Text + "' and CSKU_CODE = '" + txtCSKU_CODE.Text + @"' and STEPSEQ >= (
select STEPSEQ from Doc_Prodcutpackage14 where RFID_ID = '" + txtRFID.Text + "' and EBDOC = '" + txtEBNum.Text + "' and CSKU_CODE = '" + txtCSKU_CODE.Text + @"' and STEPCode = '" + cmbRejectStationf.Text.Substring(0, cmbRejectStationf.Text.IndexOf('-')) + "')");
                                }

                                List <string> sqlstrs = new List <string>();
                                sqlstrs.Add(@"INSERT INTO [Doc_RejectPackage]
           ([DocEntry],[DOC_DATE],[CREATED],[RFID_ID],[PackageCode],[CSKU_CODE],[CSKU_NAME],[QtyofReject],[RejectStation],[free],[RejectStationf],[Type],[RejectStaffCo],[RejectReson],[FACTORY_CODE],[EBDOC],[BaseEntry],[RFID_ID1],[STATUS]) VALUES(" + DocEntry + ",getdate(),'" + FunPublic.CurrentUser + "','" + txtRFID.Text + "','" + txtPackageCode.Text + "','" + txtCSKU_CODE.Text + "',''," + txtQuantity.Text + ",'" + cmbRejectStation.Text.Substring(0, cmbRejectStation.Text.IndexOf('-')) + "','" + cmbfree.Text.Substring(0, cmbfree.Text.IndexOf('-')) + "','" + cmbRejectStationf.Text.Substring(0, cmbRejectStationf.Text.IndexOf('-')) + "','" + cmbType.Text.Substring(0, cmbType.Text.IndexOf('-')) + "','','" + cmbReason.Text.Substring(0, cmbReason.Text.IndexOf('-')) + "',(select FACTORY_CODE from Tm_Station where ReaderCode = '" + FunPublic.GetDeviceName() + "'),'" + txtEBNum.Text + "',null,'" + RFID_ID + "','O')");

                                for (int i = 0; i < dt1.Rows.Count; i++)
                                {
                                    ListViewItem ListViewItem = listView1.Items[i];

                                    sqlstrs.Add(@"INSERT INTO [Doc_RejectPackage1]([DocEntry],[LINE_ID],[STEPCode],[STEPName],[STEP_PRICE],[STEP_PRICE_H],[Quantity],[WORKSHOP_CODE],[STEPSEQ],[IsFinish]) VALUES(" + DocEntry + "," + i + ",'" + ListViewItem.SubItems[2].Text + "','" + ListViewItem.SubItems[3].Text + "','" + ListViewItem.SubItems[7].Text + "','" + ListViewItem.SubItems[8].Text + "','" + ListViewItem.SubItems[4].Text + "','" + ListViewItem.SubItems[5].Text + "','" + ListViewItem.SubItems[6].Text + "','" + ListViewItem.SubItems[9].Text + "')");

                                    sqlstrs.Add(@"INSERT INTO [Doc_Prodcutpackage13]
                                                   ([DocEntry]
                                                   ,[Doc1_LINE_ID]
                                                   ,[Doc11_LINE_ID]
                                                   ,[Doc12_LINE_ID]
                                                   ,[RFID_ID]
                                                   ,[MappingCode]
                                                   ,[PackageCode]
                                                   ,[PackagesQty]
                                                   ,[QtyinPackage]
                                                   ,[ProRtEntry]
                                                   ,[ProRtLine]
                                                   ,[SN]
                                                   ,[CSKU_CODE]
                                                   ,[CSKU_NAME]
                                                   ,[STEPCode]
                                                   ,[STEPName]
                                                   ,[Quantity]
                                                   ,[WORKSHOP_CODE]
                                                   ,[WORKSHOPSEQ]
                                                   ,[STEPSEQ]
                                                   ,[roumap]
                                                   ,[EBDOC]
                                                   ,[QtyofSize],STEP_PRICE,Type,PLEntry,FACTORY_CODE,MODEL,C_COLOUR,B_COLOUR,QtyofSizePackage,ISFREESTEP,ISOPTION,KEYVALUE,EXPLAIN1,EXPLAIN)
                 VALUES('" + DocEntry + "','" + (i + 1) + "','','','" + RFID_ID + "','" + dt1.Rows[i]["MappingCode"].ToString() + "','" + dt1.Rows[i]["PackageCode"].ToString() + "'," + dt1.Rows[i]["PackagesQty"].ToString() + "," + dt1.Rows[i]["QtyinPackage"].ToString() + ",'" + dt1.Rows[i]["ProRtEntry"].ToString() + "','" + dt1.Rows[i]["ProRtLine"].ToString() + "'," + dt1.Rows[i]["SN"].ToString() + ",'" + dt1.Rows[i]["CSKU_CODE"].ToString() + "','" + dt1.Rows[i]["CSKU_NAME"].ToString() + "','" + dt1.Rows[i]["STEPCode"].ToString() + "','" + dt1.Rows[i]["STEPName"].ToString() + "'," + txtQuantity.Text + ",'" + dt1.Rows[i]["WORKSHOP_CODE"].ToString() + "'," + dt1.Rows[i]["WORKSHOPSEQ"].ToString() + "," + dt1.Rows[i]["STEPSEQ"].ToString() + ",'" + dt1.Rows[i]["roumap"].ToString() + "','" + dt1.Rows[i]["EBDOC"].ToString() + "','" + dt1.Rows[i]["QtyofSize"].ToString() + "'," + ListViewItem.SubItems[7].Text + ",(case when '" + dt1.Rows[i]["Type"].ToString() + "' = 'P' then 'RP' when '" + dt1.Rows[i]["Type"].ToString() + "' = 'S' then 'RS' end),'" + dt1.Rows[i]["PLEntry"].ToString() + "','" + dt1.Rows[i]["FACTORY_CODE"].ToString() + "','" + dt1.Rows[i]["MODEL"].ToString() + "','" + dt1.Rows[i]["C_COLOUR"].ToString() + "','" + dt1.Rows[i]["B_COLOUR"].ToString() + "','" + dt1.Rows[i]["QtyofSizePackage"].ToString() + "','" + dt1.Rows[i]["ISFREESTEP"].ToString() + "','" + dt1.Rows[i]["ISOPTION"].ToString() + "','" + dt1.Rows[i]["KEYVALUE"].ToString() + "','" + dt1.Rows[i]["EXPLAIN1"].ToString() + "','" + dt1.Rows[i]["EXPLAIN"].ToString() + "')");
                                    sqlstrs.Add(@"INSERT INTO [Doc_Prodcutpackage14]
                                                   ([DocEntry]
                                                   ,[Doc1_LINE_ID]
                                                   ,[Doc11_LINE_ID]
                                                   ,[Doc12_LINE_ID]
                                                   ,[RFID_ID]
                                                   ,[MappingCode]
                                                   ,[PackageCode]
                                                   ,[PackagesQty]
                                                   ,[QtyinPackage]
                                                   ,[ProRtEntry]
                                                   ,[ProRtLine]
                                                   ,[SN]
                                                   ,[CSKU_CODE]
                                                   ,[CSKU_NAME]
                                                   ,[STEPCode]
                                                   ,[STEPName]
                                                   ,[Quantity]
                                                   ,[WORKSHOP_CODE]
                                                   ,[WORKSHOPSEQ]
                                                   ,[STEPSEQ]
                                                   ,[roumap]
                                                   ,[EBDOC]
                                                   ,[QtyofSize],STEP_PRICE,Type,PLEntry,FACTORY_CODE,MODEL,C_COLOUR,B_COLOUR,QtyofSizePackage,ISFREESTEP,ISOPTION,KEYVALUE,EXPLAIN1,EXPLAIN)
                VALUES('" + DocEntry + "','" + (i + 1) + "','','','" + RFID_ID + "','" + dt1.Rows[i]["MappingCode"].ToString() + "','" + dt1.Rows[i]["PackageCode"].ToString() + "'," + dt1.Rows[i]["PackagesQty"].ToString() + "," + dt1.Rows[i]["QtyinPackage"].ToString() + ",'" + dt1.Rows[i]["ProRtEntry"].ToString() + "','" + dt1.Rows[i]["ProRtLine"].ToString() + "'," + dt1.Rows[i]["SN"].ToString() + ",'" + dt1.Rows[i]["CSKU_CODE"].ToString() + "','" + dt1.Rows[i]["CSKU_NAME"].ToString() + "','" + dt1.Rows[i]["STEPCode"].ToString() + "','" + dt1.Rows[i]["STEPName"].ToString() + "'," + txtQuantity.Text + ",'" + dt1.Rows[i]["WORKSHOP_CODE"].ToString() + "'," + dt1.Rows[i]["WORKSHOPSEQ"].ToString() + "," + dt1.Rows[i]["STEPSEQ"].ToString() + ",'" + dt1.Rows[i]["roumap"].ToString() + "','" + dt1.Rows[i]["EBDOC"].ToString() + "','" + dt1.Rows[i]["QtyofSize"].ToString() + "'," + ListViewItem.SubItems[7].Text + ",(case when '" + dt1.Rows[i]["Type"].ToString() + "' = 'P' then 'RP' when '" + dt1.Rows[i]["Type"].ToString() + "' = 'S' then 'RS' end),'" + dt1.Rows[i]["PLEntry"].ToString() + "','" + dt1.Rows[i]["FACTORY_CODE"].ToString() + "','" + dt1.Rows[i]["MODEL"].ToString() + "','" + dt1.Rows[i]["C_COLOUR"].ToString() + "','" + dt1.Rows[i]["B_COLOUR"].ToString() + "','" + dt1.Rows[i]["QtyofSizePackage"].ToString() + "','" + dt1.Rows[i]["ISFREESTEP"].ToString() + "','" + dt1.Rows[i]["ISOPTION"].ToString() + "','" + dt1.Rows[i]["KEYVALUE"].ToString() + "','" + dt1.Rows[i]["EXPLAIN1"].ToString() + "','" + dt1.Rows[i]["EXPLAIN"].ToString() + "')");
                                }
                                //更新RFID卡状态
                                sqlstrs.Add("update Tm_RFID set STATUS = 'F' where RFIDLUN = '" + RFID_ID + "' ");
                                sqlstrs.Add("update dbo.Doc_RejectPackage set RFID_ID1 = '" + RFID_ID + "',STATUS = 'T' where DocEntry = '" + DocEntry + "'");

                                //更新原来卡数量
                                sqlstrs.Add("update Doc_Prodcutpackage13 set QtyinPackage = QtyinPackage - " + txtQuantity.Text + " where RFID_ID = '" + txtRFID.Text + "' and EBDOC = '" + txtEBNum.Text + "' and CSKU_CODE = '" + txtCSKU_CODE.Text + "'");
                                sqlstrs.Add("delete from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + "' and EBDOC = '" + txtEBNum.Text + "' and CSKU_CODE = '" + txtCSKU_CODE.Text + "' and QtyinPackage = 0");
                                sqlstrs.Add("update Doc_Prodcutpackage14 set QtyinPackage = QtyinPackage - " + txtQuantity.Text + " where cast(DocEntry as nvarchar)+'#'+cast(Doc1_LINE_ID as nvarchar)+'#'+cast(Doc11_LINE_ID as nvarchar)+'#'+cast(Doc12_LINE_ID as nvarchar)+'#'+Type in (select cast(DocEntry as nvarchar)+'#'+cast(Doc1_LINE_ID as nvarchar)+'#'+cast(Doc11_LINE_ID as nvarchar)+'#'+cast(Doc12_LINE_ID as nvarchar)+'#'+Type from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + "' and EBDOC = '" + txtEBNum.Text + "' and CSKU_CODE = '" + txtCSKU_CODE.Text + "')");

                                result = FunPublic.RunSqls(sqlstrs);
                                if (result.Status == 1)
                                {
                                    //lueSTATUS.EditValue = "T";
                                    txtRFID_New.Text = RFID_ID;
                                }
                                else
                                {
                                    MessageBox.Show(result.Message, "提示");
                                }
                            }
                            else if (BitConverter.ToString(pszData, 11, 1) == "0D")
                            {//员工卡
                                MessageBox.Show("请刷物料卡!");
                                return;
                            }
                            CommonClass.PlaySoundBeep();
                        }
                        else
                        {
                            txtRFID_New.Text = "";
                            MessageBox.Show("刷卡失败!");
                        }
                    }
                }
                else
                {//刷旧卡
                    if (RFID_ID == "")
                    {
                        txtRFID.Text     = "";
                        cmbType.Text     = "";
                        txtQuantity.Text = "";
                        cmbfree.Text     = "";
                        cmbRejectStation.Items.Clear();
                        cmbRejectStation.Text = "";
                        cmbRejectStationf.Items.Clear();
                        cmbRejectStationf.Text = "";
                        cmbReason.Text         = "";
                        txtEBNum.Text          = "";
                        txtCSKU_CODE.Text      = "";
                        txtPackageCode.Text    = "";
                        listView1.Items.Clear();
                        MessageBox.Show("刷卡失败!");
                    }
                    else
                    {
                        txtRFID.Text     = "";
                        cmbType.Text     = "";
                        txtQuantity.Text = "";
                        cmbfree.Text     = "";
                        cmbRejectStation.Items.Clear();
                        cmbRejectStation.Text = "";
                        cmbRejectStationf.Items.Clear();
                        cmbRejectStationf.Text = "";
                        cmbReason.Text         = "";
                        txtEBNum.Text          = "";
                        txtCSKU_CODE.Text      = "";
                        txtPackageCode.Text    = "";
                        listView1.Items.Clear();

                        int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

                        if (res == 0)
                        {
                            if (BitConverter.ToString(pszData, 11, 1) == "0B")
                            {//物料卡
                                txtRFID.Text = RFID_ID;
                                string    DeviceName = FunPublic.GetDeviceName();
                                DataTable dt         = FunPublic.GetDt("select top 1 * from Doc_DailyReport where RFID_ID = '" + RFID_ID + "' and DOC_DATE >= DATEADD(YEAR,-1,GETDATE()) order by DOC_DATE desc");
                                if (dt.Rows.Count > 0)
                                {
                                    DataTable dt1 = FunPublic.GetDt("select STEPCode cd,STEPName nm,ID,StaffCode from Doc_DailyReport where RFID_ID = '" + RFID_ID + "' and EBDOC = '" + dt.Rows[0]["EBDOC"].ToString() + "' and SN = '" + dt.Rows[0]["SN"].ToString() + "' and PackageCode = '" + dt.Rows[0]["PackageCode"].ToString() + "'");

                                    for (int i = 0; i < dt1.Rows.Count; i++)
                                    {
                                        cmbRejectStation.Items.Add(dt1.Rows[i]["cd"].ToString() + "-" + dt1.Rows[i]["nm"].ToString());
                                        cmbRejectStationf.Items.Add(dt1.Rows[i]["cd"].ToString() + "-" + dt1.Rows[i]["nm"].ToString());
                                    }

                                    txtPackageCode.Text = dt.Rows[0]["PackageCode"].ToString();
                                    txtCSKU_CODE.Text   = dt.Rows[0]["CSKU_CODE"].ToString();
                                    txtEBNum.Text       = dt.Rows[0]["EBDOC"].ToString();
                                }
                                else
                                {
                                    MessageBox.Show("此包还没有完工工序!", "提示");
                                }
                            }
                            else if (BitConverter.ToString(pszData, 11, 1) == "0D")
                            {//员工卡
                                MessageBox.Show("请刷物料卡!");
                                return;
                            }
                            CommonClass.PlaySoundBeep();
                        }
                        else
                        {
                            txtRFID.Text     = "";
                            cmbType.Text     = "";
                            txtQuantity.Text = "";
                            cmbfree.Text     = "";
                            cmbRejectStation.Items.Clear();
                            cmbRejectStation.Text = "";
                            cmbRejectStationf.Items.Clear();
                            cmbRejectStationf.Text = "";
                            cmbReason.Text         = "";
                            txtEBNum.Text          = "";
                            txtCSKU_CODE.Text      = "";
                            txtPackageCode.Text    = "";
                            listView1.Items.Clear();
                            MessageBox.Show("刷卡失败!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                txtRFID.Text     = "";
                cmbType.Text     = "";
                txtQuantity.Text = "";
                cmbfree.Text     = "";
                cmbRejectStation.Items.Clear();
                cmbRejectStation.Text = "";
                cmbRejectStationf.Items.Clear();
                cmbRejectStationf.Text = "";
                cmbReason.Text         = "";
                txtEBNum.Text          = "";
                txtCSKU_CODE.Text      = "";
                txtPackageCode.Text    = "";
                listView1.Items.Clear();
                MessageBox.Show("刷卡失败!" + ex.Message);
            }
        }
Example #9
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];
            try
            {
                if (RFID_15693.ScanSingleTag(ref data))
                {
                    //CommonClass.PlaySound();
                }
                else
                {
                    MessageBox.Show("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区");
                    return;
                }

                string RFID_ID = RFID_15693.RFID_ID();

                if (RFID_ID == "")
                {
                    txtRFID.Text        = "";
                    txtEBNum.Text       = "";
                    txtPackageCode.Text = "";
                    txtSN.Text          = "";
                    txtQuantity.Text    = "";
                    cmbStep.Items.Clear();
                    cmbStep.Text = "";
                    MessageBox.Show("刷卡失败!");
                }
                else
                {
                    int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

                    if (res == 0)
                    {
                        if (BitConverter.ToString(pszData, 11, 1) == "0B")
                        {//物料卡
                            txtRFID.Text = RFID_ID;
                            if (!CommonClass.ValidateRFID(RFID_ID))
                            {
                                throw new Exception("此卡已经被回收!");
                            }
                            if (Convert.ToInt32(FunPublic.GetDt("select COUNT(distinct EBDOC) from Doc_Prodcutpackage13 where RFID_ID='" + RFID_ID + "'").Rows[0][0]) > 1)
                            {
                                MessageBox.Show("此卡存在多个EB单号,不能刷卡!");
                                return;
                            }
                            string    DeviceName = FunPublic.GetDeviceName();
                            DataTable dt         = FunPublic.GetDt("exec [PDA_DailyReportQuery] '" + RFID_ID + "','" + DeviceName.Substring(1, DeviceName.Length - 1) + "'");
                            if (dt.Rows.Count > 0)
                            {
                                cmbStep.Items.Clear();
                                foreach (DataRow dr in dt.Rows)
                                {
                                    txtEBNum.Text       = dr["EBDOC"].ToString();
                                    txtPackageCode.Text = dr["PackageCode"].ToString();
                                    txtSN.Text          = dr["SN"].ToString();
                                    txtQuantity.Text    = dr["QtyinPackage"].ToString();
                                    cmbStep.Items.Add(dr["STEPCode"].ToString() + "-" + dr["STEPName"].ToString());
                                    cmbStep.Text = dr["STEPCode"].ToString() + "-" + dr["STEPName"].ToString();
                                }
                            }
                            else
                            {
                                MessageBox.Show("此设备上无可选工序!");
                            }
                        }
                        else if (BitConverter.ToString(pszData, 11, 1) == "0D")
                        {//员工卡
                            txtStaff.Text = RFID_ID;
                        }
                        CommonClass.PlaySoundBeep();
                    }
                    else
                    {
                        txtRFID.Text        = "";
                        txtEBNum.Text       = "";
                        txtPackageCode.Text = "";
                        txtSN.Text          = "";
                        txtQuantity.Text    = "";
                        cmbStep.Items.Clear();
                        cmbStep.Text = "";
                        MessageBox.Show("刷卡失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                txtRFID.Text        = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                cmbStep.Items.Clear();
                cmbStep.Text = "";
                MessageBox.Show("刷卡失败!" + ex.Message);
            }
        }
Example #10
0
 private void FrmOSGoodsIssu_Closed(object sender, EventArgs e)
 {
     RFID_15693.freeMode();
     CommonClass.SoftDecoding_Deinit();
 }
Example #11
0
        private void FrmOSGoodsIssu_Load(object sender, EventArgs e)
        {
            RFID_15693.InitModule();

            if (!System.IO.File.Exists(CommonClass.Path))//如果文件不存在,表示首次打开程序,将扫描头未开启的常用条码保存在文件里面
            {
                List <string> listData = new List <string>();
                for (int k = 0; k < CommonClass.strCodeType.Length / 3; k++)
                {
                    if (CommonClass.strCodeType[k, 0, 0] != "Composite CC-A/B")//Composite CC-A/B默认不开启,所以不记录
                    {
                        listData.Add(CommonClass.strCodeType[k, 0, 0] + "," + CommonClass.strCodeType[k, 0, 1] + ",1");
                    }
                }
                CommonClass.SaveFile(CommonClass.Path, listData);
            }

            byte[]        by           = new byte[6];
            List <string> listCodeType = new List <string>();//得到上次保存的条码类型的数据

            CommonClass.ReadFile(CommonClass.Path, ref listCodeType);
            for (int k = 0; k < listCodeType.Count; k++)
            {
                byte[] data = BitConverter.GetBytes(Int32.Parse(listCodeType[k].Split(',')[1]));
                for (int t = 0; t < data.Length; t++)
                {
                    by[t] = data[t];
                }
                by[4] = 1;
                by[5] = 1;
                CommonClass.SoftDecoding_BarcodeType_OnOff(by, by.Length);
                System.Threading.Thread.Sleep(10);
            }
            byte[] data2 = BitConverter.GetBytes(716);
            byte[] by2   = new byte[] { 0, 0, 0, 0, 1, 0 };//402,2开启
            Array.Copy(data2, 0, by2, 0, 4);
            CommonClass.SoftDecoding_BarcodeType_OnOff(by2, by2.Length);


            DataTable dt = FunPublic.GetDt("exec [dbo].[PDA_OSGoodsIssuQuery] 'Vendor','','',''");

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    cmbCardCode.Items.Add(dr["outsourcBP"].ToString() + "-" + dr["outsourcBPNM"].ToString());
                }
            }
            ////校正宽度
            //int nWidth = 0, nTemp = 0;
            //Graphics g = cmbCardCode.CreateGraphics();
            //for (int i = 0; i < cmbCardCode.Items.Count; i++)
            //{
            //    nTemp = (int)g.MeasureString(cmbCardCode.Items[i].ToString(), cmbCardCode.Font).Width;
            //    if (nTemp > nWidth)
            //        nWidth = nTemp;
            //}
            //g.Dispose();
            //SendMessage(cmbCardCode.Handle, CB_SETDROPPEDWIDTH, nWidth, 0);

            btnScan.Focus();
        }
Example #12
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            if (cmbCardCode.Text == "")
            {
                MessageBox.Show("请先选择供应商!");
                return;
            }
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];
            try
            {
                if (RFID_15693.ScanSingleTag(ref data))
                {
                    //CommonClass.PlaySound();
                }
                else
                {
                    MessageBox.Show("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区");
                    return;
                }

                string RFID_ID = RFID_15693.RFID_ID();

                if (RFID_ID == "")
                {
                    txtRFID.Text = "";
                    //cmbCardCode.Text = "";
                    txtEBNum.Text       = "";
                    txtPackageCode.Text = "";
                    txtSN.Text          = "";
                    txtQuantity.Text    = "";
                    MessageBox.Show("刷卡失败!");
                }
                else
                {
                    int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

                    if (res == 0)
                    {
                        if (BitConverter.ToString(pszData, 11, 1) == "0B")
                        {//物料卡
                            txtRFID.Text = RFID_ID;
                            if (!CommonClass.ValidateRFID(RFID_ID))
                            {
                                throw new Exception("此卡已经被回收!");
                            }
                            string    DeviceName = FunPublic.GetDeviceName();
                            DataTable dt         = FunPublic.GetDt("exec [PDA_OSGoodsIssuQuery] 'RFID','" + RFID_ID + "','" + cmbCardCode.Text.Substring(0, cmbCardCode.Text.IndexOf('-')) + "',''");
                            if (dt.Rows.Count > 0)
                            {
                                foreach (DataRow dr in dt.Rows)
                                {
                                    txtEBNum.Text       = dr["EBDOC"].ToString();
                                    txtPackageCode.Text = dr["PackageCode"].ToString();
                                    txtSN.Text          = dr["SN"].ToString();
                                    txtQuantity.Text    = dr["QtyinPackage"].ToString();
                                }
                            }
                            else
                            {
                                txtEBNum.Text       = "";
                                txtPackageCode.Text = "";
                                txtSN.Text          = "";
                                txtQuantity.Text    = "";
                                MessageBox.Show("此供应商下无此包外发!");
                            }
                        }
                        else if (BitConverter.ToString(pszData, 11, 1) == "0D")
                        {//员工卡
                            MessageBox.Show("请刷物料卡!");
                            return;
                        }
                        CommonClass.PlaySoundBeep();
                    }
                    else
                    {
                        txtRFID.Text = "";
                        //cmbCardCode.Text = "";
                        txtEBNum.Text       = "";
                        txtPackageCode.Text = "";
                        txtSN.Text          = "";
                        txtQuantity.Text    = "";
                        MessageBox.Show("刷卡失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                txtRFID.Text = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                MessageBox.Show("刷卡失败!" + ex.Message);
            }
        }
Example #13
0
        //刷卡
        private void Scan()
        {
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];

            if (RFID_15693.ScanSingleTag(ref data))
            {
                //CommonClass.PlaySound();
            }
            else
            {
                throw new Exception("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区!");
            }
            string RFID_ID = RFID_15693.RFID_ID();

            if (RFID_ID == "")
            {
                throw new Exception("扫描失败,RFID号为空!");
            }
            int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

            if (res != 0)
            {
                throw new Exception("扫描失败,获取卡类型时出错!");
            }

            if (BitConverter.ToString(pszData, 11, 1) == "0B")//物料卡
            {
                if (!CommonClass.ValidateRFID(RFID_ID))
                {
                    throw new Exception("此卡已经被回收!");
                }
                string DeviceName = FunPublic.GetDeviceName();
                //判断PDA的车间类型是否满足条件
                DataTable workshop = FunPublic.GetDt("select WORKSHOP_CODE from dbo.Tm_Station t0 where ReaderCode = '" + DeviceName.Substring(1, DeviceName.Length - 1) + @"' and  TYPE ='P' AND WORKSHOP_CODE in (select * from dbo.Fun_SplitStr((select value from Ts_Config where [key] = 'MapingWorkShop'),'#'))");
                if (workshop.Rows.Count == 0)
                {
                    throw new Exception("车间不符,无法匹配");
                }
                if (txtRFID1.Text == "")
                {
                    txtRFID1.Text = RFID_ID;
                    DataTable dt = FunPublic.GetDt("exec [PDA_MappingQuery] '" + RFID_ID + "','1','',''");

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            txtRoumap1.Text     = dr["roumap"].ToString();
                            txtMappingCode.Text = dr["MappingCode"].ToString();
                            txtEBNum.Text       = dr["EBDOC"].ToString();
                            txtPackageCode.Text = dr["PackageCode"].ToString();
                            txtSN.Text          = dr["SN"].ToString();
                            txtQuantity.Text    = dr["QtyinPackage"].ToString();
                        }
                    }
                    else
                    {
                        throw new Exception("卡片没有可匹配的工序!");
                    }
                }
                else
                {
                    txtRFID2.Text = RFID_ID;
                    if (txtRFID1.Text == txtRFID2.Text)
                    {
                        txtRFID2.Text = "";
                        MessageBox.Show("相同卡不能匹配!");
                        return;
                    }
                    Mapping(DeviceName.Substring(1, DeviceName.Length - 1));
                }
            }
            else if (BitConverter.ToString(pszData, 11, 1) == "0D")//员工卡
            {
                throw new Exception("请刷物料卡!");
            }
            CommonClass.PlaySoundBeep();
        }
Example #14
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (cmbCardCode.Text == "")
            {
                MessageBox.Show("请选择供应商!");
                return;
            }
            if (txtRFID.Text == "")
            {
                MessageBox.Show("请刷物料卡!");
                return;
            }

            string        DeviceName = FunPublic.GetDeviceName();
            List <string> strSqls    = new List <string>();

            strSqls.Add(@"declare @MaxDoc as int
declare @DocEntry as int
select @MaxDoc = isnull(MAX(DocEntry),0) + 1 from Doc_OSGoodsRec
select @DocEntry = MIN(t0.DocEntry) from Doc_OSGoodsIssu t0 inner join Doc_OSGoodsIssu1 t1 on t0.DocEntry = t1.DocEntry and t0.STATUS = 'O' and t1.RFID_ID = '" + txtRFID.Text + @"' and t0.BPCode = '" + cmbCardCode.Text.Substring(0, cmbCardCode.Text.IndexOf('-')) + @"' and t1.LINESTATUS not in ('C','F')
insert into Doc_OSGoodsRec(DocEntry,DOC_DATE,BPCode,BPName,CREATED,STATUS,FACTORY_CODE,BaseEntry) select @MaxDoc,getdate(),BPCode,BPName,CREATED,'O',FACTORY_CODE,@DocEntry from Doc_OSGoodsIssu where DocEntry = @DocEntry
insert into Doc_OSGoodsRec1(DocEntry,LINE_ID,PONUM,EBDOC,PRODOC,CSKU_CODE,SN,CSKU_NAME,PackageCode,RFID_ID,Quantity,BaseEntry,BaseDoc1_Line,BaseDoc11_Line,BaseDoc12_Line,Type,STEPCode,STEPName,STEPSEQ,EXPLAIN1,GRQtyp,QtyofReject,QtyofRepair,MappingCode)
select @MaxDoc,LINE_ID,PONUM,EBDOC,PRODOC,CSKU_CODE,SN,CSKU_NAME,PackageCode,RFID_ID,Quantity,BaseEntry,BaseDoc1_Line,BaseDoc11_Line,BaseDoc12_Line,Type,STEPCode,STEPName,STEPSEQ,EXPLAIN1,GRQtyp,QtyofReject,QtyofRepair,MappingCode from Doc_OSGoodsIssu1 where DocEntry = @DocEntry
update Doc_OSGoodsIssu set STATUS = 'F' where DocEntry = @DocEntry
update Doc_OSGoodsIssu1 set LINESTATUS = 'F' where DocEntry = @DocEntry
if not exists(select * from Ts_Config where [Key] = 'BPCode' and Value = '" + cmbCardCode.Text.Substring(0, cmbCardCode.Text.IndexOf('-')) + @"')
begin
    update Doc_Prodcutpackage14 set STATUS = 'F' where cast(DocEntry as nvarchar)+'#'+cast(Doc1_LINE_ID as nvarchar)+'#'+cast(Doc11_LINE_ID as nvarchar)+'#'+cast(Doc12_LINE_ID as nvarchar)+'#'+cast(Type as nvarchar) in (select cast(BaseEntry as nvarchar)+'#'+cast(BaseDoc1_Line as nvarchar)+'#'+cast(BaseDoc11_Line as nvarchar)+'#'+cast(BaseDoc12_Line as nvarchar)+'#'+cast(Type as nvarchar) from Doc_OSGoodsIssu1 where DocEntry = @DocEntry ) and RFID_ID = '" + txtRFID.Text + @"'
end
            ");

            result = FunPublic.RunSqls(strSqls);
            if (result.Status == 1)
            {
                string RFID_ID = txtRFID.Text;

                //MessageBox.Show("提交成功!");
                txtRFID.Text = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";


                RFID_15693.freeMode();
                CommonClass.SoftDecoding_Deinit();

                DataTable dt = FunPublic.GetDt("exec [PDA_MappingQuery] '" + RFID_ID + "','4','',''");

                if (dt.Rows.Count > 0)
                {
                    FrmOSMapping FrmMapping = new FrmOSMapping();
                    FrmMapping.txtRFID1.Text       = RFID_ID;
                    FrmMapping.txtMappingCode.Text = dt.Rows[0]["MappingCode"].ToString();
                    FrmMapping.txtEBNum.Text       = dt.Rows[0]["EBDOC"].ToString();
                    FrmMapping.txtPackageCode.Text = dt.Rows[0]["PackageCode"].ToString();
                    FrmMapping.txtSN.Text          = dt.Rows[0]["SN"].ToString();
                    FrmMapping.txtQuantity.Text    = dt.Rows[0]["Quantity"].ToString();
                    FrmMapping.model = "弹窗";
                    FrmMapping.ShowDialog();
                    FrmMapping.txtRFID2.Focus();

                    CommonClass.SoftDecoding_Init();
                    CommonClass.SoftDecoding_Select_ScanMode();

                    CommonClass.CreaterDirectory(CommonClass.Path);
                    CommonClass.Path += "\\2D_S_CodeType.txt";//把保存的文件存放在当前目录的前目录的File文件夹

                    RFID_15693.InitModule();

                    if (!System.IO.File.Exists(CommonClass.Path))//如果文件不存在,表示首次打开程序,将扫描头未开启的常用条码保存在文件里面
                    {
                        List <string> listData = new List <string>();
                        for (int k = 0; k < CommonClass.strCodeType.Length / 3; k++)
                        {
                            if (CommonClass.strCodeType[k, 0, 0] != "Composite CC-A/B")//Composite CC-A/B默认不开启,所以不记录
                            {
                                listData.Add(CommonClass.strCodeType[k, 0, 0] + "," + CommonClass.strCodeType[k, 0, 1] + ",1");
                            }
                        }
                        CommonClass.SaveFile(CommonClass.Path, listData);
                    }

                    byte[]        by           = new byte[6];
                    List <string> listCodeType = new List <string>();//得到上次保存的条码类型的数据
                    CommonClass.ReadFile(CommonClass.Path, ref listCodeType);
                    for (int k = 0; k < listCodeType.Count; k++)
                    {
                        byte[] data = BitConverter.GetBytes(Int32.Parse(listCodeType[k].Split(',')[1]));
                        for (int t = 0; t < data.Length; t++)
                        {
                            by[t] = data[t];
                        }
                        by[4] = 1;
                        by[5] = 1;
                        CommonClass.SoftDecoding_BarcodeType_OnOff(by, by.Length);
                        System.Threading.Thread.Sleep(10);
                    }
                    byte[] data2 = BitConverter.GetBytes(716);
                    byte[] by2   = new byte[] { 0, 0, 0, 0, 1, 0 };//402,2开启
                    Array.Copy(data2, 0, by2, 0, 4);
                    CommonClass.SoftDecoding_BarcodeType_OnOff(by2, by2.Length);
                }
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
Example #15
0
        //刷卡
        private void Scan()
        {
            byte[] pszData = new byte[25];
            byte[] data    = new byte[1];

            if (RFID_15693.ScanSingleTag(ref data))
            {
            }
            else
            {
                throw new Exception("扫描失败,请确认是否是15693标签,并确认标签是否处于RFID感应区!");
            }

            string RFID_ID = RFID_15693.RFID_ID();

            if (RFID_ID == "")
            {
                throw new Exception("扫描失败,RFID号为空!");
            }
            int res = RFID_15693.RF_ISO15693_getSystemInformation(0, data, 0, pszData);

            if (res != 0)
            {
                throw new Exception("扫描失败,获取卡类型时出错!");
            }
            if (BitConverter.ToString(pszData, 11, 1) == "0B")//物料卡
            {
                txtRFID.Text = RFID_ID;
                if (!CommonClass.ValidateRFID(RFID_ID))
                {
                    throw new Exception("此卡已经被回收!");
                }
                string    DeviceName = FunPublic.GetDeviceName();
                DataTable dt         = FunPublic.GetDt("exec [PDA_WorkshopGRQuery] '" + RFID_ID + "','" + DeviceName.Substring(1, DeviceName.Length - 1) + "'");
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (FunPublic.GetDt(string.Format("select STEPCODE from Doc_prodcutPackage13 where EBDOC='{0}' and RFID_ID = '{1}' AND STEPSEQ <{2} ", dr["EBDOC"], RFID_ID, dr["STEPSEQ"])).Rows.Count > 1)
                        {
                            throw new Exception("此卡片还有没有完工的工序,不能收货!");
                        }
                        txtEBNum.Text       = dr["EBDOC"].ToString();
                        txtPackageCode.Text = dr["PackageCode"].ToString();
                        txtSN.Text          = dr["SN"].ToString();
                        txtQuantity.Text    = dr["QtyinPackage"].ToString();
                        cmbStep.Items.Add(dr["STEPCode"].ToString() + "-" + dr["STEPName"].ToString());
                        cmbStep.Text        = dr["STEPCode"].ToString() + "-" + dr["STEPName"].ToString();
                        txtMappingCode.Text = dr["MappingCode"].ToString();
                        txtRouMap.Text      = dr["roumap"].ToString();
                        txtRouMapName.Text  = dr["roumapName"].ToString();
                    }
                }
                else
                {
                    throw new Exception("此车间已收货!");
                }
            }
            else if (BitConverter.ToString(pszData, 11, 1) == "0D")//员工卡
            {
                txtStaff.Text = RFID_ID;
            }
            CommonClass.PlaySoundBeep();
        }
Example #16
0
        //匹配
        private bool Mapping(string DeviceName)
        {
            string strsql      = string.Empty;
            string rfid        = txtRFID.Text;
            string mappingcode = txtMappingCode.Text;
            string roumap      = txtRouMap.Text;

            //判断PDA的车间类型是否满足条件
            DataTable workshop = FunPublic.GetDt("select WORKSHOP_CODE from dbo.Tm_Station t0 where ReaderCode = '" + DeviceName + @"' and  TYPE ='P' AND WORKSHOP_CODE in
(select * from dbo.Fun_SplitStr((select value from Ts_Config where [key] = 'MapingWorkShop'),'#'))");

            if (workshop.Rows.Count == 0)
            {
                return(true);
            }
            if ("1007".Equals(workshop.Rows[0]["WORKSHOP_CODE"]))//收发室 1:主路线  5:内衬
            {
                if (txtRouMapName.Text == "主路线")
                {
                    strsql = "select *,roumapName= (select name from Tm_roumap where DocEntry = roumap) from Doc_WorkshopGR where NcMappingStatus ='N' AND STEPCode =(select value from Ts_Config where [KEY]='FMappinNC') AND MappingCode ='" + mappingcode + "' AND roumap ='5'";
                }
                else if (txtRouMapName.Text == "内衬路线")
                {
                    strsql = "select *,roumapName= (select name from Tm_roumap where DocEntry = roumap) from Doc_WorkshopGR where NcMappingStatus ='N' AND STEPCode =(select value from Ts_Config where [KEY]='FMappingMain') AND MappingCode ='" + mappingcode + "' AND roumap ='1'";
                }
                else
                {
                    return(false);
                }
            }
            else if ("1005".Equals(workshop.Rows[0]["WORKSHOP_CODE"]))//完成线
            {
                if (txtRouMapName.Text == "主路线")
                {
                    strsql = @"SELECT *,roumapName= (select name from Tm_roumap where DocEntry = roumap) FROM Doc_WorkshopGR 
                               WHERE MappingCode ='" + mappingcode + @"' 
                               AND 
                               ((MmMappingStatus ='N' AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMM') AND roumap = 2) 
                                OR 
                               (HdMappingStatus ='N' AND STEPCode in(select value from Ts_Config where [KEY]='SMappingHD') AND roumap = 7))";
                }
                else if (txtRouMapName.Text == "后带路线" || txtRouMapName.Text == "帽眉路线")
                {
                    strsql = @"SELECT *,roumapName= (select name from Tm_roumap where DocEntry = roumap) FROM Doc_WorkshopGR 
                               WHERE MappingCode ='" + mappingcode + @"' 
                               AND roumap = 1 AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMain') 
                               AND (MmMappingStatus ='N' OR HdMappingStatus ='N')";
                }
                else
                {
                    return(false);
                }
            }
            DataTable dt = FunPublic.GetDt(strsql);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(false);
            }

            #region 关闭扫描
            RFID_15693.freeMode();
            CommonClass.SoftDecoding_Deinit();
            #endregion

            FrmMapping FrmMapping = new FrmMapping();
            FrmMapping.txtRFID1.Text       = rfid;
            FrmMapping.txtRoumap1.Text     = txtRouMapName.Text;
            FrmMapping.txtMappingCode.Text = mappingcode;
            FrmMapping.txtEBNum.Text       = txtEBNum.Text;
            FrmMapping.txtPackageCode.Text = txtPackageCode.Text;
            FrmMapping.txtSN.Text          = txtSN.Text;
            FrmMapping.txtQuantity.Text    = txtQuantity.Text;
            FrmMapping.Text  = "配货 -" + dt.Rows[0]["roumapName"].ToString();
            FrmMapping.model = "弹窗";
            FrmMapping.ShowDialog();

            #region 开启扫描
            CommonClass.SoftDecoding_Init();
            CommonClass.SoftDecoding_Select_ScanMode();

            CommonClass.CreaterDirectory(CommonClass.Path);
            CommonClass.Path += "\\2D_S_CodeType.txt";//把保存的文件存放在当前目录的前目录的File文件夹

            RFID_15693.InitModule();

            if (!System.IO.File.Exists(CommonClass.Path))//如果文件不存在,表示首次打开程序,将扫描头未开启的常用条码保存在文件里面
            {
                List <string> listData = new List <string>();
                for (int k = 0; k < CommonClass.strCodeType.Length / 3; k++)
                {
                    if (CommonClass.strCodeType[k, 0, 0] != "Composite CC-A/B")//Composite CC-A/B默认不开启,所以不记录
                    {
                        listData.Add(CommonClass.strCodeType[k, 0, 0] + "," + CommonClass.strCodeType[k, 0, 1] + ",1");
                    }
                }
                CommonClass.SaveFile(CommonClass.Path, listData);
            }

            byte[]        by           = new byte[6];
            List <string> listCodeType = new List <string>();//得到上次保存的条码类型的数据
            CommonClass.ReadFile(CommonClass.Path, ref listCodeType);
            for (int k = 0; k < listCodeType.Count; k++)
            {
                byte[] data = BitConverter.GetBytes(Int32.Parse(listCodeType[k].Split(',')[1]));
                for (int t = 0; t < data.Length; t++)
                {
                    by[t] = data[t];
                }
                by[4] = 1;
                by[5] = 1;
                CommonClass.SoftDecoding_BarcodeType_OnOff(by, by.Length);
                System.Threading.Thread.Sleep(10);
            }
            byte[] data2 = BitConverter.GetBytes(716);
            byte[] by2   = new byte[] { 0, 0, 0, 0, 1, 0 };//402,2开启
            Array.Copy(data2, 0, by2, 0, 4);
            CommonClass.SoftDecoding_BarcodeType_OnOff(by2, by2.Length);
            #endregion
            return(true);
        }
Example #17
0
 private void FrmRejectPackage_Closed(object sender, EventArgs e)
 {
     RFID_15693.freeMode();
     CommonClass.SoftDecoding_Deinit();
 }