|
|
@ -99,11 +99,11 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
.map(label -> (String) label.get("labelCode")) |
|
|
.map(label -> (String) label.get("labelCode")) |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
// 3. 更新SFDC_ROLLS表中标签状态为"已入库" |
|
|
|
|
|
int updatedLabels = productionReturnMapper.updateSfdcRollsStatus(labelCodes, "已入库", site, buNo); |
|
|
|
|
|
if (updatedLabels != labelCodes.size()) { |
|
|
|
|
|
throw new RuntimeException("部分标签状态更新失败"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// // 3. 更新SFDC_ROLLS表中标签状态为"已入库" |
|
|
|
|
|
// int updatedLabels = productionReturnMapper.updateSfdcRollsStatus(labelCodes, "已入库", site, buNo); |
|
|
|
|
|
// if (updatedLabels != labelCodes.size()) { |
|
|
|
|
|
// throw new RuntimeException("部分标签状态更新失败"); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
// 5. 插入库存数据 |
|
|
// 5. 插入库存数据 |
|
|
insertInventoryStock(orderNo, warehouseId, locationCode, labels, site, buNo); |
|
|
insertInventoryStock(orderNo, warehouseId, locationCode, labels, site, buNo); |
|
|
@ -155,24 +155,24 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
// 转换数量 |
|
|
// 转换数量 |
|
|
BigDecimal quantity = convertToDecimal(quantityObj); |
|
|
BigDecimal quantity = convertToDecimal(quantityObj); |
|
|
|
|
|
|
|
|
// 查询库存是否已存在 |
|
|
|
|
|
InventoryStock existingStock = inventoryStockService.getByRollNo(labelCode, actualSite, actualBuNo, partNo, warehouseId, locationCode, batchNo); |
|
|
|
|
|
|
|
|
|
|
|
if (existingStock != null) { |
|
|
|
|
|
// 库存已存在,更新数量 |
|
|
|
|
|
logger.info("库存记录已存在,更新数量,标签: {}, 原数量: {}, 增加数量: {}", |
|
|
|
|
|
labelCode, existingStock.getQtyOnHand(), quantity); |
|
|
|
|
|
|
|
|
// // 查询库存是否已存在 |
|
|
|
|
|
// InventoryStock existingStock = inventoryStockService.getByRollNo(labelCode, actualSite, actualBuNo, partNo, warehouseId, locationCode, batchNo); |
|
|
|
|
|
// |
|
|
|
|
|
// if (existingStock != null) { |
|
|
|
|
|
// // 库存已存在,更新数量 |
|
|
|
|
|
// logger.info("库存记录已存在,更新数量,标签: {}, 原数量: {}, 增加数量: {}", |
|
|
|
|
|
// labelCode, existingStock.getQtyOnHand(), quantity); |
|
|
|
|
|
|
|
|
boolean updateSuccess = inventoryStockService.updateInventoryQuantity(labelCode, quantity, actualSite, actualBuNo, partNo, warehouseId, locationCode, batchNo); |
|
|
boolean updateSuccess = inventoryStockService.updateInventoryQuantity(labelCode, quantity, actualSite, actualBuNo, partNo, warehouseId, locationCode, batchNo); |
|
|
if (!updateSuccess) { |
|
|
if (!updateSuccess) { |
|
|
throw new RuntimeException("更新库存数量失败,标签: " + labelCode); |
|
|
throw new RuntimeException("更新库存数量失败,标签: " + labelCode); |
|
|
} |
|
|
} |
|
|
updatedCount++; |
|
|
updatedCount++; |
|
|
} else { |
|
|
|
|
|
// 库存不存在,创建新记录 |
|
|
|
|
|
InventoryStock inventoryStock = createNewInventoryStock(labelCode, partNo, warehouseId, locationCode, batchNo, quantity, orderNo, currentDate, actualSite, actualBuNo); |
|
|
|
|
|
newInventoryList.add(inventoryStock); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// } else { |
|
|
|
|
|
// // 库存不存在,创建新记录 |
|
|
|
|
|
// InventoryStock inventoryStock = createNewInventoryStock(labelCode, partNo, warehouseId, locationCode, batchNo, quantity, orderNo, currentDate, actualSite, actualBuNo); |
|
|
|
|
|
// newInventoryList.add(inventoryStock); |
|
|
|
|
|
// } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 批量插入新的库存记录 |
|
|
// 批量插入新的库存记录 |
|
|
@ -345,7 +345,7 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
transDetail.setTransqty(quantity); |
|
|
transDetail.setTransqty(quantity); |
|
|
transDetail.setDirection("+"); |
|
|
transDetail.setDirection("+"); |
|
|
transDetail.setOrderref2(buNo); |
|
|
transDetail.setOrderref2(buNo); |
|
|
transDetail.setRemark("生产订单入库上架"); |
|
|
|
|
|
|
|
|
transDetail.setRemark("生产退仓上架"); |
|
|
transDetailList.add(transDetail); |
|
|
transDetailList.add(transDetail); |
|
|
itemNo += 1.0; |
|
|
itemNo += 1.0; |
|
|
} |
|
|
} |
|
|
|