自动化立体仓库 - WMS系统
wang..123
2022-03-01 a34dafbbfa35432f9dc262779d9e6b6318ff2128
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
package com.zy.ints.task.handler;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.ints.entity.IoComplete;
import com.zy.ints.service.IoCompleteLogService;
import com.zy.ints.service.IoCompleteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
@Service
public class IoCompleteLogHandler extends AbstractHandler<String> {
 
    @Autowired
    private IoCompleteService ioCompleteService;
 
    @Autowired
    private IoCompleteLogService ioCompleteLogService;
 
    public ReturnT<String> start(IoComplete ioComplete) {
        try {
            // 保存工作主档历史档
            if (!ioCompleteLogService.save(ioComplete.getId())) {
                exceptionHandle("保存回报历史档[id={0}]失败", ioComplete.getId());
            }
            // 删除工作主档
            if (!ioCompleteService.delete(new EntityWrapper<IoComplete>().eq("id", ioComplete.getId()))) {
                exceptionHandle("删除回报档[id={0}]失败", ioComplete.getId());
            }
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return FAIL.setMsg(e.getMessage());
        }
        return SUCCESS;
    }
}