|
|
@ -746,7 +746,7 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
poReceiptDetail.setSupplierBatchNo(inData.getSupplierBatchNo()); |
|
|
poReceiptDetail.setSupplierBatchNo(inData.getSupplierBatchNo()); |
|
|
poReceiptDetail.setWdr(inData.getWdr() != null ? inData.getWdr() : "*"); |
|
|
poReceiptDetail.setWdr(inData.getWdr() != null ? inData.getWdr() : "*"); |
|
|
// width 和length是根据料号判断的,如果料号带尾缀,比如70001234-0250, |
|
|
// width 和length是根据料号判断的,如果料号带尾缀,比如70001234-0250, |
|
|
// 那么width就是250,如果不带尾缀且单位不是kg,width就是1000 |
|
|
|
|
|
|
|
|
// 那么width就是250,如果不带尾缀且单位不是kg,width就是从batchNo的最后一段获取 |
|
|
String partNo = inData.getPartNo(); |
|
|
String partNo = inData.getPartNo(); |
|
|
if (partNo != null && partNo.contains("-")) { |
|
|
if (partNo != null && partNo.contains("-")) { |
|
|
String[] parts = partNo.split("-"); |
|
|
String[] parts = partNo.split("-"); |
|
|
@ -755,13 +755,35 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
int widthVal = Integer.parseInt(suffix); |
|
|
int widthVal = Integer.parseInt(suffix); |
|
|
poReceiptDetail.setWidth(BigDecimal.valueOf(widthVal)); |
|
|
poReceiptDetail.setWidth(BigDecimal.valueOf(widthVal)); |
|
|
} catch (NumberFormatException e) { |
|
|
} catch (NumberFormatException e) { |
|
|
poReceiptDetail.setWidth(null); // 默认1000 |
|
|
|
|
|
|
|
|
poReceiptDetail.setWidth(null); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 不带尾缀的料号 |
|
|
|
|
|
if (inData.getPurchaseUOM() != null && |
|
|
|
|
|
!inData.getPurchaseUOM().equalsIgnoreCase("KG") && |
|
|
|
|
|
!inData.getPurchaseUOM().equalsIgnoreCase("kg")) { |
|
|
|
|
|
// 从batchNo的最后一段获取width,例如:1347654-1-4-3-500 -> 500 |
|
|
|
|
|
String batchNo = inData.getBatchNo(); |
|
|
|
|
|
if (batchNo != null && batchNo.contains("-")) { |
|
|
|
|
|
String[] batchParts = batchNo.split("-"); |
|
|
|
|
|
String lastPart = batchParts[batchParts.length - 1]; |
|
|
|
|
|
try { |
|
|
|
|
|
int widthVal = Integer.parseInt(lastPart); |
|
|
|
|
|
poReceiptDetail.setWidth(BigDecimal.valueOf(widthVal)); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
poReceiptDetail.setWidth(BigDecimal.valueOf(1000)); // 解析失败时默认1000 |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
poReceiptDetail.setWidth(BigDecimal.valueOf(1000)); // 没有批次号时默认1000 |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
poReceiptDetail.setWidth(null); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// length就是数量除以width再乘以1000 |
|
|
// length就是数量除以width再乘以1000 |
|
|
if (poReceiptDetail.getWidth() != null && poReceiptDetail.getWidth().compareTo(BigDecimal.ZERO) > 0) { |
|
|
if (poReceiptDetail.getWidth() != null && poReceiptDetail.getWidth().compareTo(BigDecimal.ZERO) > 0) { |
|
|
BigDecimal length = inData.getTransQty() |
|
|
BigDecimal length = inData.getTransQty() |
|
|
.divide(poReceiptDetail.getWidth(), 2, RoundingMode.HALF_UP) |
|
|
|
|
|
|
|
|
.divide(poReceiptDetail.getWidth(), 6, RoundingMode.HALF_UP) |
|
|
.multiply(BigDecimal.valueOf(1000)); |
|
|
.multiply(BigDecimal.valueOf(1000)); |
|
|
poReceiptDetail.setLength(length); |
|
|
poReceiptDetail.setLength(length); |
|
|
} else { |
|
|
} else { |
|
|
|