|  | @ -85,6 +85,9 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private MediicineorderDao mediicineorderDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private MedicineShipmentLogDao medicineShipmentLogDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 设备出货服务,创建设备,创建库存内容
 | 
	
	
		
			
				|  | @ -150,8 +153,10 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |                 inventory.setCargoCapacity(mediicinedevice.getCargoCapacity());
 | 
	
		
			
				|  |  |                 //默认下架
 | 
	
		
			
				|  |  |                 inventory.setShelfStatus("0");
 | 
	
		
			
				|  |  |                 //默认货道关闭
 | 
	
		
			
				|  |  |                 //默认货道关闭(0)---->后续更改为开启的(1)
 | 
	
		
			
				|  |  |                 inventory.setCargoState("1");
 | 
	
		
			
				|  |  |                 //设备初始化库存,默认货道是正常的
 | 
	
		
			
				|  |  |                 inventory.setFaultState("0");
 | 
	
		
			
				|  |  |                 inventoryDao.save(inventory);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -3211,7 +3216,9 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |                     "t.price AS price,\n" +
 | 
	
		
			
				|  |  |                     "t.pic AS pic,\n" +
 | 
	
		
			
				|  |  |                     "t.equ_num AS equNum,\n" +
 | 
	
		
			
				|  |  |                     "t.`merge` AS `merge`" +
 | 
	
		
			
				|  |  |                     "t.`merge` AS `merge`,\n" +
 | 
	
		
			
				|  |  |                     "t.cargo_state AS cargoState,\n" +
 | 
	
		
			
				|  |  |                     "t.fault_state AS faultState\n" +
 | 
	
		
			
				|  |  |                     "FROM\n" +
 | 
	
		
			
				|  |  |                     "\tt_mediicinecabinet_inventory t\n" +
 | 
	
		
			
				|  |  |                     "WHERE\n" +
 | 
	
	
		
			
				|  | @ -3319,7 +3326,8 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |                     "t.pic AS pic,\n" +
 | 
	
		
			
				|  |  |                     "t.equ_num AS equNum,\n" +
 | 
	
		
			
				|  |  |                     "t.`merge` AS `merge`,\n" +
 | 
	
		
			
				|  |  |                     "t.cargo_state AS cargoState\n" +
 | 
	
		
			
				|  |  |                     "t.cargo_state AS cargoState,\n" +
 | 
	
		
			
				|  |  |                     "t.fault_state AS faultState\n" +
 | 
	
		
			
				|  |  |                     "FROM\n" +
 | 
	
		
			
				|  |  |                     "\tt_mediicinecabinet_inventory t\n" +
 | 
	
		
			
				|  |  |                     "WHERE\n" +
 | 
	
	
		
			
				|  | @ -3481,7 +3489,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |         boolean cargoCapacityChanged = false;
 | 
	
		
			
				|  |  |         if (org.apache.commons.lang3.StringUtils.isNoneBlank(qty)){
 | 
	
		
			
				|  |  |             if (Integer.parseInt(qty) > 99) {
 | 
	
		
			
				|  |  |                 throw new RuntimeException("库存数量最多99个,请重新设置");
 | 
	
		
			
				|  |  |                 throw new Exception("库存数量最多99个,请重新设置");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //有药品时的补货
 | 
	
		
			
				|  |  |             MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
 | 
	
	
		
			
				|  | @ -3854,4 +3862,52 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |         object.put("drugTotal",quantity);
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 更新出货单图片-出货图片
 | 
	
		
			
				|  |  |      * @param shipmentLogId
 | 
	
		
			
				|  |  |      * @param picPath
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Boolean updateShipmentLogPic(String shipmentLogId, String picPath) {
 | 
	
		
			
				|  |  |         MedicineShipmentLog shipmentLog = medicineShipmentLogDao.findOne(shipmentLogId);
 | 
	
		
			
				|  |  |         if (shipmentLog == null) {
 | 
	
		
			
				|  |  |             return false;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         shipmentLog.setPic(picPath);
 | 
	
		
			
				|  |  |         medicineShipmentLogDao.save(shipmentLog);
 | 
	
		
			
				|  |  |         return true;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 更新设备货道状态
 | 
	
		
			
				|  |  |      * @param equNum
 | 
	
		
			
				|  |  |      * @param layerNo
 | 
	
		
			
				|  |  |      * @param wayerNo
 | 
	
		
			
				|  |  |      * @param state
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Boolean updateDeviceCargoState(String equNum, String layerNo, String wayerNo, String state) {
 | 
	
		
			
				|  |  |         MediicinecabinetInventory inventory = inventoryDao.findMediicinecabinetInventoryByEquNumAndLayerNoAndWayerNo(equNum, layerNo, wayerNo);
 | 
	
		
			
				|  |  |         if (inventory == null) {
 | 
	
		
			
				|  |  |             return false;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //故障
 | 
	
		
			
				|  |  |         if ("1".equals(state)) {
 | 
	
		
			
				|  |  |             if ("1".equals(inventory.getCargoState())) {
 | 
	
		
			
				|  |  |                 //开启--->关闭
 | 
	
		
			
				|  |  |                 inventory.setCargoState("0");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             inventory.setFaultState("1");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //正常
 | 
	
		
			
				|  |  |         if ("0".equals(state)) {
 | 
	
		
			
				|  |  |             inventory.setFaultState("0");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         inventoryDao.save(inventory);
 | 
	
		
			
				|  |  |         return true;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |