自动化立体仓库 - WMS系统
#
pang.jiabao
4 天以前 52b21b24130c75197c039ae0fd761e2ef5b43cb3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Task;
import com.zy.asrs.entity.TaskDetl;
import com.zy.asrs.entity.TaskLog;
import com.zy.asrs.mapper.TaskDetlLogMapper;
import com.zy.asrs.entity.TaskDetlLog;
import com.zy.asrs.service.TaskDetlLogService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.asrs.service.TaskDetlService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
 
@Service("taskDetlLogService")
public class TaskDetlLogServiceImpl extends ServiceImpl<TaskDetlLogMapper, TaskDetlLog> implements TaskDetlLogService {
 
    @Autowired
    private TaskDetlService taskDetlService;
 
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean save(Integer wrkNo) {
        List<TaskDetl> detls = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", wrkNo));
        if (!detls.isEmpty()) {
            detls.forEach(detl -> {
                TaskDetlLog detlLog = new TaskDetlLog();
                BeanUtils.copyProperties(detl, detlLog);
                detlLog.setId(null);
                detlLog.setLogId(detl.getId());
                if (!this.insert(detlLog)) {
                    throw new CoolException("工作档明细历史保存失败!!");
                }
            });
        }
 
        return true;
    }
}