|
@ -4606,6 +4606,8 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
if (id.contains(",")){
|
|
|
String str[] = id.split(",");
|
|
|
MediicinecabinetInventory mediicinecabinetInventory = new MediicinecabinetInventory();
|
|
|
boolean cargoCapacityChanged = false;
|
|
|
int changedCapacity = 0;
|
|
|
for (int i=0;i<str.length;i++){
|
|
|
MediicinecabinetInventory inventory = inventoryDao.findOne(str[i]);
|
|
|
//更新设备缺货状态的该药品的已变动数量
|
|
@ -4613,8 +4615,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
inventoryDO.setDrugCode(inventory.getDrugCode());
|
|
|
inventoryDO.setOrgCode(inventory.getOrgCode());
|
|
|
inventoryDO.setRatedInventory(inventory.getRatedInventory());
|
|
|
boolean cargoCapacityChanged = false;
|
|
|
int changedCapacity = 0;
|
|
|
|
|
|
//库存变动
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(qty)){
|
|
|
if (Integer.parseInt(qty) > 99) {
|
|
@ -4638,7 +4639,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
//提升容量至库存数(修改的库存数大于容量时)
|
|
|
if (Integer.parseInt(qty) > Integer.parseInt(inventory.getCargoCapacity())) {
|
|
|
cargoCapacityChanged = true;
|
|
|
changedCapacity = Integer.parseInt(qty);
|
|
|
changedCapacity += Integer.parseInt(qty);
|
|
|
inventory.setCargoCapacity(qty);
|
|
|
}
|
|
|
inventory.setQty(qty);
|
|
@ -4677,7 +4678,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
throw new Exception("货道容量最多99个,如超过请放置另一格");
|
|
|
}
|
|
|
inventory.setCargoCapacity(cargoCapacity);
|
|
|
changedCapacity = Integer.parseInt(cargoCapacity);
|
|
|
changedCapacity += Integer.parseInt(cargoCapacity);
|
|
|
cargoCapacityChanged = true;
|
|
|
}
|
|
|
//更改货道容量-end
|
|
@ -4730,22 +4731,23 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
|
|
|
mediicinecabinetInventory = inventoryDao.save(inventory);
|
|
|
//重算设备容量
|
|
|
if (cargoCapacityChanged) {
|
|
|
if (cargoCapacityChanged && i == str.length - 1) {
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(inventory.getIdDevice());
|
|
|
String ids = id.replaceAll(",","','");
|
|
|
String tempSql = "SELECT\n" +
|
|
|
"\tifnull(sum(t.cargo_capacity), 0) as cargoCapacity\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt.id_device = '"+inventory.getIdDevice()+"'\n" +
|
|
|
"AND t.id != '"+inventory.getId()+"'\n" +
|
|
|
"AND t.id not in ('"+ids+"')\n" +
|
|
|
"AND (t.state = '1' OR t.state = '21')";
|
|
|
|
|
|
Map<String,Object> totalMap = jdbcTemplate.queryForMap(tempSql);
|
|
|
Integer noOnlineTotal1 = 0;
|
|
|
if (totalMap!=null){
|
|
|
if (totalMap.get("cargoCapacity") != null) {
|
|
|
noOnlineTotal1 = (int) Double.parseDouble(totalMap.get("cargoCapacity").toString() + changedCapacity);
|
|
|
noOnlineTotal1 = (int) Double.parseDouble(totalMap.get("cargoCapacity").toString() ) + changedCapacity;
|
|
|
}
|
|
|
}
|
|
|
mediicinedevice.setCapacity(String.valueOf(noOnlineTotal1));
|