Example #1
0
        public BarObject AnalysisBarcode(string Url, string barcode)
        {
            if (Url == "0.0.0.0")
            {
                BarObject obj = new BarObject();
                obj.reelId = barcode;
                return(obj);
            }
            barcode = HttpPost(Url + barcode, "");

            //barcode = barcode.Replace("\\", "");
            //barcode = barcode.Remove(0, 1);
            //barcode = barcode.Remove(barcode.Length - 1, 1);
            return(Newtonsoft.Json.JsonConvert.DeserializeObject <BarObject>(barcode));
        }
Example #2
0
        /// <summary>
        /// 二维码解析
        /// </summary>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public BarObject MatchBarcode_UAES(string barcode)
        {
            BarObject obj = new BarObject();

            string[] listbar = barcode.Split('@');
            foreach (string item in listbar)
            {
                /// <summary>
                /// 标签版本
                /// </summary>
                if (RegBarHead(UAESBarcodeHead.Vision, item))
                {
                    obj.vision = item.Remove(0, UAESBarcodeHead.Vision.Length);
                }
                /// <summary>
                /// 客户零部件编号
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.PartNo, item))
                {
                    obj.partNo = item.Remove(0, UAESBarcodeHead.PartNo.Length);
                    obj.partNo = obj.partNo.Substring(0, 10);
                }
                /// <summary>
                /// 制造商零部件编号
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.ManufacturerTypeNo, item))
                {
                    obj.manufacturerTypeNo = item.Remove(0, UAESBarcodeHead.ManufacturerTypeNo.Length);
                }
                /// <summary>
                /// 订购代码
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.OrderNo, item))
                {
                    obj.orderNo = item.Remove(0, UAESBarcodeHead.OrderNo.Length);
                }
                /// <summary>
                /// 制造商编号
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.SupplierId, item))
                {
                    obj.supplierId = item.Remove(0, UAESBarcodeHead.SupplierId.Length);
                }
                /// <summary>
                /// 制造商位置
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.SupplierLoc, item))
                {
                    obj.supplierLoc = item.Remove(0, UAESBarcodeHead.SupplierLoc.Length);
                }
                /// <summary>
                /// 修订版本/索引号
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.Index, item))
                {
                    obj.index = item.Remove(0, UAESBarcodeHead.Index.Length);
                }

                /// <summary>
                /// 补充的零部件信息
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.AddInfo, item))
                {
                    obj.addInfo = item.Remove(0, UAESBarcodeHead.AddInfo.Length);
                }
                /// <summary>
                /// 制造日期
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.MakeDate, item))
                {
                    obj.makeDate = item.Remove(0, UAESBarcodeHead.MakeDate.Length);
                }
                /// <summary>
                /// 过期日期
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.ExpDate, item))
                {
                    obj.expDate = item.Remove(0, UAESBarcodeHead.ExpDate.Length);
                }
                /// <summary>
                /// 环保标志
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.RoHs, item))
                {
                    obj.roHs = item.Remove(0, UAESBarcodeHead.RoHs.Length);
                }
                /// <summary>
                /// 湿度敏感等级 默认为N
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.MsLevel, item))
                {
                    string mslevel = item.Remove(0, UAESBarcodeHead.MsLevel.Length).Trim();
                    obj.msLevel = string.IsNullOrEmpty(mslevel) ? "N" : mslevel;
                }
                /// <summary>
                /// 采购订单编号
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.PurchaseNo, item))
                {
                    obj.purchaseNo = item.Remove(0, UAESBarcodeHead.PurchaseNo.Length);
                }
                /// <summary>
                /// 托运单
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.ShippingNote, item))
                {
                    obj.shippingNote = item.Remove(0, UAESBarcodeHead.ShippingNote.Length);
                }
                /// <summary>
                /// 供应商编号
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.SupplNo, item))
                {
                    string temp = item.Remove(0, UAESBarcodeHead.SupplNo.Length);
                    if (temp.Length == 0)
                    {
                        temp = "000000";
                    }
                    obj.supplNo = temp;
                }
                /// <summary>
                /// 包装标示
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.PackageId, item))
                {
                    obj.packageId = item.Remove(0, UAESBarcodeHead.PackageId.Length);
                }
                /// <summary>
                /// 数量
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.Quantity, item))
                {
                    string qty = item.Remove(0, UAESBarcodeHead.Quantity.Length).Trim();
                    qty          = string.IsNullOrEmpty(qty) ? "0" : qty.Replace("NAR", "@").Split('@')[0];
                    obj.quantity = int.Parse(qty);
                }
                /// <summary>
                /// 批量计数
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.Count, item))
                {
                    obj.count = int.Parse(item.Remove(0, UAESBarcodeHead.Count.Length));
                }
                /// <summary>
                /// 批量编号 #1
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.Batch1, item))
                {
                    obj.batch1 = item.Remove(0, UAESBarcodeHead.Batch1.Length);
                }
                /// <summary>
                /// 批量编号 #2
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.Batch2, item))
                {
                    obj.batch2 = item.Remove(0, UAESBarcodeHead.Batch2.Length);
                }
                /// <summary>
                /// 供应商数据
                /// </summary>
                else if (RegBarHead(UAESBarcodeHead.SupplierData, item))
                {
                    obj.supplierData = item.Remove(0, UAESBarcodeHead.SupplierData.Length);
                }
            }
            return(obj);
        }