示例#1
0
        private void UpdatePickDetail(TWhBin zoneBin, TOutPick pick, TOutPickD pickDetail)
        {
            if (pick.FirstScanAt == null)
            {
                pick.FirstScanAt = DateTime.UtcNow;
            }

            pick.LastScanAt = DateTime.UtcNow;

            pick.Qty += 1;

            pick.Status = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Doing);

            pickDetail.Qty              = 1;
            pickDetail.ActZoneId        = zoneBin.ZoneId;
            pickDetail.ActZoneCode      = zoneBin.ZoneCode;
            pickDetail.ActBinId         = zoneBin.Id;
            pickDetail.ActBinCode       = zoneBin.Code;
            pickDetail.IsPicked         = true;
            pickDetail.LastModifiedBy   = DefaultUser.UserName;
            pickDetail.LastModifiedTime = DateTime.UtcNow;

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

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

            wmsoutbound.SaveChanges();
        }
示例#2
0
        public bool Scan(long waveId, VScanBinRequest detail)
        {
            var pick = wmsoutbound.TOutPicks.Where(x => x.WaveId == waveId).FirstOrDefault();

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

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

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

            //新增拣货明细
            var pickDetail = wmsoutbound.TOutPickDs.Where(x => x.HId == pick.Id && x.Barcode == detail.Barcode).FirstOrDefault();

            if (pickDetail == null)
            {
                pickDetail = new TOutPickD
                {
                    HId = pick.Id,
                };
            }

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

            pick.LastScanAt = DateTime.UtcNow;

            pick.Qty += 1;

            pick.Status = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Doing);

            //获取货区货位信息
            var zoneBin = binService.GetBinByCode(pick.WhId, detail.BinCode);

            pickDetail.ActBinId         = zoneBin.Id;
            pickDetail.ActBinCode       = detail.BinCode;
            pickDetail.Qty              = 1;
            pickDetail.ActZoneCode      = zoneBin.ZoneCode;
            pickDetail.ActZoneId        = zoneBin.ZoneId;
            pickDetail.IsPicked         = true;
            pickDetail.LastModifiedBy   = DefaultUser.UserName;
            pickDetail.LastModifiedTime = DateTime.UtcNow;

            if (pickDetail.Id == 0)
            {
                wmsoutbound.TOutPickDs.Add(pickDetail);
            }

            return(wmsoutbound.SaveChanges() > 0);
        }
示例#3
0
        ///这里不对TOut的状态做任何校验
        public bool CreatePick(TOut tOut, long waveId = 0)
        {
            TOutPick tOutPick = new TOutPick
            {
                Code         = tOut.Code.Replace("SHP", "PCK"),
                WhId         = tOut.WhId,
                WaveId       = waveId,
                OutboundId   = tOut.Id,
                OutboundCode = tOut.Code,
                Store        = tOut.Store,
                Status       = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Init),
                CreatedBy    = DefaultUser.UserName,
                CreatedTime  = DateTime.UtcNow,
            };

            tOut.DetailList = wmsoutbound.TOutDs.Where(x => x.HId == tOut.Id).ToList();

            var allotDetailList = (from detail in wmsoutbound.TOutAllotDs
                                   join allot in wmsoutbound.TOutAllots on detail.HId equals allot.Id
                                   where allot.OutboundId == tOut.Id
                                   select detail)
                                  .ToList();

            var detaiList = tOut.DetailList;

            foreach (var detail in allotDetailList)
            {
                for (int i = 0; i < detail.MatchingQty; i++)
                {
                    var       outDetail = detaiList.Where(x => x.SkuId == detail.SkuId).FirstOrDefault();
                    TOutPickD tOutPickD = new TOutPickD
                    {
                        SkuId       = detail.SkuId,
                        Sku         = outDetail.Sku,
                        Barcode     = detail.Barcode,
                        ZoneId      = detail.ZoneId,
                        ZoneCode    = detail.ZoneCode,
                        BinId       = detail.BinId,
                        BinCode     = detail.BinCode,
                        Qty         = 1,
                        CreatedBy   = DefaultUser.UserName,
                        CreatedTime = DateTime.UtcNow
                    };

                    tOutPick.DetailList.Add(tOutPickD);
                }
            }

            wmsoutbound.TOutPicks.Add(tOutPick);
            return(wmsoutbound.SaveChanges() > 0);
        }