| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.nanometer.smartlab.dao.SysLaboratoryDao; |
| | | import com.nanometer.smartlab.entity.SysLaboratory; |
| | | import com.nanometer.smartlab.entity.SysLaboratoryContainer; |
| | | import com.nanometer.smartlab.entity.SysWarehouseContainer; |
| | | import com.nanometer.smartlab.exception.BusinessException; |
| | | import com.nanometer.smartlab.exception.ExceptionEnumCode; |
| | | import com.nanometer.smartlab.service.SysLaboratoryContainerService; |
| | | import com.nanometer.smartlab.service.SysLaboratoryService; |
| | | import com.nanometer.smartlab.service.SysWarehouseContainerService; |
| | | import org.apache.log4j.Logger; |
| | | import org.primefaces.context.RequestContext; |
| | | import org.primefaces.model.LazyDataModel; |
| | |
| | | |
| | | @Resource |
| | | private SysWarehouseService sysWarehouseService; |
| | | @Resource |
| | | private SysLaboratoryDao sysLaboratoryDao; |
| | | @Resource |
| | | private SysLaboratoryContainerService sysLaboratoryContainerService; |
| | | @Resource |
| | | private SysWarehouseContainerService sysWarehouseContainerService; |
| | | |
| | | /** |
| | | * 数据源 |
| | |
| | | return; |
| | | } |
| | | |
| | | this.sysWarehouseService.updateSysWarehouse(sysWarehouse); |
| | | SysLaboratory sysLaboratory = sysLaboratoryDao.getSysLaboratoryByName(sysWarehouse.getName()); |
| | | if (sysLaboratory != null) { |
| | | this.sysWarehouseService.updateSysWarehouse2(sysWarehouse,sysLaboratory); |
| | | } else { |
| | | this.sysWarehouseService.updateSysWarehouse(sysWarehouse); |
| | | } |
| | | |
| | | |
| | | FacesUtils.info("修改成功。"); |
| | | RequestContext.getCurrentInstance().execute("PF('dialog').hide()"); |
| | |
| | | FacesUtils.warn("请选择数据。"); |
| | | return; |
| | | } |
| | | |
| | | //判断下面是否有柜子,有就拒绝删除 |
| | | for (SysWarehouse sysWarehouse : selectedList) { |
| | | List<SysWarehouseContainer> list = sysWarehouseContainerService.getSysWarehouseContainerList(sysWarehouse.getId()); |
| | | if (list.size() > 0) { |
| | | throw new BusinessException(ExceptionEnumCode.SYS_ERR, "该仓库下还有货柜,请清除货柜后删除仓库"); |
| | | } |
| | | } |
| | | this.sysWarehouseService.deleteSysWarehouse(this.selectedList); |
| | | |
| | | FacesUtils.info("删除成功。"); |
| | | } catch (BusinessException e) { |
| | | logger.error(e.getMessage()); |
| | | FacesUtils.warn(e.getMessage()); |
| | | } catch (Exception e) { |
| | | logger.error("操作失败。", e); |
| | | FacesUtils.warn("操作失败。"); |