Commit a7434fbd authored by chenzhao's avatar chenzhao

修改代码

parent 7532e25b
...@@ -22,6 +22,7 @@ import org.springframework.transaction.TransactionStatus; ...@@ -22,6 +22,7 @@ import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -492,23 +493,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -492,23 +493,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
// list.add(equipmentSpecific); // list.add(equipmentSpecific);
// this.equipmentSpecificIndexSave(equipmentDetail, equipmentSpecific); // this.equipmentSpecificIndexSave(equipmentDetail, equipmentSpecific);
// } // }
List<Equipment> equipmentList;
if (redisUtils.hasKey("equip_equipDefinitions")) {
equipmentList = JSONObject.parseArray(redisUtils.get("equip_equipDefinitions").toString(), Equipment.class);;
} else {
QueryWrapper<Equipment> equipmentQueryWrapper = new QueryWrapper<>(); QueryWrapper<Equipment> equipmentQueryWrapper = new QueryWrapper<>();
equipmentQueryWrapper.isNotNull("id"); equipmentQueryWrapper.isNotNull("id");
equipmentList = equipmentMapper.selectList(equipmentQueryWrapper); List<Equipment> equipmentList = equipmentMapper.selectList(equipmentQueryWrapper);
redisUtils.set("equip_equipDefinitions", JSONObject.toJSONString(equipmentList));
}
List<WarehouseStructure> warehouseStructures ; List<WarehouseStructure> warehouseStructures = warehouseStructureService.list();
if (redisUtils.hasKey("equip_warehouseStructures")) {
warehouseStructures = JSONObject.parseArray(redisUtils.get("equip_warehouseStructures").toString(), WarehouseStructure.class);
} else {
warehouseStructures = warehouseStructureService.list();
redisUtils.set("equip_warehouseStructures", JSONObject.toJSONString(warehouseStructures));
}
for (int i = 0; i < equipmentDetailDownloadVOS.size(); i++) { for (int i = 0; i < equipmentDetailDownloadVOS.size(); i++) {
try { try {
...@@ -728,16 +717,18 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -728,16 +717,18 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
// warehouseStructureQueryWrapper.lambda().eq(WarehouseStructure::getCode, equipmentDetailDownloadVOS.getWarehouseStructCode()); // warehouseStructureQueryWrapper.lambda().eq(WarehouseStructure::getCode, equipmentDetailDownloadVOS.getWarehouseStructCode());
// WarehouseStructure warehouseStructure = warehouseStructureService.getOne(warehouseStructureQueryWrapper); // WarehouseStructure warehouseStructure = warehouseStructureService.getOne(warehouseStructureQueryWrapper);
// 入库位置进行优化 // 入库位置进行优化
WarehouseStructure warehouseStructure = warehouseStructures.stream().filter(x -> x.getCode().equals(equipmentDetailDownloadVOS.getWarehouseStructCode())).collect(Collectors.toList()).get(0); List<WarehouseStructure> warehouseStructureData = warehouseStructures.stream().filter(x -> x.getCode().equals(equipmentDetailDownloadVOS.getWarehouseStructCode())).collect(Collectors.toList());
if (warehouseStructure == null) { if (ValidationUtil.isEmpty(warehouseStructureData)) {
erryy.append(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())+ ","); erryy.append(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())+ ",");
throw new RuntimeException(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())); throw new RuntimeException(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode()));
} else {
equipmentSpecific.setPosition(warehouseStructure.getFullName());
equipmentSpecific.setWarehouseStructureId(warehouseStructure.getId());
equipmentSpecificMapper.updateById(equipmentSpecific);
} }
WarehouseStructure warehouseStructure = warehouseStructureData.get(0);
equipmentSpecific.setPosition(warehouseStructure.getFullName());
equipmentSpecific.setWarehouseStructureId(warehouseStructure.getId());
equipmentSpecificMapper.updateById(equipmentSpecific);
// 插入库存 // 插入库存
Stock stock = new Stock(); Stock stock = new Stock();
stock.setAmount(Double.valueOf(equipmentSpecific.getNum())); stock.setAmount(Double.valueOf(equipmentSpecific.getNum()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment