自动化立体仓库 - WMS系统
skyouc
19 小时以前 1c35f2b1215c136625c3a2eda0c1a50772bddad1
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
48
49
50
51
52
53
54
55
56
57
58
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.entity.InventoryFlowDto;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.entity.WrkMastLog;
import com.zy.asrs.mapper.WrkMastLogMapper;
import com.zy.asrs.service.WrkMastLogService;
import com.zy.asrs.service.WrkMastService;
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.Map;
import java.util.Objects;
 
@Service("wrkMastLogService")
public class WrkMastLogServiceImpl extends ServiceImpl<WrkMastLogMapper, WrkMastLog> implements WrkMastLogService {
 
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private WrkMastLogService wrkMastLogService;
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean save(Integer workNo) {
        WrkMast mast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", workNo));
        if (Objects.isNull(mast)) {
            throw new CoolException("数据错误:任务不存在!!");
        }
        WrkMastLog mastLog = new WrkMastLog();
        BeanUtils.copyProperties(mast, mastLog);
        mastLog.setLogId(mast.getId());
 
        if (!wrkMastLogService.insert(mastLog)) {
            throw new CoolException("任务日志保存失败!!");
        }
 
        return true;
    }
 
    @Override
    public R inventoryFlowList(Integer curr, Integer limit, Map<String, Object> param) {
        Page<InventoryFlowDto> page = new Page<>();
        page.setCurrent(curr);
        page.setSize(limit);
        page.setTotal(this.baseMapper.inventoryFlowListCount(param));
        page.setRecords(this.baseMapper.inventoryFlowList(curr, limit, param));
        return R.ok(page);
    }
 
}