示例#1
0
 public ProductScanAction(NDHDBEntities db, WavehouseInfo wareActionInfo, string user, WavehouseInfo wareReceieInfo)
 {
     this.db             = db;
     this.user           = user;
     this.wareActionInfo = wareActionInfo;
     this.wareReceieInfo = wareReceieInfo;
 }
示例#2
0
        // save history
        protected void saveHistory(string barcode, string caseCode, string boxCode, ProductInfo product, string stt, decimal?quantity, WavehouseInfo wInfo)
        {
            var history = new PHistory()
            {
                Id          = Guid.NewGuid().ToString(),
                Barcode     = barcode,
                PStatus     = stt,
                BoxCode     = boxCode,
                UserSend    = user,
                WCode       = wInfo.wCode,
                WName       = wInfo.wName,
                WType       = wInfo.wType,
                ProductCode = product.Barcode,
                CreateDate  = DateTime.Now,
                CaseCode    = caseCode,
                Quantity    = quantity
            };

            db.PHistories.Add(history);
            db.SaveChanges();

            var tracking = db.PTrackings.Where(p => p.CaseCode == caseCode && p.WCode == wInfo.wCode).FirstOrDefault();


            if (tracking == null)
            {
                var pTracking = new PTracking()
                {
                    Id        = Guid.NewGuid().ToString(),
                    WCode     = wInfo.wCode,
                    WType     = wInfo.wType,
                    WName     = wInfo.wName,
                    CaseCode  = caseCode,
                    ProductId = product.Id,
                    Quantity  = quantity
                };

                if (stt == "NK")
                {
                    pTracking.ImportTime = DateTime.Now;
                }
                else
                {
                    pTracking.ExportTime = DateTime.Now;
                }
                db.PTrackings.Add(pTracking);
                db.SaveChanges();
            }
            else
            {
                if (stt == "NK")
                {
                    tracking.Quantity   = tracking.Quantity + quantity;
                    tracking.ImportTime = DateTime.Now;
                }
                else
                {
                    tracking.Quantity   = tracking.Quantity - quantity;
                    tracking.ExportTime = DateTime.Now;
                }

                db.Entry(tracking).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
示例#3
0
 public ImportAction(NDHDBEntities db, WavehouseInfo wareAction, string user, WavehouseInfo waveReceie)
     : base(db, wareAction, user, waveReceie)
 {
 }