| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Override |
| | | public int syncAnfmeToWeight() { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = new Date(2025, Calendar.JULY, 24); |
| | | Date date2 = new Date(2025, Calendar.JULY, 24, 23, 59, 59); |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>() |
| | | .isNull("weight")); |
| | | .ge("appe_time", format.format(date)) |
| | | .le("appe_time", format.format(date2)) |
| | | ); |
| | | |
| | | int i = 0; |
| | | for (LocDetl locDetl : locDetls) { |
| | | Double weight = MatUtils.calcWeight(locDetl.getMatnr(), locDetl.getWeight()); |
| | | locDetl.setWeight(weight); |
| | | locDetlService.updateById(locDetl); |
| | | // 修改库存 |
| | | Double anfme = MatUtils.calcAnfmeFromWeight(locDetl.getMatnr(), locDetl.getAnfme()); |
| | | locDetlService.updateAnfme(anfme, locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), locDetl.getBrand(), |
| | | locDetl.getStandby1(), locDetl.getStandby2(), locDetl.getStandby3(), locDetl.getBoxType1(), locDetl.getBoxType2(), locDetl.getBoxType3()); |
| | | i++; |
| | | } |
| | | return i; |