|
@ -2533,6 +2533,20 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
stringObjectMap.put("cardStatusName", "未知");
|
|
stringObjectMap.put("cardStatusName", "未知");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
String daibuSql = "";
|
|
|
|
int daibuNumber;
|
|
|
|
//待补商品数量
|
|
|
|
daibuSql = "SELECT\n" +
|
|
|
|
"\tsum(\n" +
|
|
|
|
"\t\tt.cargo_capacity - cast(t.qty AS UNSIGNED)\n" +
|
|
|
|
"\t)\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
|
|
"WHERE\n" +
|
|
|
|
"\tt.id_device = '"+stringObjectMap.get("id").toString()+"'\n" +
|
|
|
|
"AND (t.state = '1' OR t.state = '21')";
|
|
|
|
daibuNumber = jdbcTemplate.queryForObject(daibuSql, Integer.class);
|
|
|
|
stringObjectMap.put("daibushangpinshuliang", daibuNumber);
|
|
String tempSql = "SELECT\n" +
|
|
String tempSql = "SELECT\n" +
|
|
"\tifnull(sum(t.qty), 0) AS qty\n" +
|
|
"\tifnull(sum(t.qty), 0) AS qty\n" +
|
|
"FROM\n" +
|
|
"FROM\n" +
|
|
@ -4315,49 +4329,152 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public MediicinecabinetInventory updateMediicinecabineInventoryInfoById(String id,String qty,String cargoCapacity,String status,String userId) throws Exception {
|
|
public MediicinecabinetInventory updateMediicinecabineInventoryInfoById(String id,String qty,String cargoCapacity,String status,String userId) throws Exception {
|
|
MediicinecabinetInventory inventory = inventoryDao.findOne(id);
|
|
|
|
//更新设备缺货状态的该药品的已变动数量
|
|
|
|
InventoryDO inventoryDO = new InventoryDO();
|
|
|
|
inventoryDO.setDrugCode(inventory.getDrugCode());
|
|
|
|
inventoryDO.setOrgCode(inventory.getOrgCode());
|
|
|
|
inventoryDO.setRatedInventory(inventory.getRatedInventory());
|
|
|
|
boolean cargoCapacityChanged = false;
|
|
|
|
//库存变动
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(qty)){
|
|
|
|
if (Integer.parseInt(qty) > 99) {
|
|
|
|
throw new Exception("库存数量最多99个,请重新设置");
|
|
|
|
}
|
|
|
|
//有药品时的补货
|
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
|
inventoryRecord.setQuantity(qty);
|
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
|
inventoryRecord.setType("1");
|
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
|
|
//提升容量至库存数(修改的库存数大于容量时)
|
|
|
|
if (Integer.parseInt(qty) > Integer.parseInt(inventory.getCargoCapacity())) {
|
|
|
|
cargoCapacityChanged = true;
|
|
|
|
inventory.setCargoCapacity(qty);
|
|
|
|
}
|
|
|
|
inventory.setQty(qty);
|
|
|
|
//库存变更已变更的数量
|
|
|
|
inventoryDO.setQty(Integer.parseInt(qty));
|
|
|
|
//设置额定库存
|
|
|
|
inventory.setRatedInventory(Integer.parseInt(qty));
|
|
|
|
}
|
|
|
|
//更改货道容量-start
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(cargoCapacity)){
|
|
|
|
inventoryDO.setQty(Integer.parseInt(inventory.getQty()));
|
|
|
|
//2022-01-05-bug:13617-start
|
|
|
|
if (Integer.parseInt(inventory.getQty()) > Integer.parseInt(cargoCapacity)) {
|
|
|
|
|
|
if (id.contains(",")){
|
|
|
|
String str[] = id.split(",");
|
|
|
|
MediicinecabinetInventory mediicinecabinetInventory = new MediicinecabinetInventory();
|
|
|
|
for (int i=0;i<str.length;i++){
|
|
|
|
MediicinecabinetInventory inventory = inventoryDao.findOne(str[i]);
|
|
|
|
//更新设备缺货状态的该药品的已变动数量
|
|
|
|
InventoryDO inventoryDO = new InventoryDO();
|
|
|
|
inventoryDO.setDrugCode(inventory.getDrugCode());
|
|
|
|
inventoryDO.setOrgCode(inventory.getOrgCode());
|
|
|
|
inventoryDO.setRatedInventory(inventory.getRatedInventory());
|
|
|
|
boolean cargoCapacityChanged = false;
|
|
|
|
//库存变动
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(qty)){
|
|
|
|
if (Integer.parseInt(qty) > 99) {
|
|
|
|
throw new Exception("库存数量最多99个,请重新设置");
|
|
|
|
}
|
|
|
|
//有药品时的补货
|
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
|
inventoryRecord.setQuantity(qty);
|
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
|
inventoryRecord.setType("1");
|
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
|
|
//提升容量至库存数(修改的库存数大于容量时)
|
|
|
|
if (Integer.parseInt(qty) > Integer.parseInt(inventory.getCargoCapacity())) {
|
|
|
|
cargoCapacityChanged = true;
|
|
|
|
inventory.setCargoCapacity(qty);
|
|
|
|
}
|
|
|
|
inventory.setQty(qty);
|
|
|
|
//库存变更已变更的数量
|
|
|
|
inventoryDO.setQty(Integer.parseInt(qty));
|
|
|
|
//设置额定库存
|
|
|
|
inventory.setRatedInventory(Integer.parseInt(qty));
|
|
|
|
}
|
|
|
|
//更改货道容量-start
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(cargoCapacity)){
|
|
|
|
inventoryDO.setQty(Integer.parseInt(inventory.getQty()));
|
|
|
|
//2022-01-05-bug:13617-start
|
|
|
|
if (Integer.parseInt(inventory.getQty()) > Integer.parseInt(cargoCapacity)) {
|
|
|
|
//有药品时的补货
|
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
|
inventoryRecord.setQuantity(cargoCapacity);
|
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
|
inventoryRecord.setType("1");
|
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
|
|
inventory.setQty(cargoCapacity);
|
|
|
|
inventoryDO.setQty(Integer.parseInt(cargoCapacity));
|
|
|
|
//设置额定库存
|
|
|
|
inventory.setRatedInventory(Integer.parseInt(cargoCapacity));
|
|
|
|
}
|
|
|
|
//2022-01-05-bug:13617-end
|
|
|
|
if (Integer.parseInt(cargoCapacity) > 99) {
|
|
|
|
throw new Exception("货道容量最多99个,如超过请放置另一格");
|
|
|
|
}
|
|
|
|
inventory.setCargoCapacity(cargoCapacity);
|
|
|
|
cargoCapacityChanged = true;
|
|
|
|
}
|
|
|
|
//更改货道容量-end
|
|
|
|
//下架药品
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(status)){
|
|
|
|
//下架时,清空库存
|
|
|
|
if ("0".equals(status)) {
|
|
|
|
inventory.setQty("0");
|
|
|
|
inventoryDO.setQty(0);
|
|
|
|
inventory.setDrugCode(null);
|
|
|
|
inventory.setDrugId(null);
|
|
|
|
inventory.setDrugName(null);
|
|
|
|
inventory.setPrice(null);
|
|
|
|
//设置额定库存
|
|
|
|
inventory.setRatedInventory(0);
|
|
|
|
}
|
|
|
|
inventory.setShelfStatus(status);
|
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
|
inventoryRecord.setQuantity("0");
|
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
|
inventoryRecord.setType("4");
|
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
|
|
}
|
|
|
|
inventory.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
//更改设备缺货状态
|
|
|
|
updateDeviceState(inventory.getId(), inventoryDO);
|
|
|
|
|
|
|
|
mediicinecabinetInventory = inventoryDao.save(inventory);
|
|
|
|
//重算设备容量
|
|
|
|
if (cargoCapacityChanged) {
|
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(inventory.getIdDevice());
|
|
|
|
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.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());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mediicinedevice.setCapacity(String.valueOf(noOnlineTotal1));
|
|
|
|
deviceDao.save(mediicinedevice);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return mediicinecabinetInventory;
|
|
|
|
}else {
|
|
|
|
MediicinecabinetInventory inventory = inventoryDao.findOne(id);
|
|
|
|
//更新设备缺货状态的该药品的已变动数量
|
|
|
|
InventoryDO inventoryDO = new InventoryDO();
|
|
|
|
inventoryDO.setDrugCode(inventory.getDrugCode());
|
|
|
|
inventoryDO.setOrgCode(inventory.getOrgCode());
|
|
|
|
inventoryDO.setRatedInventory(inventory.getRatedInventory());
|
|
|
|
boolean cargoCapacityChanged = false;
|
|
|
|
//库存变动
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(qty)){
|
|
|
|
if (Integer.parseInt(qty) > 99) {
|
|
|
|
throw new Exception("库存数量最多99个,请重新设置");
|
|
|
|
}
|
|
//有药品时的补货
|
|
//有药品时的补货
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
@ -4369,80 +4486,113 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
inventoryRecord.setQuantity(cargoCapacity);
|
|
|
|
|
|
inventoryRecord.setQuantity(qty);
|
|
inventoryRecord.setCreateUser(userId);
|
|
inventoryRecord.setCreateUser(userId);
|
|
inventoryRecord.setType("1");
|
|
inventoryRecord.setType("1");
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
inventory.setQty(cargoCapacity);
|
|
|
|
inventoryDO.setQty(Integer.parseInt(cargoCapacity));
|
|
|
|
|
|
//提升容量至库存数(修改的库存数大于容量时)
|
|
|
|
if (Integer.parseInt(qty) > Integer.parseInt(inventory.getCargoCapacity())) {
|
|
|
|
cargoCapacityChanged = true;
|
|
|
|
inventory.setCargoCapacity(qty);
|
|
|
|
}
|
|
|
|
inventory.setQty(qty);
|
|
|
|
//库存变更已变更的数量
|
|
|
|
inventoryDO.setQty(Integer.parseInt(qty));
|
|
//设置额定库存
|
|
//设置额定库存
|
|
inventory.setRatedInventory(Integer.parseInt(cargoCapacity));
|
|
|
|
}
|
|
|
|
//2022-01-05-bug:13617-end
|
|
|
|
if (Integer.parseInt(cargoCapacity) > 99) {
|
|
|
|
throw new Exception("货道容量最多99个,如超过请放置另一格");
|
|
|
|
|
|
inventory.setRatedInventory(Integer.parseInt(qty));
|
|
|
|
}
|
|
|
|
//更改货道容量-start
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(cargoCapacity)){
|
|
|
|
inventoryDO.setQty(Integer.parseInt(inventory.getQty()));
|
|
|
|
//2022-01-05-bug:13617-start
|
|
|
|
if (Integer.parseInt(inventory.getQty()) > Integer.parseInt(cargoCapacity)) {
|
|
|
|
//有药品时的补货
|
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
|
inventoryRecord.setQuantity(cargoCapacity);
|
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
|
inventoryRecord.setType("1");
|
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
|
|
inventory.setQty(cargoCapacity);
|
|
|
|
inventoryDO.setQty(Integer.parseInt(cargoCapacity));
|
|
|
|
//设置额定库存
|
|
|
|
inventory.setRatedInventory(Integer.parseInt(cargoCapacity));
|
|
|
|
}
|
|
|
|
//2022-01-05-bug:13617-end
|
|
|
|
if (Integer.parseInt(cargoCapacity) > 99) {
|
|
|
|
throw new Exception("货道容量最多99个,如超过请放置另一格");
|
|
|
|
}
|
|
|
|
inventory.setCargoCapacity(cargoCapacity);
|
|
|
|
cargoCapacityChanged = true;
|
|
}
|
|
}
|
|
inventory.setCargoCapacity(cargoCapacity);
|
|
|
|
cargoCapacityChanged = true;
|
|
|
|
}
|
|
|
|
//更改货道容量-end
|
|
|
|
//下架药品
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(status)){
|
|
|
|
//下架时,清空库存
|
|
|
|
if ("0".equals(status)) {
|
|
|
|
inventory.setQty("0");
|
|
|
|
inventoryDO.setQty(0);
|
|
|
|
inventory.setDrugCode(null);
|
|
|
|
inventory.setDrugId(null);
|
|
|
|
inventory.setDrugName(null);
|
|
|
|
inventory.setPrice(null);
|
|
|
|
//设置额定库存
|
|
|
|
inventory.setRatedInventory(0);
|
|
|
|
|
|
//更改货道容量-end
|
|
|
|
//下架药品
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(status)){
|
|
|
|
//下架时,清空库存
|
|
|
|
if ("0".equals(status)) {
|
|
|
|
inventory.setQty("0");
|
|
|
|
inventoryDO.setQty(0);
|
|
|
|
inventory.setDrugCode(null);
|
|
|
|
inventory.setDrugId(null);
|
|
|
|
inventory.setDrugName(null);
|
|
|
|
inventory.setPrice(null);
|
|
|
|
//设置额定库存
|
|
|
|
inventory.setRatedInventory(0);
|
|
|
|
}
|
|
|
|
inventory.setShelfStatus(status);
|
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
|
inventoryRecord.setQuantity("0");
|
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
|
inventoryRecord.setType("4");
|
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
}
|
|
}
|
|
inventory.setShelfStatus(status);
|
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
|
inventoryRecord.setQuantity("0");
|
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
|
inventoryRecord.setType("4");
|
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
|
|
}
|
|
|
|
inventory.setUpdateTime(new Date());
|
|
|
|
|
|
inventory.setUpdateTime(new Date());
|
|
|
|
|
|
//更改设备缺货状态
|
|
|
|
updateDeviceState(inventory.getId(), inventoryDO);
|
|
|
|
|
|
//更改设备缺货状态
|
|
|
|
updateDeviceState(inventory.getId(), inventoryDO);
|
|
|
|
|
|
inventoryDao.save(inventory);
|
|
|
|
//重算设备容量
|
|
|
|
if (cargoCapacityChanged) {
|
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(inventory.getIdDevice());
|
|
|
|
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.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());
|
|
|
|
|
|
inventoryDao.save(inventory);
|
|
|
|
//重算设备容量
|
|
|
|
if (cargoCapacityChanged) {
|
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(inventory.getIdDevice());
|
|
|
|
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.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());
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
mediicinedevice.setCapacity(String.valueOf(noOnlineTotal1));
|
|
|
|
deviceDao.save(mediicinedevice);
|
|
}
|
|
}
|
|
mediicinedevice.setCapacity(String.valueOf(noOnlineTotal1));
|
|
|
|
deviceDao.save(mediicinedevice);
|
|
|
|
|
|
return inventory;
|
|
}
|
|
}
|
|
return inventory;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -5282,7 +5432,12 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
}
|
|
}
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(outDetailId)){
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(outDetailId)){
|
|
Mediicinestockoutdetail detail =mediicinestockoutdetailDao.findOne(outDetailId);
|
|
Mediicinestockoutdetail detail =mediicinestockoutdetailDao.findOne(outDetailId);
|
|
detail.setBatchNum(total+"");
|
|
|
|
|
|
if (org.apache.commons.lang.StringUtils.isNotBlank(detail.getBatchNum())){
|
|
|
|
detail.setBatchNum((total+Integer.parseInt(detail.getBatchNum()))+"");
|
|
|
|
}else {
|
|
|
|
detail.setBatchNum(total+"");
|
|
|
|
}
|
|
|
|
|
|
mediicinestockoutdetailDao.save(detail);
|
|
mediicinestockoutdetailDao.save(detail);
|
|
}
|
|
}
|
|
|
|
|