예제 #1
0
        private bool AddRecheckDetail(TOutCheck recheck, VScanRequest request)
        {
            var recheckId = recheck.Id;
            //新增复核明细
            var recheckDetail = new TOutCheckD
            {
                HId         = recheckId,
                Qty         = 1,
                Carton      = request.Carton,
                Barcode     = request.Barcode,
                CreatedBy   = DefaultUser.UserName,
                CreatedTime = DateTime.Now,
            };

            if (recheck.FirstScanAt == null)
            {
                recheck.FirstScanAt = DateTime.UtcNow;
            }

            recheck.Qty += 1;

            recheck.LastScanAt = DateTime.UtcNow;
            recheck.Status     = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Doing);

            //更新出库单状态
            var outbound = wmsoutbound.TOuts.Where(x => x.Id == recheckId).FirstOrDefault();

            outbound.ScanStatus = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Doing);

            wmsoutbound.TOutCheckDs.Add(recheckDetail);

            return(wmsoutbound.SaveChanges() > 0);
        }
예제 #2
0
        public void ScanAndCheck(long id, VScanRequest request)
        {
            var prodSku = skuService.GetSkuByBarcode(request.Barcode);

            if (prodSku == null)
            {
                throw new Exception("barcode is not exits");
            }

            //应该把扫描记录单独记录在一个表里面,然后通过扫描的结果和存在的记录进行对比
        }
예제 #3
0
        public VOutScanResponse Scan(long recheckId, VScanRequest request)
        {
            VOutScanResponse response = new VOutScanResponse
            {
                AllFinished = false,
                Message     = ""
            };
            var recheck = wmsoutbound.TOutChecks.Where(x => x.Id == recheckId).FirstOrDefault();

            if (recheck == null)
            {
                throw new Exception("pick is not exist.");
            }

            //获取SKU信息
            var prodSku = skuService.GetSkuByBarcode(request.Barcode);

            if (prodSku == null)
            {
                throw new Exception("barcode is not exist.");
            }

            //校验复核的数量和出库单的数量
            var recheckQty = wmsoutbound.TOutCheckDs.Where(x => x.HId == recheckId && x.Barcode == request.Barcode).Sum(x => x.Qty);
            var skuQty     = wmsoutbound.TOutDs.Where(x => x.HId == recheck.OutboundId && x.Barcode == request.Barcode).Sum(x => x.Qty);

            if (recheckQty < skuQty)
            {
                AddRecheckDetail(recheck, request);
                response.Message = string.Format("{0}/{1}", recheckQty + 1, skuQty);
            }
            else
            {
                response.AllFinished = true;
                response.Message     = string.Format("{0}/{1}", recheckQty, skuQty);
            }
            return(response);
        }
예제 #4
0
        public JsonResult Scan([FromUri] long id, [FromBody] VScanRequest vScan)
        {
            var result = recheckService.Scan(id, vScan);

            return(new JsonResult(result));
        }