瀏覽代碼

Merge branch 'dev' of chaoren1/wlyy2.0 into medicare

wangzhinan 3 年之前
父節點
當前提交
bad4a01f03

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/a2dao/MediicinecabinetInventoryDao.java

@ -23,4 +23,7 @@ public interface MediicinecabinetInventoryDao extends PagingAndSortingRepository
    List<Map<String, Object>> selectByDeviceIdGroup(String deviceId);
    List<MediicinecabinetInventory> findMediicinecabinetInventoriesByLayerNoAndMerge(String layerNo, String merge);
}

+ 44 - 19
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineOrderService.java

@ -736,7 +736,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
     * @param status
     * @return
     */
//    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public JSONObject updateOrderOutStatus(String shipmentLogId, String status, String msg) {
        JSONObject result = new JSONObject();
        if (shipmentLogId == null || StringUtils.isEmpty(shipmentLogId)) {
@ -760,6 +760,33 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        medicineShipmentLog.setStatus(status);
        if ("2".equals(status)) {
            medicineShipmentLog.setOutTime(new Date());
            //判断订单是否完成,
            String sql = "SELECT\n" +
                    "\tcount(DISTINCT(id))\n" +
                    "FROM\n" +
                    "\tt_medicine_shipment_log\n" +
                    "WHERE\n" +
                    "\torder_id = '" + medicineShipmentLog.getOrderId() + "'";
            int totalShipmentLog = jdbcTemplate.queryForObject(sql, Integer.class);
            sql = "SELECT\n" +
                    "\tcount(DISTINCT(id))\n" +
                    "FROM\n" +
                    "\tt_medicine_shipment_log\n" +
                    "WHERE\n" +
                    "\torder_id = '" + medicineShipmentLog.getOrderId() + "'\n" +
                    "AND `status` = 2";
            //已出货
            int shipped = jdbcTemplate.queryForObject(sql, Integer.class);
            if (Integer.compare(totalShipmentLog, shipped + 1) == 0) {
                Mediicineorder order = orderDao.findOne(medicineShipmentLog.getOrderId());
                order.setSellState("1");
                orderDao.save(order);
            }
            if (Integer.compare(totalShipmentLog, shipped + 1) < 0) {
                result.put("msg", "订单已全部出货!");
                result.put("response", ConstantUtils.FAIL);
                return result;
            }
        }
        if (!StringUtils.isEmpty(msg)) {
            medicineShipmentLog.setDescription(msg);
@ -806,23 +833,21 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        //查询更新订单信息start
        //订单id
        String orderId = medicineShipmentLog.getOrderId();
        String sql = "SELECT\n" +
                "\tcount(DISTINCT(id))\n" +
                "FROM\n" +
                "\tt_medicine_shipment_log\n" +
                "WHERE\n" +
                "\torder_id = '" + orderId + "'\n" +
                "AND (`status` = 1\n" +
                "OR `status` = 3)";
        int count = jdbcTemplate.queryForObject(sql, Integer.class);
        if (count == 0) {
            Mediicineorder order = orderDao.findOne(orderId);
            order.setSellState("1");
            orderDao.save(order);
        }
//        String orderId = medicineShipmentLog.getOrderId();
//        String sql = "SELECT\n" +
//                "\tcount(DISTINCT(id))\n" +
//                "FROM\n" +
//                "\tt_medicine_shipment_log\n" +
//                "WHERE\n" +
//                "\torder_id = '" + orderId + "'\n" +
//                "AND (`status` = 1\n" +
//                "OR `status` = 3)";
//        int count = jdbcTemplate.queryForObject(sql, Integer.class);
//        if (count == 0) {
//            Mediicineorder order = orderDao.findOne(orderId);
//            order.setSellState("1");
//            orderDao.save(order);
//        }
        //end
        result.put("msg", ConstantUtils.SUCCESS);
        result.put("response", ConstantUtils.SUCCESS);
@ -841,7 +866,7 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
        String tempSql = "select IFNULL((select count(distinct(id)) from t_medicine_shipment_log where order_id = '"+orderId+"'), 0)";
        int count = jdbcTemplate.queryForObject(tempSql, Integer.class);
        if (count == 0) {
            result.put("msg", "订单未生成出货单");
            result.put("msg", "订单未生成出货单(订单异常)");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }

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

@ -241,7 +241,7 @@ public class MedicineStockUpService extends BaseJpaService<Mediicinestockup, Med
    public JSONObject queryUpListFullInfo(
            String startTime, String endTime, String replenishErAndTrackNum,
            String startTime, String endTime, String content,
            String community, String userId, int page, int size,String wechatId) throws Exception {
        JSONObject result = new JSONObject();
        UserDO user = userDao.findOne(userId);
@ -328,8 +328,8 @@ public class MedicineStockUpService extends BaseJpaService<Mediicinestockup, Med
            conditionSql += " AND  t.doc_time >= '" + startTime +"'" +
                    " AND t.doc_time <= '" + endTime + "'";
        }
        if (!StringUtils.isEmpty(replenishErAndTrackNum)){
            conditionSql += " and t.doc_num like '%" + replenishErAndTrackNum + "%'";
        if (!StringUtils.isEmpty(content)){
            conditionSql += " and concat(ifnull(t.`doc_num`,''),ifnull(bu.`name`, '')) like '%" + content + "%'";
        }
        if (!StringUtils.isEmpty(community)){
            conditionSql += " and t.community = '" + community + "'";

+ 38 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicinedeviceService.java

@ -693,15 +693,26 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                }
            }
        } else {
            for (String deviceId : cargoIds.split(",")) {
                if(!StringUtils.isEmpty(deviceId)){
                    MediicinecabinetInventory inventory = inventoryDao.findOne(deviceId);
                    deviceID = inventory.getIdDevice();
                    inventory.setMerge(inventory.getWayerNo());
                    inventory.setState("1");
                    inventoryDao.save(inventory);
                }
            }
            //因为拆分,前台就传了主货道的, so就查,主货道id吧,
            MediicinecabinetInventory inventory = inventoryDao.findOne(cargoIds);
            List<MediicinecabinetInventory> list = inventoryDao.findMediicinecabinetInventoriesByLayerNoAndMerge(inventory.getLayerNo(), inventory.getMerge());
            inventory.setMerge(inventory.getWayerNo());
            inventory.setState("1");
            inventoryDao.save(inventory);
            for (MediicinecabinetInventory mediicinecabinetInventory : list) {
                mediicinecabinetInventory.setMerge(mediicinecabinetInventory.getWayerNo());
                mediicinecabinetInventory.setState("1");
                inventoryDao.save(mediicinecabinetInventory);
            }
//            for (String deviceId : cargoIds.split(",")) {
//                if(!StringUtils.isEmpty(deviceId)){
//                    MediicinecabinetInventory inventory = inventoryDao.findOne(deviceId);
//                    deviceID = inventory.getIdDevice();
//                    inventory.setMerge(inventory.getWayerNo());
//                    inventory.setState("1");
//                    inventoryDao.save(inventory);
//                }
//            }
        }
        Mediicinedevice mediicinedevice = deviceDao.findOne(deviceID);
        if (mediicinedevice != null) {
@ -2127,6 +2138,23 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                    stringObjectMap.put("cardStatusName", "未知");
                }
            }
            String tempSql = "SELECT\n" +
                    "\tIFNULL(\n" +
                    "\t\t(\n" +
                    "\t\t\tSELECT\n" +
                    "\t\t\t\tsum(t.qty)\n" +
                    "\t\t\tFROM\n" +
                    "\t\t\t\tt_mediicinecabinet_inventory t\n" +
                    "\t\t\tWHERE\n" +
                    "\t\t\t\tt.id_device = '"+stringObjectMap.get("id").toString()+"'\n" +
                    "\t\t\tAND (t.state = '1' OR t.state = '21')\n" +
                    "\t\t\tAND t.shelf_status = '1'\n" +
                    "\t\t),\n" +
                    "\t\t0\n" +
                    "\t)";
            int inStock = jdbcTemplate.queryForObject(tempSql, Integer.class);
            //在架库存数
            stringObjectMap.put("shangPinKuCun", inStock);
        }
        String countSql = " select " +
                "     COUNT(DISTINCT (t.id)) as count " +
@ -2324,6 +2352,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                    inventoryRecordDao.findMedicineDrugInventoryRecordsByDeviceIdAndEquNumAndType(
                            stringObjectMap.get("id").toString(),
                            stringObjectMap.get("equNum").toString(), type));
        }
        String countSql = " select " +
                "     COUNT(DISTINCT (t.id)) as count " +