コード例 #1
0
ファイル: BoxRecordAppService.cs プロジェクト: jiangyimin/Clc
        private BoxRecordSearchDto MapToSearchDto(BoxRecord record)
        {
            var dto = new BoxRecordSearchDto();

            dto.Box = record.Box.Name;
            // dto.Worker = worker.Cn + ' ' + worker.Name;
            dto.InTime     = record.InTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
            dto.OutTime    = record.OutTime.HasValue ? record.OutTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : null;
            dto.InWorkers  = record.InWorkers;
            dto.OutWorkers = record.OutWorkers;
            return(dto);
        }
コード例 #2
0
ファイル: BoxRecordAppService.cs プロジェクト: jiangyimin/Clc
        public string InBox(int taskId, string boxCn, string workers)
        {
            var task  = _routeTaskRepository.Get(taskId);
            var boxes = _routeInBoxRepository.GetAllIncluding(x => x.BoxRecord, x => x.BoxRecord.Box)
                        .Where(x => x.RouteTaskId == taskId).ToList();

            if (boxes != null & boxes.Count > 0)
            {
                foreach (var bo in boxes)
                {
                    if (bo.BoxRecord.Box.Cn == boxCn && bo.BoxRecord.InTime.HasValue)
                    {
                        return("此尾箱已入库");
                    }
                }
            }

            var box = WorkManager.GetBoxByCn(boxCn);

            if (box.Id == 0)
            {
                return("无此尾箱");
            }

            var record = new BoxRecord()
            {
                BoxId     = box.Id,
                InTime    = DateTime.Now,
                InWorkers = workers
            };
            int recordId = _recordRepository.InsertAndGetId(record);

            Box b = _boxRepository.Get(box.Id);

            b.BoxRecordId = recordId;

            RouteInBox ri = new RouteInBox()
            {
                RouteId     = task.RouteId,
                RouteTaskId = task.Id,
                BoxRecordId = recordId
            };

            _routeInBoxRepository.Insert(ri);

            return(null);
        }