Beispiel #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();
            }
        }
Beispiel #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();
        }
Beispiel #3
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);
        }
Beispiel #4
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();
        }
Beispiel #5
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);
            }
        }