自动化立体仓库 - WMS系统
lty
2025-04-18 220241ca33a28ab4b7a3fb75093129ac5263a3ea
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -18,7 +18,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zy.asrs.entity.CheckDetl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -48,6 +48,8 @@
    private TagService tagService;
    @Autowired
    private TagMapper tagMapper;
    @Autowired
    private CheckDetlService checkDetlService;
    @Override
    @Transactional
@@ -601,6 +603,46 @@
                }
            }
        }
    @Override
    @Transactional
    public void check(List<MatSyncParam> paramList){
        if (Cools.isEmpty(paramList)) {
            throw new CoolException("上报数据为空");
        }
        for (MatSyncParam param : paramList) {
            if (Cools.isEmpty(param.getData()) || param.getData().isEmpty()) {
                throw new CoolException("物料数据为空");
            }
            for (MatSyncParam.MatParam matParam : param.getData()) {
                if (Cools.isEmpty(matParam.getMatnr())) {
                    throw new CoolException("商品编码为空");
                }
                Double LKAnfme = locDetlService.getAnfmeByMatnr(matParam.getMatnr());
                if (LKAnfme == null) {
                    LKAnfme = 0.0;
                }
                // 计算差值
                double diff = matParam.getAnfme() - LKAnfme;
                if (diff != 0) {
                    CheckDetl checkDetl = new CheckDetl();
                    checkDetl.setAnfme(diff);  //这里记录差值
                    checkDetl.setMatnr(matParam.getMatnr());
                    checkDetl.setMaktx(matParam.getMaktx());
                    checkDetl.setSpecs(matParam.getSpecs());
                    checkDetl.setCreateTime(new Date());
                    checkDetlService.insert(checkDetl);  // 插入差异记录
                }
            }
        }
    }