| | |
| | | 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; |
| | |
| | | private TagService tagService; |
| | | @Autowired |
| | | private TagMapper tagMapper; |
| | | @Autowired |
| | | private CheckDetlService checkDetlService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | } |
| | | } |
| | | } |
| | | @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); // 插入差异记录 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |