Exemple #1
0
        private void cmbType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string STEP_PRICE = "0";

            if (cmbfree.Text != "" && cmbType.Text != "")
            {
                if ("Y".Equals(cmbfree.Text.Substring(0, 1)))
                {
                    STEP_PRICE = "isnull(STEP_PRICE,0)";
                }
                else if ("N".Equals(cmbfree.Text.Substring(0, 1)))
                {
                    STEP_PRICE = "0";
                }

                if ("B".Equals(cmbType.Text.Substring(0, 1)))
                {
                    DataTable dt = FunPublic.GetDt("select null LINE_ID,STEPCode,STEPName,Quantity,WORKSHOP_CODE,STEPSEQ,case STATUS when 'T' then isnull(STEP_PRICE,0) else " + STEP_PRICE + " end as STEP_PRICE,isnull(STEP_PRICE,0) as STEP_PRICE_H,case STATUS when 'T' then 'N' else 'Y' end IsFinish from Doc_Prodcutpackage14 where RFID_ID = '" + txtRFID.Text + "' and EBDOC = '" + txtEBNum.Text + "' and CSKU_CODE = '" + txtCSKU_CODE.Text + "' order by STEPSEQ");

                    FunPublic.View_ListView(dt, listView1);

                    cmbRejectStationf.Enabled = false;
                }
                else if ("A".Equals(cmbType.Text.Substring(0, 1)))
                {
                    cmbRejectStationf.Enabled = true;
                    listView1.Items.Clear();
                }
            }
        }
Exemple #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (cmbCardCode.Text == "")
            {
                MessageBox.Show("请选择供应商!");
                return;
            }
            if (txtRFID.Text == "")
            {
                MessageBox.Show("请刷物料卡!");
                return;
            }
            if (txtEBNum.Text == "")
            {
                MessageBox.Show("此供应商下无此包外发!");
                return;
            }

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

            strSqls.Add(@"declare @MaxDoc as int
select @MaxDoc = isnull(MAX(DocEntry),0) + 1 from Doc_OSGoodsIssu

select t1.FACTORY_CODE,t1.PONUM,t1.EBDOC,t1.PRODOC,t0.CSKU_CODE,t0.SN,t0.CSKU_NAME,t0.PackageCode,t0.RFID_ID,t0.QtyinPackage,t0.DocEntry,t0.Doc1_LINE_ID,t0.Doc11_LINE_ID,t0.Doc12_LINE_ID,t0.STEPCode,t0.STEPName,t0.STEPSEQ,t4.EXPLAIN1,t0.MappingCode,t0.C_COLOUR,t0.B_COLOUR,t0.STEP_PRICE,t0.PackagesQty,t0.Type,t0.MODEL 
into #t1
from Doc_Prodcutpackage13 t0 inner join Doc_Prodcutpackage t1 on t0.DocEntry = t1.DocEntry
inner join Doc_Osplanning t2 on t0.PLEntry = t2.BaseEntry inner join Doc_Osplanning1 t3 on t2.DocEntry = t3.DocEntry and t0.CSKU_CODE = t3.CSKU_CODE inner join Doc_Osplanning11 t4 on t3.DocEntry = t4.DocEntry and t3.LINE_ID = t4.Doc1_LINE_ID and t4.STEPCode = t0.STEPCode
where t0.RFID_ID = '" + txtRFID.Text + @"' and t4.outsourcBP = '" + cmbCardCode.Text.Substring(0, cmbCardCode.Text.IndexOf('-')) + @"'
insert into Doc_OSGoodsIssu(DocEntry,DOC_DATE,BPCode,BPName,CREATED,STATUS,FACTORY_CODE) values(@MaxDoc,GETDATE(),'" + cmbCardCode.Text.Substring(0, cmbCardCode.Text.IndexOf('-')) + "','" + cmbCardCode.Text.Substring(cmbCardCode.Text.LastIndexOf("-") + 1) + "'," + FunPublic.CurrentUser + @",'O',(select distinct FACTORY_CODE from #t1))
insert into Doc_OSGoodsIssu1(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,C_COLOUR,B_COLOUR,STEP_PRICE,PackagesQty,MODEL)
select @MaxDoc,ROW_NUMBER() over(order by SN),PONUM,EBDOC,PRODOC,CSKU_CODE,SN,CSKU_NAME,PackageCode,RFID_ID,QtyinPackage,DocEntry,Doc1_LINE_ID,Doc11_LINE_ID,Doc12_LINE_ID,Type,STEPCode,STEPName,STEPSEQ,EXPLAIN1,0,0,0,MappingCode,C_COLOUR,B_COLOUR,STEP_PRICE,PackagesQty,MODEL from #t1 where STEPSEQ = (select MIN(STEPSEQ) from #t1)

delete from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + @"' and cast(DocEntry as nvarchar(30))+'#'+cast(Doc1_LINE_ID as nvarchar(30))+'#'+cast(Doc11_LINE_ID as nvarchar(30))+cast(Doc12_LINE_ID as nvarchar(30))
in (select cast(DocEntry as nvarchar(30))+'#'+cast(Doc1_LINE_ID as nvarchar(30))+'#'+cast(Doc11_LINE_ID as nvarchar(30))+cast(Doc12_LINE_ID as nvarchar(30)) from #t1)

drop table #t1
            ");
            strSqls.Add(@"declare @MaxDoc as int
select @MaxDoc = isnull(MAX(DocEntry),0) from Doc_OSGoodsIssu
declare @PlanningDoc as int
select @PlanningDoc = BaseEntry from Doc_Prodcutpackage where DocEntry = (select top 1 BaseEntry from Doc_OSGoodsIssu1 where DocEntry = @MaxDoc)
update Doc_Osplanning1 set FHQty = FHQty + " + txtQuantity.Text + " where DocEntry in (select DocEntry from Doc_Osplanning where BaseEntry = @PlanningDoc) and SN = '" + txtSN.Text + "'");
            result = FunPublic.RunSqls(strSqls);
            if (result.Status == 1)
            {
                //MessageBox.Show("提交成功!");
                txtRFID.Text = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
Exemple #3
0
        //扫描条码
        private void BarCode_Scan()
        {
            try
            {
                string RFID_ID = Barcode.scan();

                if (RFID_ID == "")
                {
                    throw new Exception("扫描失败,RFID号为空!");
                }
                if (RFID_ID.Substring(0, 1) == "2")//物料卡
                {
                    if (!CommonClass.ValidateRFID(RFID_ID))
                    {
                        throw new Exception("此卡已经被回收!");
                    }
                    txtRFID.Text = RFID_ID;
                    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)
                        {
                            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 (RFID_ID.Substring(0, 1) == "1")
                {//员工卡
                    txtStaff.Text = RFID_ID;
                }
                CommonClass.PlaySoundBeep();
            }
            catch (Exception ex)
            {
                txtRFID.Text        = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                cmbStep.Items.Clear();
                cmbStep.Text = "";
                MessageBox.Show(ex.Message);
            }
        }
Exemple #4
0
        /// <summary>
        /// 判断RFID卡是否有效
        /// </summary>
        /// <param name="rfid">要校验的RFID</param>
        public static bool ValidateRFID(String rfid)
        {
            DataTable dt = FunPublic.GetDt(string.Format("select * from Tm_RFID where STATUS = 'F' and RFIDLUN = '{0}'", rfid));

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Exemple #5
0
 private void FrmPDALogin_Load(object sender, EventArgs e)
 {
     serverDT = FunPublic.LoadServerXml("Server");
     foreach (DataRow dr in serverDT.Rows)
     {
         cmbServer.Items.Add(dr[0]);
     }
     cmbServer.SelectedIndex = 0;
     //FunPublic.url = serverDT.Rows[0][1].ToString();
     txtUserCode.Focus();
 }
Exemple #6
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtRFID1.Text == "" || txtRFID2.Text == "")
            {
                MessageBox.Show("请刷物料卡!");
                return;
            }
            List <string> strSqls = new List <string>();

            strSqls.Add(@"update t0 set t0.OsMappingStatus='Y' from Doc_WorkshopGR t0 inner join (
		select Result as STEPCode from dbo.Fun_SplitStr((select Value from Ts_Config where [Key] = 'MappingOs'),'#')
		) t1 on t0.STEPCode = t1.STEPCode where t0.MappingCode = '"         + txtMappingCode.Text + "' and t0.RFID_ID='" + txtRFID1.Text + "'");
            strSqls.Add(@"update t0 set t0.OsMappingStatus='Y' from Doc_WorkshopGR t0 inner join (
		select Result as STEPCode from dbo.Fun_SplitStr((select Value from Ts_Config where [Key] = 'MappingOs'),'#')
		) t1 on t0.STEPCode = t1.STEPCode where t0.MappingCode = '"         + txtMappingCode.Text + "' and t0.RFID_ID='" + txtRFID2.Text + "'");
            strSqls.Add(@"update t0 set MappingStatus = 'Y' from Doc_OSGoodsIssu1 t0 where DocEntry =(SELECT MAX(DocEntry) FROM Doc_OSGoodsIssu1 WHERE LINESTATUS='F' AND RFID_ID='" + txtRFID1.Text + "')");
            strSqls.Add(@"update t0 set MappingStatus = 'Y' from Doc_OSGoodsIssu1 t0 where DocEntry =(SELECT MAX(DocEntry) FROM Doc_OSGoodsIssu1 WHERE LINESTATUS='F' AND RFID_ID='" + txtRFID2.Text + "')");
            //回收卡

            string sql = @"if not exists(select count(1) from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID1.Text + @"'
and not exists(select count(1) from Doc_OSGoodsIssu1 where RFID_ID='" + txtRFID1.Text + @"' and LINESTATUS ='O') and NOT EXISTS(
select count(1) from Doc_OSGoodsIssu1 where LINESTATUS = 'F' AND ISNULL(MappingStatus,'N')='N' AND RFID_ID ='" + txtRFID1.Text + @"'))
	begin
    update Tm_RFID set STATUS = 'O' where RFIDLUN = '" + txtRFID1.Text + @"'
    declare @MaxDoc as int
select @MaxDoc = isnull(max(DocEntry) + 1,1) from Doc_recRFID
INSERT INTO [Doc_recRFID]([DocEntry],[CREATED],[DOC_DATE],[EBDOC],[SN],[PackageCode],[RFID_ID],[roumap])
select top 1 @MaxDoc,'" + FunPublic.CurrentUser + "',getdate(),'" + txtEBNum.Text + "','" + txtSN.Text + "','" + txtPackageCode.Text + "','" + txtRFID1.Text + "',roumap from Doc_Prodcutpackage14 where RFID_ID='" + txtRFID1.Text + "' and EBDOC='" + txtEBNum.Text + @"' and MappingCode = '" + txtMappingCode.Text + @"'
    end";

            strSqls.Add(sql);


            result = FunPublic.RunSqls(strSqls);
            if (result.Status == 1)
            {
                txtRFID1.Text       = "";
                txtRFID2.Text       = "";
                txtMappingCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                if ("弹窗".Equals(model))
                {
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show(result.Message);
            }
            this.panel1.Visible = false;
        }
Exemple #7
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtRFID.Text == "")
            {
                MessageBox.Show("请刷物料卡!");
                return;
            }
            if (cmbStatus.Text != "是")
            {
                MessageBox.Show("还有未完工工序,卡片不能回收!");
                return;
            }
            if (FunPublic.GetDt("select * from Tm_RFID where RFIDLUN = '" + txtRFID.Text + "' and [STATUS] <> 'F'").Rows.Count > 0)
            {
                MessageBox.Show("卡片状态异常,不能回收!");
                return;
            }

            //DataTable dt = FunPublic.GetDtSap("select firstName from OHEM where U_rfid = '" + txtRoumap.Text + "'");
            //string DeviceName = FunPublic.GetDeviceName();
            List <string> strSqls = new List <string>();

            strSqls.Add(@"
declare @MaxDoc as int
select @MaxDoc = isnull(max(DocEntry) + 1,1) from Doc_recRFID
INSERT INTO [Doc_recRFID]
           ([DocEntry]
           ,[CREATED]
           ,[DOC_DATE]
           ,[EBDOC]
           ,[SN]
           ,[PackageCode]
           ,[RFID_ID]
           ,[roumap])
     VALUES(@MaxDoc,'" + FunPublic.CurrentUser + "',getdate(),'" + txtEBNum.Text + "','" + txtSN.Text + "','" + txtPackageCode.Text + "','" + txtRFID.Text + "','" + txtRoumap.Text + "')");
            strSqls.Add("update Tm_RFID set STATUS = 'O' where RFIDLUN = '" + txtRFID.Text + "'");
            result = FunPublic.RunSqls(strSqls);
            if (result.Status == 1)
            {
                //MessageBox.Show("提交成功!");
                txtRoumap.Text = "";
                txtRFID.Text   = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                cmbStatus.Text      = "";
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
Exemple #8
0
        private void FrmRejectPackage_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_RejectPackageQuery] 'RejectReas','','',''");

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    cmbReason.Items.Add(dr["Code"].ToString() + "-" + dr["Name"].ToString());
                }
            }

            btnScan.Focus();
        }
Exemple #9
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtStaff.Text == "")
            {
                MessageBox.Show("请刷员工卡!");
                return;
            }
            if (txtRFID.Text == "")
            {
                MessageBox.Show("请刷物料卡!");
                return;
            }
            if (cmbStep.Text == "")
            {
                MessageBox.Show("请选择工序!");
                return;
            }
            DataTable     dt         = FunPublic.GetDt("select firstName from OHEM where U_rfid = '" + txtStaff.Text + "'");
            string        DeviceName = FunPublic.GetDeviceName();
            List <string> strSqls    = new List <string>();

            strSqls.Add("insert into Doc_DailyReport([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],[StaffCode],[StationCode],[DOC_DATE],[QtyofReject],[QtyofRepair],[StaffName],[Type],STEP_PRICE,MODEL,C_COLOUR,B_COLOUR,ISFREESTEP,ISOPTION) 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],'" + txtStaff.Text.Substring(6, 4) + "','" + DeviceName.Substring(1, DeviceName.Length - 1) + "',getdate(),0,0,'" + dt.Rows[0][0].ToString() + "',[Type],STEP_PRICE,MODEL,C_COLOUR,B_COLOUR,ISFREESTEP,ISOPTION from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + "' and STEPCode = '" + cmbStep.Text.Substring(0, cmbStep.Text.IndexOf('-')) + "'");
            strSqls.Add("delete from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + "' and STEPCode = '" + cmbStep.Text.Substring(0, cmbStep.Text.IndexOf('-')) + "'");
            strSqls.Add("update Doc_Prodcutpackage14 set STATUS = 'F' where RFID_ID = '" + txtRFID.Text + "' and STEPCode = '" + cmbStep.Text.Substring(0, cmbStep.Text.IndexOf('-')) + "'");
            result = FunPublic.RunSqls(strSqls);
            if (result.Status == 1)
            {
                //MessageBox.Show("提交成功!");
                txtRFID.Text        = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                cmbStep.Items.Clear();
                cmbStep.Text = "";
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
Exemple #10
0
        //回收卡(暂停使用)
        private void RecRFID()
        {
            DataTable dt2 = FunPublic.GetDt("exec [PDA_RecRFIDQuery] '" + txtRFID.Text + "'");

            if (dt2.Rows.Count > 0 && dt2.Rows[0]["Status"] == "是" && (dt2.Rows[0]["name"].ToString().Contains("帽眉") || dt2.Rows[0]["name"].ToString().Contains("后带")))
            {
                //回收卡
                List <string> strSqls = new List <string>();
                strSqls.Add(@"
                declare @MaxDoc as int
                select @MaxDoc = isnull(max(DocEntry) + 1,1) from Doc_recRFID
                INSERT INTO [Doc_recRFID]([DocEntry],[CREATED],[DOC_DATE],[EBDOC],[SN],[PackageCode],[RFID_ID],[roumap])
                     VALUES(@MaxDoc,'" + FunPublic.CurrentUser + "',getdate(),'" + txtEBNum.Text + "','" + txtSN.Text + "','" + txtPackageCode.Text + "','" + txtRFID.Text + "','" + dt2.Rows[0]["roumap"] + "')");
                strSqls.Add("update Tm_RFID set STATUS = 'O' where RFIDLUN = '" + txtRFID.Text + "'");
                result = FunPublic.RunSqls(strSqls);
                if (result.Status != 1)
                {
                    throw new Exception("回收卡出错:" + result.Message);
                }
            }
        }
Exemple #11
0
        //提交
        private bool Submit(string DeviceName)
        {
            //获取员工名称
            DataTable dt = FunPublic.GetDt("select firstName from OHEM where U_rfid = '" + txtStaff.Text + "'");
            //将信息写入车间收货表
            List <string> strSqls = new List <string>();

            strSqls.Add(@"insert into Doc_WorkshopGR([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],[StaffCode],[StationCode],[DOC_DATE],[QtyofReject],[QtyofRepair],[StaffName],FACTORY_CODE,Type,C_COLOUR,B_COLOUR,QtyofSizePackage) 
            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],'" + txtStaff.Text.Substring(6, 4) + "','" + DeviceName.Substring(1, DeviceName.Length - 1) + "',getdate(),0,0,'" + dt.Rows[0][0].ToString() + "',FACTORY_CODE,Type,C_COLOUR,B_COLOUR,QtyofSizePackage from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + "' and STEPCode = '" + cmbStep.Text.Substring(0, cmbStep.Text.IndexOf('-')) + "'");
            strSqls.Add("delete from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + "' and STEPCode = '" + cmbStep.Text.Substring(0, cmbStep.Text.IndexOf('-')) + "'");
            strSqls.Add("update Doc_Prodcutpackage14 set STATUS = 'F' where RFID_ID = '" + txtRFID.Text + "' and STEPCode = '" + cmbStep.Text.Substring(0, cmbStep.Text.IndexOf('-')) + "'");

            //回收卡
            if (FunPublic.GetDt("select Value from Ts_Config where [KEY] = 'WorkShopGRHS' and Value like '%" + txtRouMap.Text + "%'").Rows.Count > 0)
            {
                string sql = @"if not exists(select DocEntry from Doc_Prodcutpackage13 where RFID_ID = '" + txtRFID.Text + @"')
                begin
                update Tm_RFID set STATUS = 'O' where RFIDLUN = '" + txtRFID.Text + @"'
                declare @MaxDoc as int
                select @MaxDoc = isnull(max(DocEntry) + 1,1) from Doc_recRFID
                INSERT INTO [Doc_recRFID]([DocEntry],[CREATED],[DOC_DATE],[EBDOC],[SN],[PackageCode],[RFID_ID],[roumap])
                select top 1 @MaxDoc,'" + FunPublic.CurrentUser + "',getdate(),'" + txtEBNum.Text + "','" + txtSN.Text + "','" + txtPackageCode.Text + "','" + txtRFID.Text + "',roumap from Doc_Prodcutpackage14 where RFID_ID='" + txtRFID.Text + "' and EBDOC='" + txtEBNum.Text + @"'
                end ";
                strSqls.Add(sql);
            }


            result = FunPublic.RunSqls(strSqls);
            //提交成功
            if (result.Status == 1)
            {
                return(true);
            }
            else
            {
                throw new Exception(result.Message);
            }
        }
Exemple #12
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtStaff.Text == "")
     {
         MessageBox.Show("请刷员工卡!");
         return;
     }
     if (txtRFID.Text == "")
     {
         MessageBox.Show("请刷物料卡!");
         return;
     }
     try
     {
         //获取设备名称
         string DeviceName = FunPublic.GetDeviceName();
         //提交
         bool result = Submit(DeviceName);
         //提交成功尝试匹配
         if (result)
         {
             result = Mapping(DeviceName.Substring(1, DeviceName.Length - 1));
             //清空页面
             txtRFID.Text        = "";
             txtEBNum.Text       = "";
             txtPackageCode.Text = "";
             txtSN.Text          = "";
             txtQuantity.Text    = "";
             cmbStep.Items.Clear();
             cmbStep.Text = "";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #13
0
        /// <summary>
        /// 测试服务器端连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //private void button1_Click(object sender, EventArgs e)
        //{

        //    System.ServiceModel.Channels.Binding binding = ServiceBaseClient.CreateDefaultBinding();
        //    string remoteAddress = ServiceBaseClient.EndpointAddress.Uri.ToString();

        //    // Server IP Address
        //    //remoteAddress = remoteAddress.Replace("localhost", "10.16.172.204");
        //    EndpointAddress endpoint = new EndpointAddress(remoteAddress);
        //    ServiceBaseClient client = new ServiceBaseClient(binding, endpoint);
        //    try
        //    {
        //        //MessageBox.Show(client.Add(10, 20).ToString());
        //        DataTable dt = client.GetDt("select * from Ts_Config");
        //        MessageBox.Show(dt.Rows[0][0].ToString());
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //    }

        //    //PlatformServer.ServiceBase server = new PDA.PlatformServer.ServiceBase();

        //    //DataTable dt = server.GetDt("select * from Ts_Config");



        //}

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if ((txtUserCode.Text == "" || txtPassword.Text == ""))
            {
                MessageBox.Show("请输入用户编号和密码!");
                return;
            }
            string    strSql = string.Format("SELECT OrgId,UserId FROM Core_User WHERE UserId='{0}' and Pwd='{1}' and DropFlag<>1", txtUserCode.Text, txtPassword.Text);
            DataTable dt     = FunPublic.GetDt(strSql);

            if (dt.TableName == "Error")
            {
                MessageBox.Show(dt.Rows[0][0].ToString(), "提示");
                return;
            }
            if (dt != null && dt.Rows.Count <= 0)
            {
                MessageBox.Show("用户错误", "提示");
                return;
            }
            FunPublic.CurrentUser = txtUserCode.Text;
            this.DialogResult     = DialogResult.OK;
            this.Close();
        }
Exemple #14
0
        //提交
        private void Submit(string DeviceName, ref List <string> strSqls)
        {
            //获取车间类型
            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)
            {
                throw new Exception("车间不符,无法匹配");
            }

            if ("1007".Equals(workshop.Rows[0]["WORKSHOP_CODE"]))//收发室 1:主路线  5:内衬
            {
                if (txtRoumap1.Text == "主路线")
                {
                    strSqls.Add("update Doc_WorkshopGR set NcMappingStatus ='Y' where NcMappingStatus ='N' AND RFID_ID ='" + txtRFID2.Text + "' AND STEPCode =(select value from Ts_Config where [KEY]='FMappinNC') AND MappingCode ='" + txtMappingCode.Text + "' AND roumap ='5'");
                    strSqls.Add("update Doc_WorkshopGR set NcMappingStatus ='Y' where NcMappingStatus ='N' AND RFID_ID ='" + txtRFID1.Text + "' AND STEPCode =(select value from Ts_Config where [KEY]='FMappingMain') AND MappingCode ='" + txtMappingCode.Text + "' AND roumap ='1'");
                }
                else if (txtRoumap1.Text == "内衬路线")
                {
                    strSqls.Add("update Doc_WorkshopGR set NcMappingStatus ='Y' where NcMappingStatus ='N' AND RFID_ID ='" + txtRFID2.Text + "' AND STEPCode =(select value from Ts_Config where [KEY]='FMappingMain') AND MappingCode ='" + txtMappingCode.Text + "' AND roumap ='1'");
                    strSqls.Add("update Doc_WorkshopGR set NcMappingStatus ='Y' where NcMappingStatus ='N' AND RFID_ID ='" + txtRFID1.Text + "' AND STEPCode =(select value from Ts_Config where [KEY]='FMappinNC') AND MappingCode ='" + txtMappingCode.Text + "' AND roumap ='5'");
                }
            }
            else if ("1005".Equals(workshop.Rows[0]["WORKSHOP_CODE"]))//完成线 1:主路线 2:帽眉  7:后带
            {
                if (txtRoumap1.Text == "主路线" && txtRoumap2.Text == "后带路线")
                {
                    strSqls.Add(@"update Doc_WorkshopGR set HdMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID2.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND HdMappingStatus ='N' AND STEPCode in(select value from Ts_Config where [KEY]='SMappingHD') AND roumap = 7");
                    strSqls.Add(@"update Doc_WorkshopGR set HdMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID1.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND roumap = 1 AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMain') 
                               AND HdMappingStatus ='N'");
                }
                else if (txtRoumap1.Text == "主路线" && txtRoumap2.Text == "帽眉路线")
                {
                    strSqls.Add(@"update Doc_WorkshopGR set MmMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID2.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND MmMappingStatus ='N' AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMM') AND roumap = 2");
                    strSqls.Add(@"update Doc_WorkshopGR set MmMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID1.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND roumap = 1 AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMain') 
                               AND MmMappingStatus ='N'");
                }
                else if (txtRoumap1.Text == "帽眉路线")
                {
                    strSqls.Add(@"update Doc_WorkshopGR set MmMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID2.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND roumap = 1 AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMain') 
                               AND MmMappingStatus ='N'");
                    strSqls.Add(@"update Doc_WorkshopGR set MmMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID1.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND MmMappingStatus ='N' AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMM') AND roumap = 2");
                }
                else if (txtRoumap1.Text == "后带路线")
                {
                    strSqls.Add(@"update Doc_WorkshopGR set HdMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID2.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND roumap = 1 AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMain') 
                               AND HdMappingStatus ='N'");
                    strSqls.Add(@"update Doc_WorkshopGR set HdMappingStatus ='Y'  
                               WHERE RFID_ID ='" + txtRFID1.Text + "' AND MappingCode ='" + txtMappingCode.Text + @"' 
                               AND HdMappingStatus ='N' AND STEPCode in(select value from Ts_Config where [KEY]='SMappingHD') AND roumap = 7");
                }
            }
        }
Exemple #15
0
        /// <summary>
        /// 扫描条码
        /// </summary>
        private void BarCode_Scan()
        {
            try
            {
                string RFID_ID = Barcode.scan();

                if (RFID_ID == "")
                {
                    txtMappingCode.Text = "";
                    txtEBNum.Text       = "";
                    txtPackageCode.Text = "";
                    txtSN.Text          = "";
                    txtQuantity.Text    = "";
                    MessageBox.Show("扫描失败!");
                }
                else
                {
                    if (RFID_ID.Substring(0, 1) == "2")
                    {//物料卡
                        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();
                                        return;
                                    }
                                }
                                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 (RFID_ID.Substring(0, 1) == "1")
                    {//员工卡
                        MessageBox.Show("请刷物料卡!");
                        return;
                    }
                    CommonClass.PlaySoundBeep();
                }
            }
            catch (Exception ex)
            {
                txtRFID2.Text       = "";
                txtMappingCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                MessageBox.Show("扫描失败!" + ex.Message);
            }
        }
Exemple #16
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);
            }
        }
Exemple #17
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtRFID.Text == "")
            {
                MessageBox.Show("请刷物料卡!");
                return;
            }
            string sql;

            //判断是半成品还是产成品
            if (Type.Equals("S") || Type.Equals("RS"))//半成品
            {
                sql = "SELECT DocEntry,FACTORY_CODE,STATUS,CREATED,DOC_DATE,PONUM,EBDOC,BaseEntry,PRODOC FROM Doc_SeGoodspackage WHERE DocEntry ='" + BaseEntry + "'";
            }
            else if (Type.Equals("P") || Type.Equals("RP"))//产成品
            {
                sql = "SELECT DocEntry,FACTORY_CODE,STATUS,CREATED,DOC_DATE,PONUM,EBDOC,BaseEntry,PRODOC FROM Doc_Prodcutpackage WHERE DocEntry ='" + BaseEntry + "'";
            }
            else
            {
                return;
            }

            List <string> strSqls = new List <string>();

            DataTable dt = FunPublic.GetDt(sql);

            strSqls.Add(@"declare @maxDoc as int
select @maxDoc=isnull(MAX(DocEntry) +1,1) from [Doc_Stop]
INSERT INTO [Doc_Stop]
           ([DocEntry]
           ,[FACTORY_CODE]
           ,[CREATED]
           ,[DOC_DATE]
           ,[PONUM]
           ,[EBDOC]
           ,[BaseEntry]
           ,[Type]
           ,[PRODOC])
     VALUES(@maxDoc,'" + dt.Rows[0]["FACTORY_CODE"].ToString() + "','" + FunPublic.CurrentUser + "',getdate(),'" + dt.Rows[0]["PONUM"].ToString() + "','" + txtEBNum.Text + "','" + dt.Rows[0]["DocEntry"].ToString() + "','" + Type + "','" + dt.Rows[0]["PRODOC"].ToString() + "')");
            //包号
            sql = "SELECT DISTINCT NULL AS LINE_ID,RFID_ID,PackageCode,PackagesQty,QtyinPackage,SN,CSKU_CODE,CSKU_NAME,roumap,QtyofSize FROM Doc_Prodcutpackage13 WHERE RFID_ID='" + txtRFID.Text + "' and Type='" + Type + "' and DocEntry ='" + BaseEntry + "'";
            DataTable list1 = FunPublic.GetDt(sql);

            strSqls.Add(@"declare @maxDoc as int
select @maxDoc=isnull(MAX(DocEntry),1) from [Doc_Stop]
INSERT INTO [Doc_Stop1]
           ([DocEntry]
           ,[LINE_ID]
           ,[BaseLine]
           ,[SN]
           ,[CSKU_CODE]
           ,[CSKU_NAME]
           ,[TotalQty]
           ,[RFID_ID]
           ,[PackageCode]
           ,[QtyinPackage],roumap)
     VALUES(@maxDoc,1,'','" + list1.Rows[0]["SN"].ToString() + "','" + list1.Rows[0]["CSKU_CODE"].ToString() + "','" + list1.Rows[0]["CSKU_NAME"].ToString() + "',null,'" + txtRFID.Text + "','" + list1.Rows[0]["PackageCode"].ToString() + "'," + list1.Rows[0]["QtyinPackage"].ToString() + ",'" + list1.Rows[0]["roumap"].ToString() + "')");
            //工序
            sql = "SELECT DISTINCT NULL AS LINE_ID,SN,CSKU_CODE,PackageCode,STEPCode,STEPName,Quantity,WORKSHOP_CODE,STEPSEQ AS SNofStep,STEP_PRICE FROM Doc_Prodcutpackage13  WHERE RFID_ID='" + txtRFID.Text + "' and Type='" + Type + "' and DocEntry ='" + BaseEntry + "'";
            DataTable list2 = FunPublic.GetDt(sql);

            for (int i = 0; i < list2.Rows.Count; i++)
            {
                strSqls.Add(@"declare @maxDoc as int
select @maxDoc=isnull(MAX(DocEntry),1) from [Doc_Stop]
INSERT INTO [Doc_Stop2]
               ([DocEntry]
               ,[LINE_ID]
               ,[SN]
               ,[CSKU_CODE]
               ,[RFID_ID]
               ,[PackageCode]
               ,[STEPCode]
               ,[STEPName]
               ,[STEP_PRICE]
               ,[Quantity]
               ,[SNofStep]
               ,[WORKSHOP_CODE])
         VALUES(@maxDoc," + (i + 1).ToString() + ",'" + list2.Rows[i]["SN"].ToString() + "','" + list2.Rows[i]["CSKU_CODE"].ToString() + "','" + txtRFID.Text + "','" + list2.Rows[i]["PackageCode"].ToString() + "','" + list2.Rows[i]["STEPCode"].ToString() + "','" + list2.Rows[i]["STEPName"].ToString() + "'," + list2.Rows[i]["STEP_PRICE"].ToString() + "," + list2.Rows[i]["Quantity"].ToString() + ",'" + list2.Rows[i]["SNofStep"].ToString() + "','" + list2.Rows[i]["WORKSHOP_CODE"].ToString() + "')");
            }
            //删除13表中数据
            strSqls.Add("DELETE Doc_Prodcutpackage13 WHERE RFID_ID='" + txtRFID.Text + "'");
            //更新14表中的状态
            strSqls.Add("UPDATE Doc_Prodcutpackage14 SET STATUS ='C' WHERE RFID_ID='" + txtRFID.Text + "' and Type='" + Type + "' and DocEntry ='" + BaseEntry + "' and isnull(STATUS,'T') = 'T'");
            //更新RFID卡的状态为O-待分配
            strSqls.Add("update Tm_RFID set STATUS = 'O' where RFIDLUN = '" + txtRFID.Text + "'");

            result = FunPublic.RunSqls(strSqls);
            if (result.Status == 1)
            {
                //MessageBox.Show("提交成功!");
                txtRFID.Text = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text         = "";
                txtPackageCode.Text   = "";
                txtCSKU_CODE.Text     = "";
                txtQuantity.Text      = "";
                txtWORKSHOP_CODE.Text = "";
                txtLastStep.Text      = "";
                txtNextStep.Text      = "";
                Type      = "";
                BaseEntry = "";
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
Exemple #18
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();
        }
Exemple #19
0
        /// <summary>
        /// 扫描条码
        /// </summary>
        private void BarCode_Scan()
        {
            try
            {
                string RFID_ID = Barcode.scan();

                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
                {
                    if (RFID_ID.Substring(0, 1) == "2")
                    {//物料卡
                        txtRFID.Text = RFID_ID;
                        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 (RFID_ID.Substring(0, 1) == "1")
                    {//员工卡
                        MessageBox.Show("请刷物料卡!");
                        return;
                    }
                    CommonClass.PlaySoundBeep();
                }
            }
            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);
            }
        }
Exemple #20
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtRFID1.Text == "" || txtRFID2.Text == "")
            {
                MessageBox.Show("请刷物料卡!");
                return;
            }
            try
            {
                string        DeviceName = FunPublic.GetDeviceName();
                List <string> strSqls    = new List <string>();
                //提交
                Submit(DeviceName.Substring(1, DeviceName.Length - 1), ref strSqls);

                //回收卡不包括主路线
                string rfid   = string.Empty;
                string roumap = string.Empty;
                if (txtRoumap1.Text != "主路线")
                {
                    rfid   = txtRFID1.Text;
                    roumap = txtRoumap1.Text;
                }
                else
                {
                    rfid   = txtRFID2.Text;
                    roumap = txtRoumap2.Text;
                }


                string sql = @"if not exists(select DocEntry from Doc_Prodcutpackage13 where RFID_ID = '" + rfid + @"')
	begin
    update Tm_RFID set STATUS = 'O' where RFIDLUN = '" + rfid + @"'
    declare @MaxDoc as int
select @MaxDoc = isnull(max(DocEntry) + 1,1) from Doc_recRFID
INSERT INTO [Doc_recRFID]([DocEntry],[CREATED],[DOC_DATE],[EBDOC],[SN],[PackageCode],[RFID_ID],[roumap])
select top 1 @MaxDoc,'" + FunPublic.CurrentUser + "',getdate(),'" + txtEBNum.Text + "','" + txtSN.Text + "','" + txtPackageCode.Text + "','" + rfid + "',roumap from Doc_Prodcutpackage14 where RFID_ID='" + rfid + "' and EBDOC='" + txtEBNum.Text + @"'
    end";
                strSqls.Add(sql);
                result = FunPublic.RunSqls(strSqls);
                if (result.Status == 1)
                {
                    //如果此PDA属于完成线,判断主路线是否还有可以配货的卡片,并且将窗体标题改为对应路线
                    if (txtRoumap1.Text == "主路线" && (txtRoumap2.Text == "后带路线" || txtRoumap2.Text == "帽眉路线"))
                    {
                        string    strsql = @"SELECT *,roumapName= (select name from Tm_roumap where DocEntry = roumap) FROM Doc_WorkshopGR 
                               WHERE MappingCode ='" + txtMappingCode.Text + @"' 
                               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))";
                        DataTable dt     = FunPublic.GetDt(strsql);
                        if (dt.Rows.Count > 0)
                        {
                            this.Text       = "配货 -" + dt.Rows[0]["roumapName"].ToString();
                            txtRFID2.Text   = "";
                            txtRoumap2.Text = "";
                        }
                        else
                        {
                            txtRFID2.Text       = "";
                            txtRoumap2.Text     = "";
                            txtRFID1.Text       = "";
                            txtRoumap1.Text     = "";
                            txtMappingCode.Text = "";
                            txtEBNum.Text       = "";
                            txtPackageCode.Text = "";
                            txtSN.Text          = "";
                            txtQuantity.Text    = "";
                        }
                    }
                    else
                    {
                        txtRFID2.Text       = "";
                        txtRoumap2.Text     = "";
                        txtRFID1.Text       = "";
                        txtRoumap1.Text     = "";
                        txtMappingCode.Text = "";
                        txtEBNum.Text       = "";
                        txtPackageCode.Text = "";
                        txtSN.Text          = "";
                        txtQuantity.Text    = "";
                        if ("弹窗".Equals(model))
                        {
                            this.Close();
                        }
                    }
                }
                else
                {
                    MessageBox.Show(result.Message);
                }
                this.panel1.Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #21
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);
            }
        }
Exemple #22
0
        /// <summary>
        /// 扫描条码
        /// </summary>
        private void BarCode_Scan()
        {
            try
            {
                string RFID_ID = Barcode.scan();

                if (RFID_ID == "")
                {
                    txtRFID.Text        = "";
                    txtEBNum.Text       = "";
                    txtPackageCode.Text = "";
                    txtSN.Text          = "";
                    txtQuantity.Text    = "";
                    cmbStep.Items.Clear();
                    cmbStep.Text = "";
                    MessageBox.Show("扫描失败!");
                }
                else
                {
                    if (RFID_ID.Substring(0, 1) == "2")
                    {//物料卡
                        txtRFID.Text = RFID_ID;
                        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 (RFID_ID.Substring(0, 1) == "1")
                    {//员工卡
                        txtStaff.Text = RFID_ID;
                    }
                    CommonClass.PlaySoundBeep();
                }
            }
            catch (Exception ex)
            {
                txtRFID.Text        = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                cmbStep.Items.Clear();
                cmbStep.Text = "";
                MessageBox.Show("扫描失败!" + ex.Message);
            }
        }
Exemple #23
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);
            }
        }
Exemple #24
0
        //匹配
        private void Mapping(string DeviceName)
        {
            string strsql      = string.Empty;
            string rfid        = txtRFID2.Text;
            string mappingcode = txtMappingCode.Text;
            string roumap      = txtRoumap1.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)
            {
                MessageBox.Show("车间类型不正确");
                txtRFID2.Text = "";
                return;
            }
            if ("1007".Equals(workshop.Rows[0]["WORKSHOP_CODE"]))//收发室 1:主路线  5:内衬
            {
                if (txtRoumap1.Text == "主路线")
                {
                    strsql = "select *,roumapName= (select name from Tm_roumap where DocEntry = roumap) from Doc_WorkshopGR where NcMappingStatus ='N' AND RFID_ID ='" + txtRFID2.Text + "' AND STEPCode =(select value from Ts_Config where [KEY]='FMappinNC') AND MappingCode ='" + mappingcode + "' AND roumap ='5'";
                }
                else if (txtRoumap1.Text == "内衬路线")
                {
                    strsql = "select *,roumapName= (select name from Tm_roumap where DocEntry = roumap) from Doc_WorkshopGR where NcMappingStatus ='N' AND RFID_ID ='" + txtRFID2.Text + "' AND STEPCode =(select value from Ts_Config where [KEY]='FMappingMain') AND MappingCode ='" + mappingcode + "' AND roumap ='1'";
                }
                else
                {
                    MessageBox.Show("路线与收发室不匹配");
                    txtRFID2.Text = "";
                    return;
                }
            }
            else if ("1005".Equals(workshop.Rows[0]["WORKSHOP_CODE"]))//完成线 1:主路线 2:帽眉  7:后带
            {
                if (txtRoumap1.Text == "主路线")
                {
                    strsql = @"SELECT *,roumapName= (select name from Tm_roumap where DocEntry = roumap) FROM Doc_WorkshopGR 
                               WHERE RFID_ID ='" + txtRFID2.Text + "' AND 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 (txtRoumap1.Text == "后带路线" || txtRoumap1.Text == "帽眉路线")
                {
                    strsql = @"SELECT *,roumapName= (select name from Tm_roumap where DocEntry = roumap) FROM Doc_WorkshopGR 
                               WHERE RFID_ID ='" + txtRFID2.Text + "' AND MappingCode ='" + mappingcode + @"' 
                               AND roumap = 1 AND STEPCode in(select value from Ts_Config where [KEY]='SMappingMain') 
                               AND (MmMappingStatus ='N' OR HdMappingStatus ='N')";
                }
                else
                {
                    MessageBox.Show("路线与完成线不匹配");
                    txtRFID2.Text = "";
                    return;
                }
            }

            DataTable dt = FunPublic.GetDt(strsql);

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("没有找到对应工序");
                txtRFID2.Text = "";
                return;
            }
            txtRoumap2.Text     = dt.Rows[0]["roumapName"].ToString();
            this.panel1.Visible = true;
        }
Exemple #25
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();
        }
Exemple #26
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);
            }
        }
Exemple #27
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);
        }
Exemple #28
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);
            }
        }
Exemple #29
0
        /// <summary>
        /// 扫描条码
        /// </summary>
        private void BarCode_Scan()
        {
            try
            {
                string RFID_ID = Barcode.scan();

                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
                {
                    if (RFID_ID.Substring(0, 1) == "2")
                    {//物料卡
                        txtRFID.Text = RFID_ID;
                        //查询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 (RFID_ID.Substring(0, 1) == "1")
                    {//员工卡
                        MessageBox.Show("请刷物料卡!");
                        return;
                    }
                    CommonClass.PlaySoundBeep();
                }
            }
            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);
            }
        }
Exemple #30
0
        /// <summary>
        /// 扫描条码
        /// </summary>
        private void BarCode_Scan()
        {
            if (cmbCardCode.Text == "")
            {
                MessageBox.Show("请先选择供应商!");
                return;
            }
            try
            {
                string RFID_ID = Barcode.scan();

                if (RFID_ID == "")
                {
                    txtRFID.Text = "";
                    //cmbCardCode.Text = "";
                    txtEBNum.Text       = "";
                    txtPackageCode.Text = "";
                    txtSN.Text          = "";
                    txtQuantity.Text    = "";
                    MessageBox.Show("扫描失败!");
                }
                else
                {
                    if (RFID_ID.Substring(0, 1) == "2")
                    {//物料卡
                        txtRFID.Text = RFID_ID;
                        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 (RFID_ID.Substring(0, 1) == "1")
                    {//员工卡
                        MessageBox.Show("请刷物料卡!");
                        return;
                    }
                    CommonClass.PlaySoundBeep();
                }
            }
            catch (Exception ex)
            {
                txtRFID.Text = "";
                //cmbCardCode.Text = "";
                txtEBNum.Text       = "";
                txtPackageCode.Text = "";
                txtSN.Text          = "";
                txtQuantity.Text    = "";
                MessageBox.Show("扫描失败!" + ex.Message);
            }
        }