|
@ -1610,25 +1610,29 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("device",device);
|
|
|
//货道总数----->行*列计算得出货道总数
|
|
|
String tempSql = "SELECT\n" +
|
|
|
"\tcount(distinct(t.layer_no)) as layerNum\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt.id_device = '"+device.getId()+"'";
|
|
|
int layerNum = jdbcTemplate.queryForObject(tempSql, Integer.class);
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\tcount(distinct(t.wayer_no)) as wayerNum\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt.id_device = '"+device.getId()+"'\n" +
|
|
|
"AND t.layer_no = '1'";
|
|
|
int wayerNum = jdbcTemplate.queryForObject(tempSql, Integer.class);
|
|
|
jsonObject.put("totalCargo", layerNum * wayerNum);
|
|
|
// String tempSql = "SELECT\n" +
|
|
|
// "\tcount(distinct(t.layer_no)) as layerNum\n" +
|
|
|
// "FROM\n" +
|
|
|
// "\tt_mediicinecabinet_inventory t\n" +
|
|
|
// "WHERE\n" +
|
|
|
// "\tt.id_device = '"+device.getId()+"'";
|
|
|
// int layerNum = jdbcTemplate.queryForObject(tempSql, Integer.class);
|
|
|
// tempSql = "SELECT\n" +
|
|
|
// "\tcount(distinct(t.wayer_no)) as wayerNum\n" +
|
|
|
// "FROM\n" +
|
|
|
// "\tt_mediicinecabinet_inventory t\n" +
|
|
|
// "WHERE\n" +
|
|
|
// "\tt.id_device = '"+device.getId()+"'\n" +
|
|
|
// "AND t.layer_no = '1'";
|
|
|
// int wayerNum = jdbcTemplate.queryForObject(tempSql, Integer.class);
|
|
|
|
|
|
//补货员端设备页面上的总货道
|
|
|
// jsonObject.put("totalCargo", layerNum * wayerNum);
|
|
|
|
|
|
|
|
|
//设备总货道容量---初始1200
|
|
|
jsonObject.put("deviceCapacity", device.getCapacity());
|
|
|
tempSql = "SELECT\n" +
|
|
|
String tempSql = "SELECT\n" +
|
|
|
"\tIFNULL(\n" +
|
|
|
"\t\t(\n" +
|
|
|
"\t\t\tSELECT\n" +
|
|
@ -1685,6 +1689,10 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
int drugNumber = list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) && "0".equals(String.valueOf(item.get("faultState"))))
|
|
|
.mapToInt(item -> Integer.parseInt(String.valueOf(item.get("qty")))).sum();
|
|
|
|
|
|
//总货道(合并货道的算一道)
|
|
|
jsonObject.put("totalCargo", list.size());
|
|
|
|
|
|
//关闭容量
|
|
|
// tempSql = "SELECT\n" +
|
|
|
// "\tifnull(sum(t.cargo_capacity), 0) AS closedCapacity\n" +
|
|
@ -2351,6 +2359,8 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"\tifnull(t.cargo_capacity, 0) AS cargoCapacity,\n" +
|
|
|
"\tifnull(t.qty, 0) AS qty,\n" +
|
|
|
"\tt.cargo_state AS cargoState,\n" +
|
|
|
"\tt.drug_code AS drugCode,\n" +
|
|
|
"\tt.org_code AS orgCode,\n" +
|
|
|
"\tt.fault_state AS faultState\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
@ -2397,14 +2407,28 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
// //空置率
|
|
|
// stringObjectMap.put("kongzhilv",
|
|
|
// new BigDecimal((number * 1.0) / Integer.parseInt(stringObjectMap.get("aisles").toString())).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
//newVersion
|
|
|
//正常货道数(正常的、开启的)
|
|
|
int normalCargoNumber = ((int) list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) && "0".equals(String.valueOf(item.get("faultState")))).count());
|
|
|
//已用货道数
|
|
|
//关闭的货道数
|
|
|
// int closedCargoNumber = ((int) list.stream()
|
|
|
// .filter(item -> "0".equals(String.valueOf(item.get("cargoState")))).count());
|
|
|
//已经设置药品的货道数
|
|
|
int alreadySetDrugNumber = ((int) list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) &&
|
|
|
"0".equals(String.valueOf(item.get("faultState"))) &&
|
|
|
!StringUtils.isEmpty(item.get("orgCode")) &&
|
|
|
!StringUtils.isEmpty(item.get("drugCode"))).count());
|
|
|
//未设置药品的货道数--->正常的开启的货道数--(单纯关闭的-故障即关闭的)(就关闭的)-已经设置药品的货道数,
|
|
|
int noSetDrugCargoNumber = normalCargoNumber - alreadySetDrugNumber;
|
|
|
stringObjectMap.put("weishezhishangpinhuodao", noSetDrugCargoNumber);
|
|
|
//newVersion
|
|
|
//已用货道数(有绑定数量的就行)
|
|
|
int usedCargoNumber = ((int) list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) &&
|
|
|
"0".equals(String.valueOf(item.get("faultState"))) &&
|
|
|
!StringUtils.isEmpty(item.get("orgCode")) &&
|
|
|
!StringUtils.isEmpty(item.get("drugCode")) &&
|
|
|
Integer.parseInt(String.valueOf(item.get("qty"))) > 0).count());
|
|
|
stringObjectMap.put("kongzhilv",
|
|
|
new BigDecimal(((normalCargoNumber-usedCargoNumber) * 1.0) / normalCargoNumber).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
@ -2668,6 +2692,8 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"\tifnull(t.cargo_capacity, 0) AS cargoCapacity,\n" +
|
|
|
"\tifnull(t.qty, 0) AS qty,\n" +
|
|
|
"\tt.cargo_state AS cargoState,\n" +
|
|
|
"\tt.drug_code AS drugCode,\n" +
|
|
|
"\tt.org_code AS orgCode,\n" +
|
|
|
"\tt.fault_state AS faultState\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
@ -2717,28 +2743,43 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
//在架库存数
|
|
|
stringObjectMap.put("shangPinKuCun", inStock);
|
|
|
//未设置商品货道
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\tcount(DISTINCT(t.id))\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory t\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt.id_device = '" + stringObjectMap.get("id").toString() + "'\n" +
|
|
|
"AND t.org_code IS NULL\n" +
|
|
|
"AND t.drug_code IS NULL\n" +
|
|
|
"AND (t.state = '1' OR t.state = '21')";
|
|
|
int number = jdbcTemplate.queryForObject(tempSql, Integer.class);
|
|
|
stringObjectMap.put("weishezhishangpinhuodao", number);
|
|
|
// tempSql = "SELECT\n" +
|
|
|
//// "\tcount(DISTINCT(t.id))\n" +
|
|
|
//// "FROM\n" +
|
|
|
//// "\tt_mediicinecabinet_inventory t\n" +
|
|
|
//// "WHERE\n" +
|
|
|
//// "\tt.id_device = '" + stringObjectMap.get("id").toString() + "'\n" +
|
|
|
//// "AND t.org_code IS NULL\n" +
|
|
|
//// "AND t.drug_code IS NULL\n" +
|
|
|
//// "AND (t.state = '1' OR t.state = '21')";
|
|
|
//// int number = jdbcTemplate.queryForObject(tempSql, Integer.class);
|
|
|
// stringObjectMap.put("weishezhishangpinhuodao", number);
|
|
|
//正常货道数(正常的、开启的)
|
|
|
int normalCargoNumber = ((int) list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) && "0".equals(String.valueOf(item.get("faultState")))).count());
|
|
|
//关闭的货道数
|
|
|
// int closedCargoNumber = ((int) list.stream()
|
|
|
// .filter(item -> "0".equals(String.valueOf(item.get("cargoState")))).count());
|
|
|
//已经设置药品的货道数
|
|
|
int alreadySetDrugNumber = ((int) list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) &&
|
|
|
"0".equals(String.valueOf(item.get("faultState"))) &&
|
|
|
!StringUtils.isEmpty(item.get("orgCode")) &&
|
|
|
!StringUtils.isEmpty(item.get("drugCode"))).count());
|
|
|
//未设置药品的货道数--->正常的开启的货道数--(单纯关闭的-故障即关闭的)(就关闭的)-已经设置药品的货道数,
|
|
|
int noSetDrugCargoNumber = normalCargoNumber - alreadySetDrugNumber;
|
|
|
stringObjectMap.put("weishezhishangpinhuodao", noSetDrugCargoNumber);
|
|
|
//空置率
|
|
|
// stringObjectMap.put("kongzhilv",
|
|
|
// new BigDecimal((number * 1.0) / Integer.parseInt(stringObjectMap.get("aisles").toString())).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
//newVersion
|
|
|
//正常货道数(正常的、开启的)
|
|
|
int normalCargoNumber = ((int) list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) && "0".equals(String.valueOf(item.get("faultState")))).count());
|
|
|
//已用货道数
|
|
|
|
|
|
//已用货道数,正常的开启的有药品数量的
|
|
|
int usedCargoNumber = ((int) list.stream()
|
|
|
.filter(item -> "1".equals(String.valueOf(item.get("cargoState"))) &&
|
|
|
"0".equals(String.valueOf(item.get("faultState"))) &&
|
|
|
!StringUtils.isEmpty(item.get("orgCode")) &&
|
|
|
!StringUtils.isEmpty(item.get("drugCode")) &&
|
|
|
Integer.parseInt(String.valueOf(item.get("qty"))) > 0).count());
|
|
|
|
|
|
stringObjectMap.put("kongzhilv",
|
|
@ -4764,7 +4805,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public MediicinecabinetInventory updateMediicinecabineInventoryInfoById(String id,String qty,String cargoCapacity,String status,Boolean refreshStatus,String userId) throws Exception {
|
|
|
public MediicinecabinetInventory updateMediicinecabineInventoryInfoById(String id,String qty,String cargoCapacity,String status, Boolean refreshStatus, String userId) throws Exception {
|
|
|
if (id.contains(",")){
|
|
|
String str[] = id.split(",");
|
|
|
MediicinecabinetInventory mediicinecabinetInventory = new MediicinecabinetInventory();
|