自动化立体仓库 - WMS系统
#
luxiaotao1123
2020-07-07 dc078dbd74d0028cdedb4210f0b892f88c86e41c
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java
@@ -8,6 +8,8 @@
import com.zy.asrs.service.WrkMastLogService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.ReturnT;
import com.zy.system.entity.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -17,7 +19,7 @@
 * Created by vincent on 2020/7/6
 */
@Service
public class WorkLogHandler extends AbstractHandler {
public class WorkLogHandler extends AbstractHandler<Config> {
    @Autowired
    private WrkMastService wrkMastService;
@@ -28,20 +30,21 @@
    @Autowired
    private WrkDetlLogService wrkDetlLogService;
    @Override
    @Transactional
    public void start() {
    public ReturnT<Config> start() {
        try {
            WrkMast wrkMast = wrkMastService.selectToBeHistoryData();
            if (null == wrkMast) {
                return;
                return SUCCESS;
            }
            // 保存工作主档历史档
            if (!wrkMastLogService.save(wrkMast.getWrkNo())) {
                exceptionHandle(""); // todo
                exceptionHandle("保存工作主档历史档失败"); // todo
            }
            // 删除工作主档
            if (!wrkMastService.deleteById(wrkMast)) {
                exceptionHandle(""); // todo
            if (wrkMastService.deleteById(wrkMast)) {
                exceptionHandle("删除工作主档[workNo={0}]失败", wrkMast.getWrkNo()); // todo
            }
            // 保存工作明细档历史档
            if (!wrkDetlLogService.save(wrkMast.getWrkNo())) {
@@ -54,9 +57,16 @@
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            // todo
            Config config = new Config(
                    "name",    // 名称[非空]
                    "code",    // 编码[非空]
                    "val",    // 对应值[非空]
                    (short)1,    // 类型[非空]
                    (short)1    // 状态[非空]
            );
            return FAIL.setMsg(e.getMessage()).setContent(config);
        }
        return SUCCESS;
    }
}