public bool Scan(long handoverId, VScanExpressRequest vExpress) { //首先查找条码是否存在 var express = wmsoutbound.TOutExpresses.Where(x => x.Code == vExpress.ExpressCode).FirstOrDefault(); if (express == null) { throw new Exception("couriercode is not exists."); } var detail = new TOutHandoverD { HId = handoverId, Courier = vExpress.CourierCode, ExpressNo = vExpress.ExpressCode, CreatedBy = DefaultUser.UserName, CreatedTime = DateTime.UtcNow, }; var handOver = wmsoutbound.TOutHandovers.Where(x => x.Id == handoverId).FirstOrDefault(); handOver.Qty += 1; handOver.IsConfirm = true; handOver.Status = Enum.GetName(typeof(EnumOperateStatus), EnumOperateStatus.Doing); if (handOver.FirstScanAt == null) { handOver.FirstScanAt = DateTime.UtcNow; } handOver.LastScanAt = DateTime.UtcNow; wmsoutbound.TOutHandoverDs.Add(detail); return(wmsoutbound.SaveChanges() > 0); }
public JsonResult Scan([FromUri] long id, [FromBody] VScanExpressRequest request) { var result = handoverService.Scan(id, request); return(new JsonResult(result)); }