|
|
|
@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
@ -137,7 +138,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, data.getPartNo()) |
|
|
|
.eq(InventoryStock::getBatchNo, data.getBatchNo()) |
|
|
|
.eq(InventoryStock::getLocationId, data.getLocationId()); |
|
|
|
|
|
|
|
|
|
|
|
InventoryStock existingStock = inventoryStockMapper.selectOne(queryWrapper); |
|
|
|
|
|
|
|
if (existingStock != null) { |
|
|
|
@ -145,14 +146,14 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
data.setFirstInDate(existingStock.getFirstInDate()); // 保持首次入库日期不变 |
|
|
|
data.setLatestInDate(new java.util.Date()); // 更新最近入库日期 |
|
|
|
data.setActiveDate(new java.util.Date()); // 更新活动日期 |
|
|
|
|
|
|
|
|
|
|
|
LambdaUpdateWrapper<InventoryStock> updateWrapper = Wrappers.lambdaUpdate(); |
|
|
|
updateWrapper.eq(InventoryStock::getSite, data.getSite()) |
|
|
|
.eq(InventoryStock::getWarehouseId, data.getWarehouseId()) |
|
|
|
.eq(InventoryStock::getPartNo, data.getPartNo()) |
|
|
|
.eq(InventoryStock::getBatchNo, data.getBatchNo()) |
|
|
|
.eq(InventoryStock::getLocationId, data.getLocationId()); |
|
|
|
|
|
|
|
|
|
|
|
inventoryStockMapper.update(data, updateWrapper); |
|
|
|
} else { |
|
|
|
// 创建新记录 |
|
|
|
@ -179,7 +180,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, data.getPartNo()) |
|
|
|
.eq(InventoryStock::getBatchNo, data.getBatchNo()) |
|
|
|
.eq(InventoryStock::getLocationId, data.getLocationId()); |
|
|
|
|
|
|
|
|
|
|
|
int result = inventoryStockMapper.delete(queryWrapper); |
|
|
|
if (result > 0) { |
|
|
|
return R.ok().put("msg", "删除成功"); |
|
|
|
@ -209,7 +210,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, partNo) |
|
|
|
.eq(InventoryStock::getBatchNo, batchNo) |
|
|
|
.eq(InventoryStock::getLocationId, locationId); |
|
|
|
|
|
|
|
|
|
|
|
InventoryStock existingStock = inventoryStockMapper.selectOne(queryWrapper); |
|
|
|
|
|
|
|
if (existingStock == null) { |
|
|
|
@ -257,7 +258,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, data.getPartNo()) |
|
|
|
.eq(InventoryStock::getBatchNo, data.getBatchNo()) |
|
|
|
.eq(InventoryStock::getLocationId, data.getLocationId()); |
|
|
|
|
|
|
|
|
|
|
|
inventoryStockMapper.update(null, updateWrapper); |
|
|
|
String status = "Y".equals(data.getFreezeFlag()) ? "冻结" : "解冻"; |
|
|
|
return R.ok().put("msg", "库存" + status + "成功"); |
|
|
|
@ -282,7 +283,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, partNo) |
|
|
|
.eq(InventoryStock::getBatchNo, batchNo) |
|
|
|
.eq(InventoryStock::getLocationId, locationId); |
|
|
|
|
|
|
|
|
|
|
|
InventoryStock existingStock = inventoryStockMapper.selectOne(queryWrapper); |
|
|
|
|
|
|
|
if (existingStock == null) { |
|
|
|
@ -315,7 +316,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, data.getPartNo()) |
|
|
|
.eq(InventoryStock::getBatchNo, data.getBatchNo()) |
|
|
|
.eq(InventoryStock::getLocationId, data.getLocationId()); |
|
|
|
|
|
|
|
|
|
|
|
return inventoryStockMapper.selectOne(queryWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@ -337,7 +338,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, partNo) |
|
|
|
.eq(InventoryStock::getBatchNo, batchNo) |
|
|
|
.eq(InventoryStock::getLocationId, fromLocationId); |
|
|
|
|
|
|
|
|
|
|
|
InventoryStock fromStock = inventoryStockMapper.selectOne(fromQueryWrapper); |
|
|
|
|
|
|
|
if (fromStock == null) { |
|
|
|
@ -362,7 +363,7 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
.eq(InventoryStock::getPartNo, partNo) |
|
|
|
.eq(InventoryStock::getBatchNo, batchNo) |
|
|
|
.eq(InventoryStock::getLocationId, toLocationId); |
|
|
|
|
|
|
|
|
|
|
|
InventoryStock toStock = inventoryStockMapper.selectOne(toQueryWrapper); |
|
|
|
|
|
|
|
if (toStock == null) { |
|
|
|
@ -403,4 +404,9 @@ public class WarehouseServiceImpl implements WarehouseService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> getUserAuthorizedWarehouses(String userName, String site) { |
|
|
|
return warehouseMapper.getUserAuthorizedWarehouses(userName, site); |
|
|
|
} |
|
|
|
|
|
|
|
} |