|
@ -83,9 +83,12 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
" from " +
|
|
|
" t_mediicine_device t " +
|
|
|
" where " +
|
|
|
" 1=1 and t.del = 1 and t.equ_num = ' " + deviceId + "' ";
|
|
|
" 1=1 and t.del = 1 and t.equ_num = '" + deviceId + "' ";
|
|
|
int count = jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
|
if (count > 0) {
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findMediicinedeviceByEquNum(deviceId);
|
|
|
mediicinedevice.setNetworkStatus("1");
|
|
|
deviceDao.save(mediicinedevice);
|
|
|
result.put("msg","deviceId is exist");
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
return result.toJSONString();
|
|
@ -114,7 +117,8 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
inventory.setLayerNo(String.valueOf(i+1));
|
|
|
inventory.setWayerNo(String.valueOf(i1+1));
|
|
|
//到底要存什么,deviceId device表中equNum
|
|
|
inventory.setIdDevice(deviceId);
|
|
|
inventory.setIdDevice(mediicinedevice.getId());
|
|
|
inventory.setEquNum(deviceId);
|
|
|
inventory.setState("0");
|
|
|
inventory.setCargoCapacity(mediicinedevice.getCargoCapacity());
|
|
|
inventory.setShelfStatus("0");
|
|
@ -127,6 +131,9 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 新增设备
|
|
|
* @param jsonData
|
|
@ -369,6 +376,28 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String updateDeviceNetworkStatus(String deviceId, String networkStatus){
|
|
|
JSONObject result = new JSONObject();
|
|
|
if(StringUtils.isEmpty(deviceId) && StringUtils.isEmpty(networkStatus)){
|
|
|
result.put("msg","deviceId and networkStatus is null");
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findMediicinedeviceByEquNum(deviceId);
|
|
|
if (mediicinedevice == null) {
|
|
|
result.put("msg","device doesn't exist");
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
mediicinedevice.setStatus(networkStatus);
|
|
|
this.save(mediicinedevice);
|
|
|
result.put("response",ConstantUtils.SUCCESS);
|
|
|
result.put("msg",mediicinedevice);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新设备销售状态
|
|
|
* @param deviceId
|
|
@ -783,7 +812,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
" t_mediicine_device AS t where t.del = 1\n";
|
|
|
|
|
|
// String conditionSql = " t.id in (select du.device_id from t_mediicine_device_user du where del = 1 and ',"+userId+",' LIKE CONCAT('%,',du.user_id,',%'))";
|
|
|
String conditionSql = " and t.id in (select du.device_id from t_mediicine_device_user du where del = 1 and du.user_id = '" + userId + "'";
|
|
|
String conditionSql = " and t.id in (select du.device_id from t_mediicine_device_user du where del = 1 and du.user_id = '" + userId + "')";
|
|
|
|
|
|
sql = sql + conditionSql;
|
|
|
|
|
@ -1468,24 +1497,26 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
deviceList = hibenateUtils.createSQLQuery(sencodSql);
|
|
|
}
|
|
|
for (Map<String, Object> stringObjectMap : deviceList) {
|
|
|
//库存
|
|
|
Integer qty = jdbcTemplate.queryForObject("SELECT\n" +
|
|
|
String tempSql = "SELECT\n" +
|
|
|
"\tsum(t.qty)\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt.id_device = '" + stringObjectMap.get("equNum") +"'\n" +
|
|
|
"AND t.shelf_status = 1", Integer.class);
|
|
|
"AND t.shelf_status = 1";
|
|
|
//库存
|
|
|
Integer qty = jdbcTemplate.queryForObject( tempSql, Integer.class);
|
|
|
|
|
|
stringObjectMap.put("daibuQty", Integer.parseInt(stringObjectMap.get("capacity").toString()) - qty);
|
|
|
stringObjectMap.put("xiajiaQty", jdbcTemplate.queryForObject("SELECT\n" +
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\tCOUNT(DISTINCT(id))\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt.id_device = ''\n" +
|
|
|
"AND t.shelf_status = 0", Integer.class));
|
|
|
Date buhuoDate = jdbcTemplate.queryForObject("SELECT\n" +
|
|
|
"AND t.shelf_status = 0";
|
|
|
stringObjectMap.put("xiajiaQty", jdbcTemplate.queryForObject( tempSql, Integer.class));
|
|
|
Date buhuoDate = jdbcTemplate.queryForObject( "SELECT\n" +
|
|
|
"\tcreate_time\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicine_stockrecord_detail\n" +
|
|
@ -1583,7 +1614,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
" t_mediicine_device AS t\n" +
|
|
|
"WHERE\n" +
|
|
|
"t.del = 1 AND \n" +
|
|
|
" and ',"+ deviceIds +",' LIKE CONCAT('%,',t.id,',%')\n";
|
|
|
" ',"+ deviceIds +",' LIKE CONCAT('%,',t.id,',%')\n";
|
|
|
if (!StringUtils.isEmpty(content)) {
|
|
|
sencodSql += " AND CONCAT(t.equ_num, t.equ_name) like '" + content +"'";
|
|
|
}
|
|
@ -1676,7 +1707,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
" t_mediicine_device AS t\n" +
|
|
|
"WHERE\n" +
|
|
|
"t.del = 1 AND \n" +
|
|
|
" and ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
|
|
|
" ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
|
|
|
if (!StringUtils.isEmpty(content)) {
|
|
|
sencodSql += " AND CONCAT(t.equ_num, t.equ_name) like '" + content +"'";
|
|
|
}
|
|
@ -2147,6 +2178,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
inventory.setShelfStatus("1");
|
|
|
inventory.setDrugId(drugId);
|
|
|
inventory.setQty(qty);
|
|
|
inventory.setPic(mediicinedrugs.getPic());
|
|
|
return inventoryDao.save(inventory);
|
|
|
}
|
|
|
|