| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | } |
| | | String newLocId = row + "-" + col + "-" + lev; |
| | | param.setLocId(newLocId); |
| | | // TODO:模擬寫死重量1000KG,需後續刪除 |
| | | param.setWeight(1000.0); |
| | | |
| | | String request = JSON.toJSONString(param); |
| | | String response = ""; |
| | |
| | | param.setPalletId(resolvePalletId(wrkMast, wrkDetls)); |
| | | param.setAnfme(sumAnfme(wrkDetls)); |
| | | param.setLocId(wrkMast.getLocNo()); |
| | | param.setWeight(sumWeight(wrkDetls)); |
| | | // param.setWeight(sumWeight(wrkDetls)); |
| | | param.setWeight(adjustErpReportWeight(wrkMast.getScWeight())); |
| | | param.setCreateTime(formatDate(resolveCreateTime(wrkMast))); |
| | | param.setBizNo(resolveBizNo(wrkDetls, waitPakin)); |
| | | param.setStartTime(formatDate(resolveStartTime(wrkMast, waitPakin))); |
| | | return param; |
| | | } |
| | | |
| | | /** 上报 ERP 重量:称重减固定值,负则按 0 */ |
| | | private static BigDecimal adjustErpReportWeight(BigDecimal scWeight) { |
| | | BigDecimal base = scWeight == null ? BigDecimal.ZERO : scWeight; |
| | | BigDecimal v = base.subtract(new BigDecimal("20")); |
| | | return v.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : v; |
| | | } |
| | | private String resolvePalletId(WrkMast wrkMast, List<WrkDetl> wrkDetls) { |
| | | if (!Cools.isEmpty(wrkMast.getBarcode())) { |
| | | return wrkMast.getBarcode(); |