示例#1
0
        /// <summary>
        /// 获取商品的打印条码的后三位
        /// </summary>
        /// <param name="product"></param>
        /// <param name="prcou">打印数量</param>
        /// <returns></returns>
        private List <string> GetPrintBarcodeNumbs(ProductBarcodePrintInfo product, int prcou)
        {
            List <string> li      = new List <string>();
            string        starFlg = "0";

            if (product != null)
            {
                starFlg = product.CurPrintFlag;
            }
            lock (objlock)
            {
                string _key     = "cur_barcode_flgnum_1109";
                var    tecurNum = CacheAccess.Get(_key) as string;
                if (!string.IsNullOrEmpty(tecurNum))
                {
                    starFlg = tecurNum;
                }
            }
            Math36 math    = new Math36();
            int    curstar = (int)(math.To10(starFlg, 0));

            for (int i = 0; i < prcou; i++)
            {
                curstar += 1;
                li.Add((math.To36(curstar)).PadLeft(3, '0'));
            }
            lock (objlock)
            {
                string _key = "cur_barcode_flgnum_1109";
                CacheAccess.Set(_key, curstar, 2);
            }
            return(li);
        }
示例#2
0
        /// <summary>
        /// 获取最大的打印数
        /// </summary>
        /// <param name="lastcode"></param>
        /// <returns></returns>
        private string MaxCode(string[] lastcode)
        {
            float  maxcode = 0;
            Math36 math    = new Math36();

            foreach (var ite in lastcode)
            {
                float te = math.To10(ite, 0);
                if (te > maxcode)
                {
                    maxcode = te;
                }
            }
            return(math.To36(maxcode));
        }
示例#3
0
        //public JsonResult UpdateWord(int id, string fieldName)
        //{
        //    OperationResult res = new OperationResult(OperationResultType.Error);
        //    switch (fieldName)
        //    {

        //        case "IsDelivered":  //确认发货
        //            {
        //                //更改采购单信息
        //                var pur = _purchaseContract.Purchases.Where(c => c.Id == id).FirstOrDefault();
        //                pur.IsDelivered = true;
        //                pur.DeliverName = _administratorContract.Administrators.Where(c => c.Id == AuthorityHelper.OperatorId).FirstOrDefault().AdminName;
        //                pur.UpdatedTime = DateTime.Now;
        //                PurchaseDto purdt = Mapper.Map<PurchaseDto>(pur);
        //                res = _purchaseContract.Update(purdt);
        //                //将原库存的数量减少
        //                var purchLis = pur.PurchaseItems;
        //                List<InventoryDto> li = new List<InventoryDto>();
        //                foreach (var e in purchLis)
        //                {
        //                    var t = _inventoryContract.Inventorys.Where(c => c.ProductId == e.ProductId).FirstOrDefault();
        //                    t.Quantity = t.Quantity - e.Quantity;
        //                    InventoryDto dto = Mapper.Map<InventoryDto>(t);
        //                    li.Add(dto);
        //                }
        //                res = _inventoryContract.Update(li.ToArray());

        //                break;
        //            }
        //        case "IsReceived":
        //            {
        //                var pur = _purchaseContract.Purchases.Where(c => c.Id == id && c.IsDelivered == true).FirstOrDefault();
        //                if (pur == null)
        //                {
        //                    res = new OperationResult(OperationResultType.Error, "确认收货前需要由出库方确认出库");
        //                    break;
        //                }
        //                pur.IsReceived = true;
        //                pur.UpdatedTime = DateTime.Now;
        //                pur.ReceiverName = _administratorContract.Administrators.Where(c => c.Id == AuthorityHelper.OperatorId).FirstOrDefault().AdminName;
        //                PurchaseDto purdt = Mapper.Map<PurchaseDto>(pur);
        //                res = _purchaseContract.Update(purdt);
        //                break;

        //            }
        //        case "IsStoraged":
        //            {
        //                //修改采购单信息
        //                var pur = _purchaseContract.Purchases.Where(c => c.Id == id && c.IsReceived == true).FirstOrDefault();
        //                if (pur == null)
        //                {
        //                    res = new OperationResult(OperationResultType.Error, "确认入库前必须要先确认收货");
        //                    break;
        //                }
        //                pur.IsStoraged = true;
        //                pur.StoragerName = _administratorContract.Administrators.Where(c => c.Id == AuthorityHelper.OperatorId).FirstOrDefault().AdminName;
        //                pur.UpdatedTime = DateTime.Now;
        //                PurchaseDto purdt = Mapper.Map<PurchaseDto>(pur);
        //                res = _purchaseContract.Update(purdt);
        //                //修改入库的仓库信息
        //                var purch = _purchaseContract.Purchases.Where(c => c.Id == id).FirstOrDefault();
        //                var purchItemList = pur.PurchaseItems;
        //                List<InventoryDto> li = new List<InventoryDto>();
        //                foreach (var e in purchItemList)
        //                {
        //                    li.Add(new InventoryDto()
        //                    {
        //                        StoreId = (int)purch.ReceiverId,//收货店铺
        //                        StorageId = purch.ReceiverStorageId, //收货仓库
        //                        ProductId = e.ProductId,
        //                        Quantity = e.Quantity,
        //                        TagPrice = e.TagPrice,
        //                        RetailPrice = e.RetailPrice,
        //                        WholesalePrice = e.WholesalePrice,
        //                        PurchasePrice = e.PurchasePrice,
        //                        //LocationCode 库位编码
        //                        Description = purch.Notes

        //                    });
        //                }
        //                res = _inventoryContract.Insert(li.ToArray());
        //                break;
        //            }


        //    }
        //    return Json(res);
        //}

        //yxk 2015-9
        #endregion

        /// <summary>
        /// 返回一个不重复单号
        /// </summary>
        /// <returns></returns>
        private string GetOnlyNumb()
        {
            long i = 1;

            foreach (byte b in Guid.NewGuid().ToByteArray())
            {
                i *= ((int)b + 1);
            }
            //return string.Format("{0:x}", i - DateTime.Now.Ticks);
            string _num = string.Format("{0:x}", i - DateTime.Now.Ticks);

            var maxid = CacheAccess.GetOrderblankMaxId(_orderblankContract);

            XKMath36.Math36 math   = new Math36();
            var             newNum = math.To36(maxid);
            var             num    = _num.Substring(0, 6) + newNum.PadLeft(4, '0');

            return(num.ToUpper());
        }