wangzhinan 3 лет назад
Родитель
Сommit
2a963286ac

+ 14 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/MediicinecabinetInventory.java

@ -109,6 +109,11 @@ public class MediicinecabinetInventory extends UuidIdentityEntityWithOperator im
     */
    private String merge;
    /**
     * 货道状态,1开启,0关闭,只针对出货的问题,初始化,默认关闭,1、解绑设备,2、设备初始化两位置涉及到
     */
    private String cargoState;
    public MediicinecabinetInventory() {
    }
@ -143,7 +148,7 @@ public class MediicinecabinetInventory extends UuidIdentityEntityWithOperator im
    public void setNum(String num) {
        this.num = num;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getLongtime() {
        return longtime;
    }
@ -256,7 +261,6 @@ public class MediicinecabinetInventory extends UuidIdentityEntityWithOperator im
        this.equNum = equNum;
    }
    public String getMerge() {
        return merge;
    }
@ -264,4 +268,12 @@ public class MediicinecabinetInventory extends UuidIdentityEntityWithOperator im
    public void setMerge(String merge) {
        this.merge = merge;
    }
    public String getCargoState() {
        return cargoState;
    }
    public void setCargoState(String cargoState) {
        this.cargoState = cargoState;
    }
}

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -186,6 +186,7 @@ public class BaseRequestMapping {
        public static final String updateDevEquName  = "/updateDevEquName";
        public static final String UNBINDDEVICE  = "/unbindDevice";
        public static final String mergeAndSplitCargo  = "/mergeAndSplitCargo";
        public static final String openAndCloseCargo  = "/openAndCloseCargo";
        public static final String getDeviceListByUserId  = "/getDeviceListByUserId";
        public static final String getDeviceListWithUserId  = "/getDeviceListWithUserId";
        public static final String getDeviceInventoryRecordListWithUserId  = "/getDeviceInventoryRecordListWithUserId";

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineDeviceEndpoint.java

@ -296,6 +296,22 @@ public class MedicineDeviceEndpoint extends EnvelopRestEndpoint {
    }
    @PostMapping(value = BaseRequestMapping.BaseDevice.openAndCloseCargo)
    @ApiOperation(value = "设备货道的开启和关闭")
    public Envelop openAndCloseCargo(
            @ApiParam(name = "cargoIds", value = "货道Id字符串", required = true)
            @RequestParam(value = "cargoIds") String cargoIds,
            @ApiParam(name = "cargoState", value = "货道开关状态,1开启,0关闭", required = true)
            @RequestParam(value = "cargoState") String cargoState) throws Exception {
        String str = deviceService.openAndCloseCargo(cargoIds, cargoState);
        JSONObject jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
    @GetMapping(value = BaseRequestMapping.BaseDevice.getDeviceListByPage)
    @ApiOperation(value = "分页查询设备列表")
    public PageEnvelop getDeviceListByPage(

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineOrderService.java

@ -1317,6 +1317,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
            Boolean shifoudouyouyao = true;
            map.put("orderStatus", "1");//默认都有药
            for (Mediicineorderdetail mediicineorderdetail : list) {
                //cargo_state = 1,货道开启的,药品才计入统计
                String secondSql = "SELECT\n" +
                        "\tifnull(\n" +
                        "\t\t(\n" +
@ -1325,6 +1326,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
                        "\t\t\tFROM\n" +
                        "\t\t\t\tt_mediicinecabinet_inventory t WHERE t.drug_code = '" + mediicineorderdetail.getDrugCode() + "'\n" +
                        "\t\t\tAND t.org_code = '" + mediicineorderdetail.getOrgCode() + "'\n" +
                        "\t\t\tAND t.cargo_state = '1'\n" +
                        "\t\t\tAND CONCAT(IFNULL(t.`id_device`,''), IFNULL(t.`equ_num`,'')) like '%" + deviceId + "%'\n" +
                        "\t\t\tGROUP BY\n" +
                        "\t\t\t\tt.drug_code,\n" +
@ -1413,6 +1415,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
                                    "WHERE\n" +
                                    "\tt.drug_code = '" + mediicineorderdetail.getDrugCode() + "'\n" +
                                    "AND t.org_code = '" + mediicineorderdetail.getOrgCode() + "'\n" +
                                    "AND t.cargo_state = '1'\n" +
                                    "AND CONCAT(IFNULL(t.`id_device`,''), IFNULL(t.`equ_num`,'')) like '%" + deviceId + "%'\n" +
                                    "AND ( t.state = '1' or t.state = '21')\n" +
                                    "and t.qty > 0"

+ 35 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicinedeviceService.java

@ -81,6 +81,13 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
    private MediicinewarrayDao mediicinewarrayDao;
    /**
     * 设备出货服务,创建设备,创建库存内容
     * @param deviceId
     * @param layer
     * @param wayer
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String createDevice(String deviceId, String layer, String wayer) {
        JSONObject result = new JSONObject();
@ -134,7 +141,10 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                inventory.setState("1");
                inventory.setMerge(String.valueOf(i1+1));
                inventory.setCargoCapacity(mediicinedevice.getCargoCapacity());
                //默认下架
                inventory.setShelfStatus("0");
                //默认货道关闭
                inventory.setCargoState("0");
                inventoryDao.save(inventory);
            }
        }
@ -604,6 +614,8 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                for (MediicinecabinetInventory inventory : list) {
                    inventory.setPic(null);
                    inventory.setShelfStatus("0");
                    //关闭货道
                    inventory.setCargoState("0");
                    inventory.setQty("0");
                    inventory.setDrugCode(null);
                    inventory.setDrugId(null);
@ -685,7 +697,29 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
        return result.toJSONString();
    }
    /**
     * 货道开启与关闭
     * @param cargoIds
     * @param isMerge
     * @return
     */
    public String openAndCloseCargo(String cargoIds, String cargoState){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(cargoIds)){
            result.put("msg","cargoIds is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        for (String cargoId : cargoIds.split(",")) {
            if(!StringUtils.isEmpty(cargoId)){
                MediicinecabinetInventory inventory = inventoryDao.findOne(cargoId);
                inventory.setCargoState(cargoState);
                inventoryDao.save(inventory);
            }
        }
        result.put("response",ConstantUtils.SUCCESS);
        return result.toJSONString();
    }
    /**
     * 分页查询设备信息getDeviceListByPage