自动化立体仓库 - WCS系统
#
Junjie
2023-11-27 1c47a8d2256c86bde794903dbd86b92f9c1274d3
src/main/java/com/zy/asrs/service/impl/CommandInfoServiceImpl.java
@@ -1,15 +1,22 @@
package com.zy.asrs.service.impl;
import com.alibaba.fastjson.JSON;
import com.zy.asrs.entity.CommandInfoLog;
import com.zy.asrs.mapper.CommandInfoMapper;
import com.zy.asrs.entity.CommandInfo;
import com.zy.asrs.service.CommandInfoLogService;
import com.zy.asrs.service.CommandInfoService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("commandInfoService")
public class CommandInfoServiceImpl extends ServiceImpl<CommandInfoMapper, CommandInfo> implements CommandInfoService {
    @Autowired
    private CommandInfoLogService commandInfoLogService;
    @Override
    public List<CommandInfo> selectByTaskNoAndWrkNo(String taskNo, Integer wrkNo) {
@@ -28,9 +35,18 @@
    @Override
    public int saveToHistory(String taskNo) {
        int count = 0;
        if (this.selectByTaskNo(taskNo).isEmpty()) {
            return 0;
            return count;
        }
        return this.baseMapper.saveToHistory(taskNo);
        for (CommandInfo commandInfo : this.baseMapper.selectByTaskNo(taskNo)) {
            String jsonString = JSON.toJSONString(commandInfo);
            CommandInfoLog commandInfoLog = JSON.parseObject(jsonString, CommandInfoLog.class);
            commandInfoLog.setId(null);
            if (commandInfoLogService.insert(commandInfoLog)) {
                count++;
            }
        }
        return count;
    }
}