diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt new file mode 100644 index 0000000..a14a920 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt @@ -0,0 +1,135 @@ +package com.casic.xz.meterage.view + +import android.content.Context +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.formatToYearMonthDay +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.isEarlierThenCurrent +import com.casic.xz.meterage.model.ScanResultModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.view.home.EquipmentDetailActivity +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.adapter.NormalRecyclerAdapter +import com.pengxh.kt.lite.adapter.ViewHolder +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.utils.Constant +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_tag_scan.* +import kotlinx.android.synthetic.main.include_search_title.* + +class TagScanResultActivity : KotlinBaseActivity() { + + private var context: Context = this@TagScanResultActivity + private lateinit var equipmentViewModel: EquipmentViewModel + private val tids = ArrayList() + + override fun initData() { + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + args.forEach { + tids.add(it) + } + + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.scanResult.observe(this) { + if (it.code == 200) { + //显示扫描到的列表 + val equipmentAdapter = object : NormalRecyclerAdapter( + R.layout.item_equipment_rv_l, it.data + ) { + override fun convertView( + viewHolder: ViewHolder, position: Int, item: ScanResultModel.DataModel + ) { + val modelNo = if (item.modelNo.isNullOrBlank()) { + "未知" + } else { + item.modelNo + } + + val remark = if (item.remark.isNullOrBlank()) { + "无" + } else { + item.remark + } + + val useDept = if (item.useDeptName.isNullOrBlank()) { + "未知" + } else { + item.useDeptName + } + + val usePerson = if (item.usePersonName.isNullOrBlank()) { + "无" + } else { + item.usePersonName + } + + if (item.validDate.isEarlierThenCurrent()) { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.red.convertColor(context) + ) + } else { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.gray.convertColor(context) + ) + } + + viewHolder.setText(R.id.equipmentName, item.equipmentName) + .setText(R.id.modelView, modelNo) + .setText(R.id.equipmentStateView, item.managerStateName) + .setText(R.id.equipmentCodeView, "装置编号:${item.equipmentNo}") + .setText(R.id.remarkView, "备注:$remark") + .setText(R.id.useDeptView, useDept) + .setText( + R.id.deviceDateView, + "有效期至:${item.validDate.formatToYearMonthDay()}" + ) + .setText(R.id.usePersonView, "管理员:$usePerson") + + if (!item.managerStateName.contains("在用")) { + viewHolder.setBackgroundColor( + R.id.equipmentStateView, R.color.gray.convertColor(context) + ) + } + } + } + scanDeviceRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + scanDeviceRecyclerView.adapter = equipmentAdapter + equipmentAdapter.setOnItemClickedListener(object : + NormalRecyclerAdapter.OnItemClickedListener { + override fun onItemClicked(position: Int, t: ScanResultModel.DataModel) { + navigatePageTo(t.id) + } + }) + } + } + equipmentViewModel.getScanResult(tids.toTypedArray()) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_tag_scan + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this) { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "结果加载中,请稍后") + else -> LoadingDialogHub.dismiss() + } + } + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "标签扫描结果" + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt new file mode 100644 index 0000000..a14a920 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt @@ -0,0 +1,135 @@ +package com.casic.xz.meterage.view + +import android.content.Context +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.formatToYearMonthDay +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.isEarlierThenCurrent +import com.casic.xz.meterage.model.ScanResultModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.view.home.EquipmentDetailActivity +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.adapter.NormalRecyclerAdapter +import com.pengxh.kt.lite.adapter.ViewHolder +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.utils.Constant +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_tag_scan.* +import kotlinx.android.synthetic.main.include_search_title.* + +class TagScanResultActivity : KotlinBaseActivity() { + + private var context: Context = this@TagScanResultActivity + private lateinit var equipmentViewModel: EquipmentViewModel + private val tids = ArrayList() + + override fun initData() { + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + args.forEach { + tids.add(it) + } + + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.scanResult.observe(this) { + if (it.code == 200) { + //显示扫描到的列表 + val equipmentAdapter = object : NormalRecyclerAdapter( + R.layout.item_equipment_rv_l, it.data + ) { + override fun convertView( + viewHolder: ViewHolder, position: Int, item: ScanResultModel.DataModel + ) { + val modelNo = if (item.modelNo.isNullOrBlank()) { + "未知" + } else { + item.modelNo + } + + val remark = if (item.remark.isNullOrBlank()) { + "无" + } else { + item.remark + } + + val useDept = if (item.useDeptName.isNullOrBlank()) { + "未知" + } else { + item.useDeptName + } + + val usePerson = if (item.usePersonName.isNullOrBlank()) { + "无" + } else { + item.usePersonName + } + + if (item.validDate.isEarlierThenCurrent()) { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.red.convertColor(context) + ) + } else { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.gray.convertColor(context) + ) + } + + viewHolder.setText(R.id.equipmentName, item.equipmentName) + .setText(R.id.modelView, modelNo) + .setText(R.id.equipmentStateView, item.managerStateName) + .setText(R.id.equipmentCodeView, "装置编号:${item.equipmentNo}") + .setText(R.id.remarkView, "备注:$remark") + .setText(R.id.useDeptView, useDept) + .setText( + R.id.deviceDateView, + "有效期至:${item.validDate.formatToYearMonthDay()}" + ) + .setText(R.id.usePersonView, "管理员:$usePerson") + + if (!item.managerStateName.contains("在用")) { + viewHolder.setBackgroundColor( + R.id.equipmentStateView, R.color.gray.convertColor(context) + ) + } + } + } + scanDeviceRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + scanDeviceRecyclerView.adapter = equipmentAdapter + equipmentAdapter.setOnItemClickedListener(object : + NormalRecyclerAdapter.OnItemClickedListener { + override fun onItemClicked(position: Int, t: ScanResultModel.DataModel) { + navigatePageTo(t.id) + } + }) + } + } + equipmentViewModel.getScanResult(tids.toTypedArray()) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_tag_scan + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this) { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "结果加载中,请稍后") + else -> LoadingDialogHub.dismiss() + } + } + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "标签扫描结果" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt index 7359ff3..e1cce6e 100644 --- a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -34,6 +34,7 @@ val remindDeviceCount = MutableLiveData() val remindDeviceList = MutableLiveData() val remindDeviceResult = MutableLiveData() + val scanResult = MutableLiveData() fun getEquipmentList( equipmentNo: String, @@ -378,4 +379,22 @@ }, { it.convertChinese().show(BaseApplication.get()) }) + + fun getScanResult(strSet: Array) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getScanResult(strSet) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + scanResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + loadState.value = LoadState.Success + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.convertChinese().show(BaseApplication.get()) + }) } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt new file mode 100644 index 0000000..a14a920 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt @@ -0,0 +1,135 @@ +package com.casic.xz.meterage.view + +import android.content.Context +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.formatToYearMonthDay +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.isEarlierThenCurrent +import com.casic.xz.meterage.model.ScanResultModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.view.home.EquipmentDetailActivity +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.adapter.NormalRecyclerAdapter +import com.pengxh.kt.lite.adapter.ViewHolder +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.utils.Constant +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_tag_scan.* +import kotlinx.android.synthetic.main.include_search_title.* + +class TagScanResultActivity : KotlinBaseActivity() { + + private var context: Context = this@TagScanResultActivity + private lateinit var equipmentViewModel: EquipmentViewModel + private val tids = ArrayList() + + override fun initData() { + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + args.forEach { + tids.add(it) + } + + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.scanResult.observe(this) { + if (it.code == 200) { + //显示扫描到的列表 + val equipmentAdapter = object : NormalRecyclerAdapter( + R.layout.item_equipment_rv_l, it.data + ) { + override fun convertView( + viewHolder: ViewHolder, position: Int, item: ScanResultModel.DataModel + ) { + val modelNo = if (item.modelNo.isNullOrBlank()) { + "未知" + } else { + item.modelNo + } + + val remark = if (item.remark.isNullOrBlank()) { + "无" + } else { + item.remark + } + + val useDept = if (item.useDeptName.isNullOrBlank()) { + "未知" + } else { + item.useDeptName + } + + val usePerson = if (item.usePersonName.isNullOrBlank()) { + "无" + } else { + item.usePersonName + } + + if (item.validDate.isEarlierThenCurrent()) { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.red.convertColor(context) + ) + } else { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.gray.convertColor(context) + ) + } + + viewHolder.setText(R.id.equipmentName, item.equipmentName) + .setText(R.id.modelView, modelNo) + .setText(R.id.equipmentStateView, item.managerStateName) + .setText(R.id.equipmentCodeView, "装置编号:${item.equipmentNo}") + .setText(R.id.remarkView, "备注:$remark") + .setText(R.id.useDeptView, useDept) + .setText( + R.id.deviceDateView, + "有效期至:${item.validDate.formatToYearMonthDay()}" + ) + .setText(R.id.usePersonView, "管理员:$usePerson") + + if (!item.managerStateName.contains("在用")) { + viewHolder.setBackgroundColor( + R.id.equipmentStateView, R.color.gray.convertColor(context) + ) + } + } + } + scanDeviceRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + scanDeviceRecyclerView.adapter = equipmentAdapter + equipmentAdapter.setOnItemClickedListener(object : + NormalRecyclerAdapter.OnItemClickedListener { + override fun onItemClicked(position: Int, t: ScanResultModel.DataModel) { + navigatePageTo(t.id) + } + }) + } + } + equipmentViewModel.getScanResult(tids.toTypedArray()) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_tag_scan + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this) { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "结果加载中,请稍后") + else -> LoadingDialogHub.dismiss() + } + } + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "标签扫描结果" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt index 7359ff3..e1cce6e 100644 --- a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -34,6 +34,7 @@ val remindDeviceCount = MutableLiveData() val remindDeviceList = MutableLiveData() val remindDeviceResult = MutableLiveData() + val scanResult = MutableLiveData() fun getEquipmentList( equipmentNo: String, @@ -378,4 +379,22 @@ }, { it.convertChinese().show(BaseApplication.get()) }) + + fun getScanResult(strSet: Array) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getScanResult(strSet) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + scanResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + loadState.value = LoadState.Success + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.convertChinese().show(BaseApplication.get()) + }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java new file mode 100644 index 0000000..ffe6012 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java @@ -0,0 +1,377 @@ +package com.casic.xz.meterage.widgets; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.SweepGradient; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.casic.xz.meterage.R; + +import java.util.ArrayList; +import java.util.Iterator; + +public class RadarView extends View { + + //默认的主题颜色 + private final int DEFAULT_COLOR = Color.parseColor("#008CFF"); + + // 圆圈和交叉线的颜色 + private int mCircleColor = DEFAULT_COLOR; + //圆圈的数量 不能小于1 + private int mCircleNum = 3; + //扫描的颜色 RadarView会对这个颜色做渐变透明处理 + private int mSweepColor = DEFAULT_COLOR; + //水滴的颜色 + private int mRaindropColor = DEFAULT_COLOR; + //水滴的数量 这里表示的是水滴最多能同时出现的数量。因为水滴是随机产生的,数量是不确定的 + private int mRaindropNum = 4; + //是否显示交叉线 + private boolean isShowCross = true; + //是否显示水滴 + private boolean isShowRaindrop = true; + //扫描的转速,表示几秒转一圈 + private float mSpeed = 3.0f; + //水滴显示和消失的速度 + private float mFlicker = 3.0f; + + private Paint mCirclePaint;// 圆的画笔 + private Paint mSweepPaint; //扫描效果的画笔 + private Paint mRaindropPaint;// 水滴的画笔 + + private float mDegrees; //扫描时的扫描旋转角度。 + private boolean isScanning = false;//是否扫描 + + //保存水滴数据 + private ArrayList mRaindrops = new ArrayList<>(); + + public RadarView(Context context) { + super(context); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + getAttrs(context, attrs); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + getAttrs(context, attrs); + init(); + } + + /** + * 获取自定义属性值 + * + * @param context + * @param attrs + */ + private void getAttrs(Context context, AttributeSet attrs) { + if (attrs != null) { + TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RadarView); + mCircleColor = mTypedArray.getColor(R.styleable.RadarView_circleColor, DEFAULT_COLOR); + mCircleNum = mTypedArray.getInt(R.styleable.RadarView_circleNum, mCircleNum); + if (mCircleNum < 1) { + mCircleNum = 3; + } + mSweepColor = mTypedArray.getColor(R.styleable.RadarView_sweepColor, DEFAULT_COLOR); + mRaindropColor = mTypedArray.getColor(R.styleable.RadarView_raindropColor, DEFAULT_COLOR); + mRaindropNum = mTypedArray.getInt(R.styleable.RadarView_raindropNum, mRaindropNum); + isShowCross = mTypedArray.getBoolean(R.styleable.RadarView_showCross, true); + isShowRaindrop = mTypedArray.getBoolean(R.styleable.RadarView_showRaindrop, true); + mSpeed = mTypedArray.getFloat(R.styleable.RadarView_speed, mSpeed); + if (mSpeed <= 0) { + mSpeed = 3; + } + mFlicker = mTypedArray.getFloat(R.styleable.RadarView_flicker, mFlicker); + if (mFlicker <= 0) { + mFlicker = 3; + } + mTypedArray.recycle(); + } + } + + /** + * 初始化 + */ + private void init() { + // 初始化画笔 + mCirclePaint = new Paint(); + mCirclePaint.setColor(mCircleColor); + mCirclePaint.setStrokeWidth(1); + mCirclePaint.setStyle(Paint.Style.STROKE); + mCirclePaint.setAntiAlias(true); + + mRaindropPaint = new Paint(); + mRaindropPaint.setStyle(Paint.Style.FILL); + mRaindropPaint.setAntiAlias(true); + + mSweepPaint = new Paint(); + mSweepPaint.setAntiAlias(true); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + //设置宽高,默认200dp + int defaultSize = dp2px(getContext(), 200); + setMeasuredDimension(measureWidth(widthMeasureSpec, defaultSize), + measureHeight(heightMeasureSpec, defaultSize)); + } + + /** + * 测量宽 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureWidth(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingLeft() + getPaddingRight(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumWidth()); + return result; + } + + /** + * 测量高 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureHeight(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingTop() + getPaddingBottom(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumHeight()); + return result; + } + + @Override + protected void onDraw(Canvas canvas) { + + //计算圆的半径 + int width = getWidth() - getPaddingLeft() - getPaddingRight(); + int height = getHeight() - getPaddingTop() - getPaddingBottom(); + int radius = Math.min(width, height) / 2; + + //计算圆的圆心 + int cx = getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight()) / 2; + int cy = getPaddingTop() + (getHeight() - getPaddingTop() - getPaddingBottom()) / 2; + + drawCircle(canvas, cx, cy, radius); + + if (isShowCross) { + drawCross(canvas, cx, cy, radius); + } + + //正在扫描 + if (isScanning) { + if (isShowRaindrop) { + drawRaindrop(canvas, cx, cy, radius); + } + drawSweep(canvas, cx, cy, radius); + //计算雷达扫描的旋转角度 + mDegrees = (mDegrees + (360 / mSpeed / 60)) % 360; + + //触发View重新绘制,通过不断的绘制View的扫描动画效果 + invalidate(); + } + } + + /** + * 画圆 + */ + private void drawCircle(Canvas canvas, int cx, int cy, int radius) { + //画mCircleNum个半径不等的圆圈。 + for (int i = 0; i < mCircleNum; i++) { + canvas.drawCircle(cx, cy, radius - (radius / mCircleNum * i), mCirclePaint); + } + } + + /** + * 画交叉线 + */ + private void drawCross(Canvas canvas, int cx, int cy, int radius) { + //水平线 + canvas.drawLine(cx - radius, cy, cx + radius, cy, mCirclePaint); + + //垂直线 + canvas.drawLine(cx, cy - radius, cx, cy + radius, mCirclePaint); + } + + /** + * 生成水滴。水滴的生成是随机的,并不是每次调用都会生成一个水滴。 + */ + private void generateRaindrop(int cx, int cy, int radius) { + + // 最多只能同时存在mRaindropNum个水滴。 + if (mRaindrops.size() < mRaindropNum) { + // 随机一个20以内的数字,如果这个数字刚好是0,就生成一个水滴。 + // 用于控制水滴生成的概率。 + boolean probability = (int) (Math.random() * 20) == 0; + if (probability) { + int x = 0; + int y = 0; + int xOffset = (int) (Math.random() * (radius - 20)); + int yOffset = (int) (Math.random() * (int) Math.sqrt(1.0 * (radius - 20) * (radius - 20) - xOffset * xOffset)); + + if ((int) (Math.random() * 2) == 0) { + x = cx - xOffset; + } else { + x = cx + xOffset; + } + + if ((int) (Math.random() * 2) == 0) { + y = cy - yOffset; + } else { + y = cy + yOffset; + } + + mRaindrops.add(new Raindrop(x, y, 0, mRaindropColor)); + } + } + } + + /** + * 删除水滴 + */ + private void removeRaindrop() { + Iterator iterator = mRaindrops.iterator(); + while (iterator.hasNext()) { + Raindrop raindrop = iterator.next(); + if (raindrop.radius > 20 || raindrop.alpha < 0) { + iterator.remove(); + } + } + } + + /** + * 画雨点(就是在扫描的过程中随机出现的点)。 + */ + private void drawRaindrop(Canvas canvas, int cx, int cy, int radius) { + generateRaindrop(cx, cy, radius); + for (Raindrop raindrop : mRaindrops) { + mRaindropPaint.setColor(raindrop.changeAlpha()); + canvas.drawCircle(raindrop.x, raindrop.y, raindrop.radius, mRaindropPaint); + //水滴的扩散和透明的渐变效果 + raindrop.radius += 1.0f * 20 / 60 / mFlicker; + raindrop.alpha -= 1.0f * 255 / 60 / mFlicker; + } + removeRaindrop(); + } + + /** + * 画扫描效果 + */ + private void drawSweep(Canvas canvas, int cx, int cy, int radius) { + //扇形的透明的渐变效果 + SweepGradient sweepGradient = new SweepGradient(cx, cy, + new int[]{Color.TRANSPARENT, changeAlpha(mSweepColor, 0), changeAlpha(mSweepColor, 168), + changeAlpha(mSweepColor, 255), changeAlpha(mSweepColor, 255) + }, new float[]{0.0f, 0.6f, 0.99f, 0.998f, 1f}); + mSweepPaint.setShader(sweepGradient); + //先旋转画布,再绘制扫描的颜色渲染,实现扫描时的旋转效果。 + canvas.rotate(-90 + mDegrees, cx, cy); + canvas.drawCircle(cx, cy, radius, mSweepPaint); + } + + /** + * 开始扫描 + */ + public void start() { + if (!isScanning) { + isScanning = true; + invalidate(); + } + } + + /** + * 停止扫描 + */ + public void stop() { + if (isScanning) { + isScanning = false; + mRaindrops.clear(); + mDegrees = 0.0f; + } + } + + /** + * 水滴数据类 + */ + private static class Raindrop { + int x; + int y; + float radius; + int color; + float alpha = 255; + + public Raindrop(int x, int y, float radius, int color) { + this.x = x; + this.y = y; + this.radius = radius; + this.color = color; + } + + /** + * 获取改变透明度后的颜色值 + * + * @return + */ + public int changeAlpha() { + return RadarView.changeAlpha(color, (int) alpha); + } + + } + + /** + * dp转px + */ + private static int dp2px(Context context, float dpVal) { + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + dpVal, context.getResources().getDisplayMetrics()); + } + + /** + * a + * 改变颜色的透明度 + * + * @param color + * @param alpha + * @return + */ + private static int changeAlpha(int color, int alpha) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + return Color.argb(alpha, red, green, blue); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt new file mode 100644 index 0000000..a14a920 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt @@ -0,0 +1,135 @@ +package com.casic.xz.meterage.view + +import android.content.Context +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.formatToYearMonthDay +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.isEarlierThenCurrent +import com.casic.xz.meterage.model.ScanResultModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.view.home.EquipmentDetailActivity +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.adapter.NormalRecyclerAdapter +import com.pengxh.kt.lite.adapter.ViewHolder +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.utils.Constant +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_tag_scan.* +import kotlinx.android.synthetic.main.include_search_title.* + +class TagScanResultActivity : KotlinBaseActivity() { + + private var context: Context = this@TagScanResultActivity + private lateinit var equipmentViewModel: EquipmentViewModel + private val tids = ArrayList() + + override fun initData() { + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + args.forEach { + tids.add(it) + } + + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.scanResult.observe(this) { + if (it.code == 200) { + //显示扫描到的列表 + val equipmentAdapter = object : NormalRecyclerAdapter( + R.layout.item_equipment_rv_l, it.data + ) { + override fun convertView( + viewHolder: ViewHolder, position: Int, item: ScanResultModel.DataModel + ) { + val modelNo = if (item.modelNo.isNullOrBlank()) { + "未知" + } else { + item.modelNo + } + + val remark = if (item.remark.isNullOrBlank()) { + "无" + } else { + item.remark + } + + val useDept = if (item.useDeptName.isNullOrBlank()) { + "未知" + } else { + item.useDeptName + } + + val usePerson = if (item.usePersonName.isNullOrBlank()) { + "无" + } else { + item.usePersonName + } + + if (item.validDate.isEarlierThenCurrent()) { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.red.convertColor(context) + ) + } else { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.gray.convertColor(context) + ) + } + + viewHolder.setText(R.id.equipmentName, item.equipmentName) + .setText(R.id.modelView, modelNo) + .setText(R.id.equipmentStateView, item.managerStateName) + .setText(R.id.equipmentCodeView, "装置编号:${item.equipmentNo}") + .setText(R.id.remarkView, "备注:$remark") + .setText(R.id.useDeptView, useDept) + .setText( + R.id.deviceDateView, + "有效期至:${item.validDate.formatToYearMonthDay()}" + ) + .setText(R.id.usePersonView, "管理员:$usePerson") + + if (!item.managerStateName.contains("在用")) { + viewHolder.setBackgroundColor( + R.id.equipmentStateView, R.color.gray.convertColor(context) + ) + } + } + } + scanDeviceRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + scanDeviceRecyclerView.adapter = equipmentAdapter + equipmentAdapter.setOnItemClickedListener(object : + NormalRecyclerAdapter.OnItemClickedListener { + override fun onItemClicked(position: Int, t: ScanResultModel.DataModel) { + navigatePageTo(t.id) + } + }) + } + } + equipmentViewModel.getScanResult(tids.toTypedArray()) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_tag_scan + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this) { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "结果加载中,请稍后") + else -> LoadingDialogHub.dismiss() + } + } + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "标签扫描结果" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt index 7359ff3..e1cce6e 100644 --- a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -34,6 +34,7 @@ val remindDeviceCount = MutableLiveData() val remindDeviceList = MutableLiveData() val remindDeviceResult = MutableLiveData() + val scanResult = MutableLiveData() fun getEquipmentList( equipmentNo: String, @@ -378,4 +379,22 @@ }, { it.convertChinese().show(BaseApplication.get()) }) + + fun getScanResult(strSet: Array) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getScanResult(strSet) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + scanResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + loadState.value = LoadState.Success + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.convertChinese().show(BaseApplication.get()) + }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java new file mode 100644 index 0000000..ffe6012 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java @@ -0,0 +1,377 @@ +package com.casic.xz.meterage.widgets; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.SweepGradient; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.casic.xz.meterage.R; + +import java.util.ArrayList; +import java.util.Iterator; + +public class RadarView extends View { + + //默认的主题颜色 + private final int DEFAULT_COLOR = Color.parseColor("#008CFF"); + + // 圆圈和交叉线的颜色 + private int mCircleColor = DEFAULT_COLOR; + //圆圈的数量 不能小于1 + private int mCircleNum = 3; + //扫描的颜色 RadarView会对这个颜色做渐变透明处理 + private int mSweepColor = DEFAULT_COLOR; + //水滴的颜色 + private int mRaindropColor = DEFAULT_COLOR; + //水滴的数量 这里表示的是水滴最多能同时出现的数量。因为水滴是随机产生的,数量是不确定的 + private int mRaindropNum = 4; + //是否显示交叉线 + private boolean isShowCross = true; + //是否显示水滴 + private boolean isShowRaindrop = true; + //扫描的转速,表示几秒转一圈 + private float mSpeed = 3.0f; + //水滴显示和消失的速度 + private float mFlicker = 3.0f; + + private Paint mCirclePaint;// 圆的画笔 + private Paint mSweepPaint; //扫描效果的画笔 + private Paint mRaindropPaint;// 水滴的画笔 + + private float mDegrees; //扫描时的扫描旋转角度。 + private boolean isScanning = false;//是否扫描 + + //保存水滴数据 + private ArrayList mRaindrops = new ArrayList<>(); + + public RadarView(Context context) { + super(context); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + getAttrs(context, attrs); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + getAttrs(context, attrs); + init(); + } + + /** + * 获取自定义属性值 + * + * @param context + * @param attrs + */ + private void getAttrs(Context context, AttributeSet attrs) { + if (attrs != null) { + TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RadarView); + mCircleColor = mTypedArray.getColor(R.styleable.RadarView_circleColor, DEFAULT_COLOR); + mCircleNum = mTypedArray.getInt(R.styleable.RadarView_circleNum, mCircleNum); + if (mCircleNum < 1) { + mCircleNum = 3; + } + mSweepColor = mTypedArray.getColor(R.styleable.RadarView_sweepColor, DEFAULT_COLOR); + mRaindropColor = mTypedArray.getColor(R.styleable.RadarView_raindropColor, DEFAULT_COLOR); + mRaindropNum = mTypedArray.getInt(R.styleable.RadarView_raindropNum, mRaindropNum); + isShowCross = mTypedArray.getBoolean(R.styleable.RadarView_showCross, true); + isShowRaindrop = mTypedArray.getBoolean(R.styleable.RadarView_showRaindrop, true); + mSpeed = mTypedArray.getFloat(R.styleable.RadarView_speed, mSpeed); + if (mSpeed <= 0) { + mSpeed = 3; + } + mFlicker = mTypedArray.getFloat(R.styleable.RadarView_flicker, mFlicker); + if (mFlicker <= 0) { + mFlicker = 3; + } + mTypedArray.recycle(); + } + } + + /** + * 初始化 + */ + private void init() { + // 初始化画笔 + mCirclePaint = new Paint(); + mCirclePaint.setColor(mCircleColor); + mCirclePaint.setStrokeWidth(1); + mCirclePaint.setStyle(Paint.Style.STROKE); + mCirclePaint.setAntiAlias(true); + + mRaindropPaint = new Paint(); + mRaindropPaint.setStyle(Paint.Style.FILL); + mRaindropPaint.setAntiAlias(true); + + mSweepPaint = new Paint(); + mSweepPaint.setAntiAlias(true); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + //设置宽高,默认200dp + int defaultSize = dp2px(getContext(), 200); + setMeasuredDimension(measureWidth(widthMeasureSpec, defaultSize), + measureHeight(heightMeasureSpec, defaultSize)); + } + + /** + * 测量宽 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureWidth(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingLeft() + getPaddingRight(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumWidth()); + return result; + } + + /** + * 测量高 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureHeight(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingTop() + getPaddingBottom(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumHeight()); + return result; + } + + @Override + protected void onDraw(Canvas canvas) { + + //计算圆的半径 + int width = getWidth() - getPaddingLeft() - getPaddingRight(); + int height = getHeight() - getPaddingTop() - getPaddingBottom(); + int radius = Math.min(width, height) / 2; + + //计算圆的圆心 + int cx = getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight()) / 2; + int cy = getPaddingTop() + (getHeight() - getPaddingTop() - getPaddingBottom()) / 2; + + drawCircle(canvas, cx, cy, radius); + + if (isShowCross) { + drawCross(canvas, cx, cy, radius); + } + + //正在扫描 + if (isScanning) { + if (isShowRaindrop) { + drawRaindrop(canvas, cx, cy, radius); + } + drawSweep(canvas, cx, cy, radius); + //计算雷达扫描的旋转角度 + mDegrees = (mDegrees + (360 / mSpeed / 60)) % 360; + + //触发View重新绘制,通过不断的绘制View的扫描动画效果 + invalidate(); + } + } + + /** + * 画圆 + */ + private void drawCircle(Canvas canvas, int cx, int cy, int radius) { + //画mCircleNum个半径不等的圆圈。 + for (int i = 0; i < mCircleNum; i++) { + canvas.drawCircle(cx, cy, radius - (radius / mCircleNum * i), mCirclePaint); + } + } + + /** + * 画交叉线 + */ + private void drawCross(Canvas canvas, int cx, int cy, int radius) { + //水平线 + canvas.drawLine(cx - radius, cy, cx + radius, cy, mCirclePaint); + + //垂直线 + canvas.drawLine(cx, cy - radius, cx, cy + radius, mCirclePaint); + } + + /** + * 生成水滴。水滴的生成是随机的,并不是每次调用都会生成一个水滴。 + */ + private void generateRaindrop(int cx, int cy, int radius) { + + // 最多只能同时存在mRaindropNum个水滴。 + if (mRaindrops.size() < mRaindropNum) { + // 随机一个20以内的数字,如果这个数字刚好是0,就生成一个水滴。 + // 用于控制水滴生成的概率。 + boolean probability = (int) (Math.random() * 20) == 0; + if (probability) { + int x = 0; + int y = 0; + int xOffset = (int) (Math.random() * (radius - 20)); + int yOffset = (int) (Math.random() * (int) Math.sqrt(1.0 * (radius - 20) * (radius - 20) - xOffset * xOffset)); + + if ((int) (Math.random() * 2) == 0) { + x = cx - xOffset; + } else { + x = cx + xOffset; + } + + if ((int) (Math.random() * 2) == 0) { + y = cy - yOffset; + } else { + y = cy + yOffset; + } + + mRaindrops.add(new Raindrop(x, y, 0, mRaindropColor)); + } + } + } + + /** + * 删除水滴 + */ + private void removeRaindrop() { + Iterator iterator = mRaindrops.iterator(); + while (iterator.hasNext()) { + Raindrop raindrop = iterator.next(); + if (raindrop.radius > 20 || raindrop.alpha < 0) { + iterator.remove(); + } + } + } + + /** + * 画雨点(就是在扫描的过程中随机出现的点)。 + */ + private void drawRaindrop(Canvas canvas, int cx, int cy, int radius) { + generateRaindrop(cx, cy, radius); + for (Raindrop raindrop : mRaindrops) { + mRaindropPaint.setColor(raindrop.changeAlpha()); + canvas.drawCircle(raindrop.x, raindrop.y, raindrop.radius, mRaindropPaint); + //水滴的扩散和透明的渐变效果 + raindrop.radius += 1.0f * 20 / 60 / mFlicker; + raindrop.alpha -= 1.0f * 255 / 60 / mFlicker; + } + removeRaindrop(); + } + + /** + * 画扫描效果 + */ + private void drawSweep(Canvas canvas, int cx, int cy, int radius) { + //扇形的透明的渐变效果 + SweepGradient sweepGradient = new SweepGradient(cx, cy, + new int[]{Color.TRANSPARENT, changeAlpha(mSweepColor, 0), changeAlpha(mSweepColor, 168), + changeAlpha(mSweepColor, 255), changeAlpha(mSweepColor, 255) + }, new float[]{0.0f, 0.6f, 0.99f, 0.998f, 1f}); + mSweepPaint.setShader(sweepGradient); + //先旋转画布,再绘制扫描的颜色渲染,实现扫描时的旋转效果。 + canvas.rotate(-90 + mDegrees, cx, cy); + canvas.drawCircle(cx, cy, radius, mSweepPaint); + } + + /** + * 开始扫描 + */ + public void start() { + if (!isScanning) { + isScanning = true; + invalidate(); + } + } + + /** + * 停止扫描 + */ + public void stop() { + if (isScanning) { + isScanning = false; + mRaindrops.clear(); + mDegrees = 0.0f; + } + } + + /** + * 水滴数据类 + */ + private static class Raindrop { + int x; + int y; + float radius; + int color; + float alpha = 255; + + public Raindrop(int x, int y, float radius, int color) { + this.x = x; + this.y = y; + this.radius = radius; + this.color = color; + } + + /** + * 获取改变透明度后的颜色值 + * + * @return + */ + public int changeAlpha() { + return RadarView.changeAlpha(color, (int) alpha); + } + + } + + /** + * dp转px + */ + private static int dp2px(Context context, float dpVal) { + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + dpVal, context.getResources().getDisplayMetrics()); + } + + /** + * a + * 改变颜色的透明度 + * + * @param color + * @param alpha + * @return + */ + private static int changeAlpha(int color, int alpha) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + return Color.argb(alpha, red, green, blue); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt new file mode 100644 index 0000000..ed3e6c1 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt @@ -0,0 +1,18 @@ +package com.casic.xz.meterage.widgets + +import android.app.Dialog +import android.content.Context +import android.os.Bundle +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.extensions.initDialogLayoutParams +import kotlinx.android.synthetic.main.dialog_scan_tag.* + +class ScanAnimationDialog(context: Context) : Dialog(context, R.style.UserDefinedDialogStyle) { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams(0.8f) + setContentView(R.layout.dialog_scan_tag) + setCanceledOnTouchOutside(false) + radarView.start() + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt new file mode 100644 index 0000000..a14a920 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt @@ -0,0 +1,135 @@ +package com.casic.xz.meterage.view + +import android.content.Context +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.formatToYearMonthDay +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.isEarlierThenCurrent +import com.casic.xz.meterage.model.ScanResultModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.view.home.EquipmentDetailActivity +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.adapter.NormalRecyclerAdapter +import com.pengxh.kt.lite.adapter.ViewHolder +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.utils.Constant +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_tag_scan.* +import kotlinx.android.synthetic.main.include_search_title.* + +class TagScanResultActivity : KotlinBaseActivity() { + + private var context: Context = this@TagScanResultActivity + private lateinit var equipmentViewModel: EquipmentViewModel + private val tids = ArrayList() + + override fun initData() { + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + args.forEach { + tids.add(it) + } + + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.scanResult.observe(this) { + if (it.code == 200) { + //显示扫描到的列表 + val equipmentAdapter = object : NormalRecyclerAdapter( + R.layout.item_equipment_rv_l, it.data + ) { + override fun convertView( + viewHolder: ViewHolder, position: Int, item: ScanResultModel.DataModel + ) { + val modelNo = if (item.modelNo.isNullOrBlank()) { + "未知" + } else { + item.modelNo + } + + val remark = if (item.remark.isNullOrBlank()) { + "无" + } else { + item.remark + } + + val useDept = if (item.useDeptName.isNullOrBlank()) { + "未知" + } else { + item.useDeptName + } + + val usePerson = if (item.usePersonName.isNullOrBlank()) { + "无" + } else { + item.usePersonName + } + + if (item.validDate.isEarlierThenCurrent()) { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.red.convertColor(context) + ) + } else { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.gray.convertColor(context) + ) + } + + viewHolder.setText(R.id.equipmentName, item.equipmentName) + .setText(R.id.modelView, modelNo) + .setText(R.id.equipmentStateView, item.managerStateName) + .setText(R.id.equipmentCodeView, "装置编号:${item.equipmentNo}") + .setText(R.id.remarkView, "备注:$remark") + .setText(R.id.useDeptView, useDept) + .setText( + R.id.deviceDateView, + "有效期至:${item.validDate.formatToYearMonthDay()}" + ) + .setText(R.id.usePersonView, "管理员:$usePerson") + + if (!item.managerStateName.contains("在用")) { + viewHolder.setBackgroundColor( + R.id.equipmentStateView, R.color.gray.convertColor(context) + ) + } + } + } + scanDeviceRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + scanDeviceRecyclerView.adapter = equipmentAdapter + equipmentAdapter.setOnItemClickedListener(object : + NormalRecyclerAdapter.OnItemClickedListener { + override fun onItemClicked(position: Int, t: ScanResultModel.DataModel) { + navigatePageTo(t.id) + } + }) + } + } + equipmentViewModel.getScanResult(tids.toTypedArray()) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_tag_scan + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this) { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "结果加载中,请稍后") + else -> LoadingDialogHub.dismiss() + } + } + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "标签扫描结果" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt index 7359ff3..e1cce6e 100644 --- a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -34,6 +34,7 @@ val remindDeviceCount = MutableLiveData() val remindDeviceList = MutableLiveData() val remindDeviceResult = MutableLiveData() + val scanResult = MutableLiveData() fun getEquipmentList( equipmentNo: String, @@ -378,4 +379,22 @@ }, { it.convertChinese().show(BaseApplication.get()) }) + + fun getScanResult(strSet: Array) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getScanResult(strSet) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + scanResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + loadState.value = LoadState.Success + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.convertChinese().show(BaseApplication.get()) + }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java new file mode 100644 index 0000000..ffe6012 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java @@ -0,0 +1,377 @@ +package com.casic.xz.meterage.widgets; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.SweepGradient; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.casic.xz.meterage.R; + +import java.util.ArrayList; +import java.util.Iterator; + +public class RadarView extends View { + + //默认的主题颜色 + private final int DEFAULT_COLOR = Color.parseColor("#008CFF"); + + // 圆圈和交叉线的颜色 + private int mCircleColor = DEFAULT_COLOR; + //圆圈的数量 不能小于1 + private int mCircleNum = 3; + //扫描的颜色 RadarView会对这个颜色做渐变透明处理 + private int mSweepColor = DEFAULT_COLOR; + //水滴的颜色 + private int mRaindropColor = DEFAULT_COLOR; + //水滴的数量 这里表示的是水滴最多能同时出现的数量。因为水滴是随机产生的,数量是不确定的 + private int mRaindropNum = 4; + //是否显示交叉线 + private boolean isShowCross = true; + //是否显示水滴 + private boolean isShowRaindrop = true; + //扫描的转速,表示几秒转一圈 + private float mSpeed = 3.0f; + //水滴显示和消失的速度 + private float mFlicker = 3.0f; + + private Paint mCirclePaint;// 圆的画笔 + private Paint mSweepPaint; //扫描效果的画笔 + private Paint mRaindropPaint;// 水滴的画笔 + + private float mDegrees; //扫描时的扫描旋转角度。 + private boolean isScanning = false;//是否扫描 + + //保存水滴数据 + private ArrayList mRaindrops = new ArrayList<>(); + + public RadarView(Context context) { + super(context); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + getAttrs(context, attrs); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + getAttrs(context, attrs); + init(); + } + + /** + * 获取自定义属性值 + * + * @param context + * @param attrs + */ + private void getAttrs(Context context, AttributeSet attrs) { + if (attrs != null) { + TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RadarView); + mCircleColor = mTypedArray.getColor(R.styleable.RadarView_circleColor, DEFAULT_COLOR); + mCircleNum = mTypedArray.getInt(R.styleable.RadarView_circleNum, mCircleNum); + if (mCircleNum < 1) { + mCircleNum = 3; + } + mSweepColor = mTypedArray.getColor(R.styleable.RadarView_sweepColor, DEFAULT_COLOR); + mRaindropColor = mTypedArray.getColor(R.styleable.RadarView_raindropColor, DEFAULT_COLOR); + mRaindropNum = mTypedArray.getInt(R.styleable.RadarView_raindropNum, mRaindropNum); + isShowCross = mTypedArray.getBoolean(R.styleable.RadarView_showCross, true); + isShowRaindrop = mTypedArray.getBoolean(R.styleable.RadarView_showRaindrop, true); + mSpeed = mTypedArray.getFloat(R.styleable.RadarView_speed, mSpeed); + if (mSpeed <= 0) { + mSpeed = 3; + } + mFlicker = mTypedArray.getFloat(R.styleable.RadarView_flicker, mFlicker); + if (mFlicker <= 0) { + mFlicker = 3; + } + mTypedArray.recycle(); + } + } + + /** + * 初始化 + */ + private void init() { + // 初始化画笔 + mCirclePaint = new Paint(); + mCirclePaint.setColor(mCircleColor); + mCirclePaint.setStrokeWidth(1); + mCirclePaint.setStyle(Paint.Style.STROKE); + mCirclePaint.setAntiAlias(true); + + mRaindropPaint = new Paint(); + mRaindropPaint.setStyle(Paint.Style.FILL); + mRaindropPaint.setAntiAlias(true); + + mSweepPaint = new Paint(); + mSweepPaint.setAntiAlias(true); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + //设置宽高,默认200dp + int defaultSize = dp2px(getContext(), 200); + setMeasuredDimension(measureWidth(widthMeasureSpec, defaultSize), + measureHeight(heightMeasureSpec, defaultSize)); + } + + /** + * 测量宽 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureWidth(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingLeft() + getPaddingRight(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumWidth()); + return result; + } + + /** + * 测量高 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureHeight(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingTop() + getPaddingBottom(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumHeight()); + return result; + } + + @Override + protected void onDraw(Canvas canvas) { + + //计算圆的半径 + int width = getWidth() - getPaddingLeft() - getPaddingRight(); + int height = getHeight() - getPaddingTop() - getPaddingBottom(); + int radius = Math.min(width, height) / 2; + + //计算圆的圆心 + int cx = getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight()) / 2; + int cy = getPaddingTop() + (getHeight() - getPaddingTop() - getPaddingBottom()) / 2; + + drawCircle(canvas, cx, cy, radius); + + if (isShowCross) { + drawCross(canvas, cx, cy, radius); + } + + //正在扫描 + if (isScanning) { + if (isShowRaindrop) { + drawRaindrop(canvas, cx, cy, radius); + } + drawSweep(canvas, cx, cy, radius); + //计算雷达扫描的旋转角度 + mDegrees = (mDegrees + (360 / mSpeed / 60)) % 360; + + //触发View重新绘制,通过不断的绘制View的扫描动画效果 + invalidate(); + } + } + + /** + * 画圆 + */ + private void drawCircle(Canvas canvas, int cx, int cy, int radius) { + //画mCircleNum个半径不等的圆圈。 + for (int i = 0; i < mCircleNum; i++) { + canvas.drawCircle(cx, cy, radius - (radius / mCircleNum * i), mCirclePaint); + } + } + + /** + * 画交叉线 + */ + private void drawCross(Canvas canvas, int cx, int cy, int radius) { + //水平线 + canvas.drawLine(cx - radius, cy, cx + radius, cy, mCirclePaint); + + //垂直线 + canvas.drawLine(cx, cy - radius, cx, cy + radius, mCirclePaint); + } + + /** + * 生成水滴。水滴的生成是随机的,并不是每次调用都会生成一个水滴。 + */ + private void generateRaindrop(int cx, int cy, int radius) { + + // 最多只能同时存在mRaindropNum个水滴。 + if (mRaindrops.size() < mRaindropNum) { + // 随机一个20以内的数字,如果这个数字刚好是0,就生成一个水滴。 + // 用于控制水滴生成的概率。 + boolean probability = (int) (Math.random() * 20) == 0; + if (probability) { + int x = 0; + int y = 0; + int xOffset = (int) (Math.random() * (radius - 20)); + int yOffset = (int) (Math.random() * (int) Math.sqrt(1.0 * (radius - 20) * (radius - 20) - xOffset * xOffset)); + + if ((int) (Math.random() * 2) == 0) { + x = cx - xOffset; + } else { + x = cx + xOffset; + } + + if ((int) (Math.random() * 2) == 0) { + y = cy - yOffset; + } else { + y = cy + yOffset; + } + + mRaindrops.add(new Raindrop(x, y, 0, mRaindropColor)); + } + } + } + + /** + * 删除水滴 + */ + private void removeRaindrop() { + Iterator iterator = mRaindrops.iterator(); + while (iterator.hasNext()) { + Raindrop raindrop = iterator.next(); + if (raindrop.radius > 20 || raindrop.alpha < 0) { + iterator.remove(); + } + } + } + + /** + * 画雨点(就是在扫描的过程中随机出现的点)。 + */ + private void drawRaindrop(Canvas canvas, int cx, int cy, int radius) { + generateRaindrop(cx, cy, radius); + for (Raindrop raindrop : mRaindrops) { + mRaindropPaint.setColor(raindrop.changeAlpha()); + canvas.drawCircle(raindrop.x, raindrop.y, raindrop.radius, mRaindropPaint); + //水滴的扩散和透明的渐变效果 + raindrop.radius += 1.0f * 20 / 60 / mFlicker; + raindrop.alpha -= 1.0f * 255 / 60 / mFlicker; + } + removeRaindrop(); + } + + /** + * 画扫描效果 + */ + private void drawSweep(Canvas canvas, int cx, int cy, int radius) { + //扇形的透明的渐变效果 + SweepGradient sweepGradient = new SweepGradient(cx, cy, + new int[]{Color.TRANSPARENT, changeAlpha(mSweepColor, 0), changeAlpha(mSweepColor, 168), + changeAlpha(mSweepColor, 255), changeAlpha(mSweepColor, 255) + }, new float[]{0.0f, 0.6f, 0.99f, 0.998f, 1f}); + mSweepPaint.setShader(sweepGradient); + //先旋转画布,再绘制扫描的颜色渲染,实现扫描时的旋转效果。 + canvas.rotate(-90 + mDegrees, cx, cy); + canvas.drawCircle(cx, cy, radius, mSweepPaint); + } + + /** + * 开始扫描 + */ + public void start() { + if (!isScanning) { + isScanning = true; + invalidate(); + } + } + + /** + * 停止扫描 + */ + public void stop() { + if (isScanning) { + isScanning = false; + mRaindrops.clear(); + mDegrees = 0.0f; + } + } + + /** + * 水滴数据类 + */ + private static class Raindrop { + int x; + int y; + float radius; + int color; + float alpha = 255; + + public Raindrop(int x, int y, float radius, int color) { + this.x = x; + this.y = y; + this.radius = radius; + this.color = color; + } + + /** + * 获取改变透明度后的颜色值 + * + * @return + */ + public int changeAlpha() { + return RadarView.changeAlpha(color, (int) alpha); + } + + } + + /** + * dp转px + */ + private static int dp2px(Context context, float dpVal) { + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + dpVal, context.getResources().getDisplayMetrics()); + } + + /** + * a + * 改变颜色的透明度 + * + * @param color + * @param alpha + * @return + */ + private static int changeAlpha(int color, int alpha) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + return Color.argb(alpha, red, green, blue); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt new file mode 100644 index 0000000..ed3e6c1 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt @@ -0,0 +1,18 @@ +package com.casic.xz.meterage.widgets + +import android.app.Dialog +import android.content.Context +import android.os.Bundle +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.extensions.initDialogLayoutParams +import kotlinx.android.synthetic.main.dialog_scan_tag.* + +class ScanAnimationDialog(context: Context) : Dialog(context, R.style.UserDefinedDialogStyle) { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams(0.8f) + setContentView(R.layout.dialog_scan_tag) + setCanceledOnTouchOutside(false) + radarView.start() + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_tag_scan.xml b/app/src/main/res/layout/activity_tag_scan.xml new file mode 100644 index 0000000..1480075 --- /dev/null +++ b/app/src/main/res/layout/activity_tag_scan.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt new file mode 100644 index 0000000..a14a920 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt @@ -0,0 +1,135 @@ +package com.casic.xz.meterage.view + +import android.content.Context +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.formatToYearMonthDay +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.isEarlierThenCurrent +import com.casic.xz.meterage.model.ScanResultModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.view.home.EquipmentDetailActivity +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.adapter.NormalRecyclerAdapter +import com.pengxh.kt.lite.adapter.ViewHolder +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.utils.Constant +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_tag_scan.* +import kotlinx.android.synthetic.main.include_search_title.* + +class TagScanResultActivity : KotlinBaseActivity() { + + private var context: Context = this@TagScanResultActivity + private lateinit var equipmentViewModel: EquipmentViewModel + private val tids = ArrayList() + + override fun initData() { + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + args.forEach { + tids.add(it) + } + + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.scanResult.observe(this) { + if (it.code == 200) { + //显示扫描到的列表 + val equipmentAdapter = object : NormalRecyclerAdapter( + R.layout.item_equipment_rv_l, it.data + ) { + override fun convertView( + viewHolder: ViewHolder, position: Int, item: ScanResultModel.DataModel + ) { + val modelNo = if (item.modelNo.isNullOrBlank()) { + "未知" + } else { + item.modelNo + } + + val remark = if (item.remark.isNullOrBlank()) { + "无" + } else { + item.remark + } + + val useDept = if (item.useDeptName.isNullOrBlank()) { + "未知" + } else { + item.useDeptName + } + + val usePerson = if (item.usePersonName.isNullOrBlank()) { + "无" + } else { + item.usePersonName + } + + if (item.validDate.isEarlierThenCurrent()) { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.red.convertColor(context) + ) + } else { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.gray.convertColor(context) + ) + } + + viewHolder.setText(R.id.equipmentName, item.equipmentName) + .setText(R.id.modelView, modelNo) + .setText(R.id.equipmentStateView, item.managerStateName) + .setText(R.id.equipmentCodeView, "装置编号:${item.equipmentNo}") + .setText(R.id.remarkView, "备注:$remark") + .setText(R.id.useDeptView, useDept) + .setText( + R.id.deviceDateView, + "有效期至:${item.validDate.formatToYearMonthDay()}" + ) + .setText(R.id.usePersonView, "管理员:$usePerson") + + if (!item.managerStateName.contains("在用")) { + viewHolder.setBackgroundColor( + R.id.equipmentStateView, R.color.gray.convertColor(context) + ) + } + } + } + scanDeviceRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + scanDeviceRecyclerView.adapter = equipmentAdapter + equipmentAdapter.setOnItemClickedListener(object : + NormalRecyclerAdapter.OnItemClickedListener { + override fun onItemClicked(position: Int, t: ScanResultModel.DataModel) { + navigatePageTo(t.id) + } + }) + } + } + equipmentViewModel.getScanResult(tids.toTypedArray()) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_tag_scan + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this) { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "结果加载中,请稍后") + else -> LoadingDialogHub.dismiss() + } + } + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "标签扫描结果" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt index 7359ff3..e1cce6e 100644 --- a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -34,6 +34,7 @@ val remindDeviceCount = MutableLiveData() val remindDeviceList = MutableLiveData() val remindDeviceResult = MutableLiveData() + val scanResult = MutableLiveData() fun getEquipmentList( equipmentNo: String, @@ -378,4 +379,22 @@ }, { it.convertChinese().show(BaseApplication.get()) }) + + fun getScanResult(strSet: Array) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getScanResult(strSet) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + scanResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + loadState.value = LoadState.Success + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.convertChinese().show(BaseApplication.get()) + }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java new file mode 100644 index 0000000..ffe6012 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java @@ -0,0 +1,377 @@ +package com.casic.xz.meterage.widgets; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.SweepGradient; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.casic.xz.meterage.R; + +import java.util.ArrayList; +import java.util.Iterator; + +public class RadarView extends View { + + //默认的主题颜色 + private final int DEFAULT_COLOR = Color.parseColor("#008CFF"); + + // 圆圈和交叉线的颜色 + private int mCircleColor = DEFAULT_COLOR; + //圆圈的数量 不能小于1 + private int mCircleNum = 3; + //扫描的颜色 RadarView会对这个颜色做渐变透明处理 + private int mSweepColor = DEFAULT_COLOR; + //水滴的颜色 + private int mRaindropColor = DEFAULT_COLOR; + //水滴的数量 这里表示的是水滴最多能同时出现的数量。因为水滴是随机产生的,数量是不确定的 + private int mRaindropNum = 4; + //是否显示交叉线 + private boolean isShowCross = true; + //是否显示水滴 + private boolean isShowRaindrop = true; + //扫描的转速,表示几秒转一圈 + private float mSpeed = 3.0f; + //水滴显示和消失的速度 + private float mFlicker = 3.0f; + + private Paint mCirclePaint;// 圆的画笔 + private Paint mSweepPaint; //扫描效果的画笔 + private Paint mRaindropPaint;// 水滴的画笔 + + private float mDegrees; //扫描时的扫描旋转角度。 + private boolean isScanning = false;//是否扫描 + + //保存水滴数据 + private ArrayList mRaindrops = new ArrayList<>(); + + public RadarView(Context context) { + super(context); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + getAttrs(context, attrs); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + getAttrs(context, attrs); + init(); + } + + /** + * 获取自定义属性值 + * + * @param context + * @param attrs + */ + private void getAttrs(Context context, AttributeSet attrs) { + if (attrs != null) { + TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RadarView); + mCircleColor = mTypedArray.getColor(R.styleable.RadarView_circleColor, DEFAULT_COLOR); + mCircleNum = mTypedArray.getInt(R.styleable.RadarView_circleNum, mCircleNum); + if (mCircleNum < 1) { + mCircleNum = 3; + } + mSweepColor = mTypedArray.getColor(R.styleable.RadarView_sweepColor, DEFAULT_COLOR); + mRaindropColor = mTypedArray.getColor(R.styleable.RadarView_raindropColor, DEFAULT_COLOR); + mRaindropNum = mTypedArray.getInt(R.styleable.RadarView_raindropNum, mRaindropNum); + isShowCross = mTypedArray.getBoolean(R.styleable.RadarView_showCross, true); + isShowRaindrop = mTypedArray.getBoolean(R.styleable.RadarView_showRaindrop, true); + mSpeed = mTypedArray.getFloat(R.styleable.RadarView_speed, mSpeed); + if (mSpeed <= 0) { + mSpeed = 3; + } + mFlicker = mTypedArray.getFloat(R.styleable.RadarView_flicker, mFlicker); + if (mFlicker <= 0) { + mFlicker = 3; + } + mTypedArray.recycle(); + } + } + + /** + * 初始化 + */ + private void init() { + // 初始化画笔 + mCirclePaint = new Paint(); + mCirclePaint.setColor(mCircleColor); + mCirclePaint.setStrokeWidth(1); + mCirclePaint.setStyle(Paint.Style.STROKE); + mCirclePaint.setAntiAlias(true); + + mRaindropPaint = new Paint(); + mRaindropPaint.setStyle(Paint.Style.FILL); + mRaindropPaint.setAntiAlias(true); + + mSweepPaint = new Paint(); + mSweepPaint.setAntiAlias(true); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + //设置宽高,默认200dp + int defaultSize = dp2px(getContext(), 200); + setMeasuredDimension(measureWidth(widthMeasureSpec, defaultSize), + measureHeight(heightMeasureSpec, defaultSize)); + } + + /** + * 测量宽 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureWidth(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingLeft() + getPaddingRight(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumWidth()); + return result; + } + + /** + * 测量高 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureHeight(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingTop() + getPaddingBottom(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumHeight()); + return result; + } + + @Override + protected void onDraw(Canvas canvas) { + + //计算圆的半径 + int width = getWidth() - getPaddingLeft() - getPaddingRight(); + int height = getHeight() - getPaddingTop() - getPaddingBottom(); + int radius = Math.min(width, height) / 2; + + //计算圆的圆心 + int cx = getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight()) / 2; + int cy = getPaddingTop() + (getHeight() - getPaddingTop() - getPaddingBottom()) / 2; + + drawCircle(canvas, cx, cy, radius); + + if (isShowCross) { + drawCross(canvas, cx, cy, radius); + } + + //正在扫描 + if (isScanning) { + if (isShowRaindrop) { + drawRaindrop(canvas, cx, cy, radius); + } + drawSweep(canvas, cx, cy, radius); + //计算雷达扫描的旋转角度 + mDegrees = (mDegrees + (360 / mSpeed / 60)) % 360; + + //触发View重新绘制,通过不断的绘制View的扫描动画效果 + invalidate(); + } + } + + /** + * 画圆 + */ + private void drawCircle(Canvas canvas, int cx, int cy, int radius) { + //画mCircleNum个半径不等的圆圈。 + for (int i = 0; i < mCircleNum; i++) { + canvas.drawCircle(cx, cy, radius - (radius / mCircleNum * i), mCirclePaint); + } + } + + /** + * 画交叉线 + */ + private void drawCross(Canvas canvas, int cx, int cy, int radius) { + //水平线 + canvas.drawLine(cx - radius, cy, cx + radius, cy, mCirclePaint); + + //垂直线 + canvas.drawLine(cx, cy - radius, cx, cy + radius, mCirclePaint); + } + + /** + * 生成水滴。水滴的生成是随机的,并不是每次调用都会生成一个水滴。 + */ + private void generateRaindrop(int cx, int cy, int radius) { + + // 最多只能同时存在mRaindropNum个水滴。 + if (mRaindrops.size() < mRaindropNum) { + // 随机一个20以内的数字,如果这个数字刚好是0,就生成一个水滴。 + // 用于控制水滴生成的概率。 + boolean probability = (int) (Math.random() * 20) == 0; + if (probability) { + int x = 0; + int y = 0; + int xOffset = (int) (Math.random() * (radius - 20)); + int yOffset = (int) (Math.random() * (int) Math.sqrt(1.0 * (radius - 20) * (radius - 20) - xOffset * xOffset)); + + if ((int) (Math.random() * 2) == 0) { + x = cx - xOffset; + } else { + x = cx + xOffset; + } + + if ((int) (Math.random() * 2) == 0) { + y = cy - yOffset; + } else { + y = cy + yOffset; + } + + mRaindrops.add(new Raindrop(x, y, 0, mRaindropColor)); + } + } + } + + /** + * 删除水滴 + */ + private void removeRaindrop() { + Iterator iterator = mRaindrops.iterator(); + while (iterator.hasNext()) { + Raindrop raindrop = iterator.next(); + if (raindrop.radius > 20 || raindrop.alpha < 0) { + iterator.remove(); + } + } + } + + /** + * 画雨点(就是在扫描的过程中随机出现的点)。 + */ + private void drawRaindrop(Canvas canvas, int cx, int cy, int radius) { + generateRaindrop(cx, cy, radius); + for (Raindrop raindrop : mRaindrops) { + mRaindropPaint.setColor(raindrop.changeAlpha()); + canvas.drawCircle(raindrop.x, raindrop.y, raindrop.radius, mRaindropPaint); + //水滴的扩散和透明的渐变效果 + raindrop.radius += 1.0f * 20 / 60 / mFlicker; + raindrop.alpha -= 1.0f * 255 / 60 / mFlicker; + } + removeRaindrop(); + } + + /** + * 画扫描效果 + */ + private void drawSweep(Canvas canvas, int cx, int cy, int radius) { + //扇形的透明的渐变效果 + SweepGradient sweepGradient = new SweepGradient(cx, cy, + new int[]{Color.TRANSPARENT, changeAlpha(mSweepColor, 0), changeAlpha(mSweepColor, 168), + changeAlpha(mSweepColor, 255), changeAlpha(mSweepColor, 255) + }, new float[]{0.0f, 0.6f, 0.99f, 0.998f, 1f}); + mSweepPaint.setShader(sweepGradient); + //先旋转画布,再绘制扫描的颜色渲染,实现扫描时的旋转效果。 + canvas.rotate(-90 + mDegrees, cx, cy); + canvas.drawCircle(cx, cy, radius, mSweepPaint); + } + + /** + * 开始扫描 + */ + public void start() { + if (!isScanning) { + isScanning = true; + invalidate(); + } + } + + /** + * 停止扫描 + */ + public void stop() { + if (isScanning) { + isScanning = false; + mRaindrops.clear(); + mDegrees = 0.0f; + } + } + + /** + * 水滴数据类 + */ + private static class Raindrop { + int x; + int y; + float radius; + int color; + float alpha = 255; + + public Raindrop(int x, int y, float radius, int color) { + this.x = x; + this.y = y; + this.radius = radius; + this.color = color; + } + + /** + * 获取改变透明度后的颜色值 + * + * @return + */ + public int changeAlpha() { + return RadarView.changeAlpha(color, (int) alpha); + } + + } + + /** + * dp转px + */ + private static int dp2px(Context context, float dpVal) { + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + dpVal, context.getResources().getDisplayMetrics()); + } + + /** + * a + * 改变颜色的透明度 + * + * @param color + * @param alpha + * @return + */ + private static int changeAlpha(int color, int alpha) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + return Color.argb(alpha, red, green, blue); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt new file mode 100644 index 0000000..ed3e6c1 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt @@ -0,0 +1,18 @@ +package com.casic.xz.meterage.widgets + +import android.app.Dialog +import android.content.Context +import android.os.Bundle +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.extensions.initDialogLayoutParams +import kotlinx.android.synthetic.main.dialog_scan_tag.* + +class ScanAnimationDialog(context: Context) : Dialog(context, R.style.UserDefinedDialogStyle) { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams(0.8f) + setContentView(R.layout.dialog_scan_tag) + setCanceledOnTouchOutside(false) + radarView.start() + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_tag_scan.xml b/app/src/main/res/layout/activity_tag_scan.xml new file mode 100644 index 0000000..1480075 --- /dev/null +++ b/app/src/main/res/layout/activity_tag_scan.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_scan_tag.xml b/app/src/main/res/layout/dialog_scan_tag.xml new file mode 100644 index 0000000..22a7b00 --- /dev/null +++ b/app/src/main/res/layout/dialog_scan_tag.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4da294c..0fc7e18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -102,6 +102,7 @@ + data; + private String message; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String abc; + private String abcName; + private String applyRelationId; + private String assetNo; + private String assetSource; + private String assetType; + private String assetTypeName; + private String attribute; + private String capitalSource; + private String capitalSourceName; + private String cardEstablishmentDate; + private int compulsoryVerification; + private String createTime; + private String createUser; + private String depreciationMethod; + private String depreciationMethodName; + private String depreciationPeriod; + private String enableDate; + private String equipmentCategory; + private String equipmentCategoryName; + private String equipmentName; + private String equipmentNo; + private String equipmentSpecifications; + private String equipmentType; + private String equipmentTypeName; + private String fileList; + private String id; + private String installIncidentalExpenses; + private String installPlace; + private String intactState; + private int isCalibrationTestEquipment; + private int isDel; + private String isFixedAssets; + private int isMeasureAccount; + private int isStandardSupportEquipment; + private String labelBind; + private String majorCategory; + private String majorCategoryName; + private String managerLevel; + private String managerLevelName; + private String managerState; + private String managerStateName; + private String manufacturer; + private String manufacturerCountry; + private String manufacturingDate; + private String manufacturingNo; + private int mesureCycle; + private String mesureDate; + private String mesureDeptName; + private String mesureRange; + private String mesureResult; + private String mesureResultName; + private String mesureType; + private String mesureTypeName; + private String modelNo; + private String originValue; + private String overallDimension; + private String presentOriginValue; + private String purpose; + private String remark; + private String singlePrice; + private String supportStandardEquipmentName; + private String supportStandardEquipmentNo; + private String technicalLevel; + private String uncertainty; + private String updateTime; + private String useDept; + private String useDeptName; + private String usePerson; + private String usePersonName; + private String validDate; + private int version; + private String weight; + private String 到期时间; + private String 设备名称; + private String 负责人; + + public String getAbc() { + return abc; + } + + public void setAbc(String abc) { + this.abc = abc; + } + + public String getAbcName() { + return abcName; + } + + public void setAbcName(String abcName) { + this.abcName = abcName; + } + + public String getApplyRelationId() { + return applyRelationId; + } + + public void setApplyRelationId(String applyRelationId) { + this.applyRelationId = applyRelationId; + } + + public String getAssetNo() { + return assetNo; + } + + public void setAssetNo(String assetNo) { + this.assetNo = assetNo; + } + + public String getAssetSource() { + return assetSource; + } + + public void setAssetSource(String assetSource) { + this.assetSource = assetSource; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + public String getAssetTypeName() { + return assetTypeName; + } + + public void setAssetTypeName(String assetTypeName) { + this.assetTypeName = assetTypeName; + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public String getCapitalSource() { + return capitalSource; + } + + public void setCapitalSource(String capitalSource) { + this.capitalSource = capitalSource; + } + + public String getCapitalSourceName() { + return capitalSourceName; + } + + public void setCapitalSourceName(String capitalSourceName) { + this.capitalSourceName = capitalSourceName; + } + + public String getCardEstablishmentDate() { + return cardEstablishmentDate; + } + + public void setCardEstablishmentDate(String cardEstablishmentDate) { + this.cardEstablishmentDate = cardEstablishmentDate; + } + + public int getCompulsoryVerification() { + return compulsoryVerification; + } + + public void setCompulsoryVerification(int compulsoryVerification) { + this.compulsoryVerification = compulsoryVerification; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getDepreciationMethod() { + return depreciationMethod; + } + + public void setDepreciationMethod(String depreciationMethod) { + this.depreciationMethod = depreciationMethod; + } + + public String getDepreciationMethodName() { + return depreciationMethodName; + } + + public void setDepreciationMethodName(String depreciationMethodName) { + this.depreciationMethodName = depreciationMethodName; + } + + public String getDepreciationPeriod() { + return depreciationPeriod; + } + + public void setDepreciationPeriod(String depreciationPeriod) { + this.depreciationPeriod = depreciationPeriod; + } + + public String getEnableDate() { + return enableDate; + } + + public void setEnableDate(String enableDate) { + this.enableDate = enableDate; + } + + public String getEquipmentCategory() { + return equipmentCategory; + } + + public void setEquipmentCategory(String equipmentCategory) { + this.equipmentCategory = equipmentCategory; + } + + public String getEquipmentCategoryName() { + return equipmentCategoryName; + } + + public void setEquipmentCategoryName(String equipmentCategoryName) { + this.equipmentCategoryName = equipmentCategoryName; + } + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + + public String getEquipmentNo() { + return equipmentNo; + } + + public void setEquipmentNo(String equipmentNo) { + this.equipmentNo = equipmentNo; + } + + public String getEquipmentSpecifications() { + return equipmentSpecifications; + } + + public void setEquipmentSpecifications(String equipmentSpecifications) { + this.equipmentSpecifications = equipmentSpecifications; + } + + public String getEquipmentType() { + return equipmentType; + } + + public void setEquipmentType(String equipmentType) { + this.equipmentType = equipmentType; + } + + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInstallIncidentalExpenses() { + return installIncidentalExpenses; + } + + public void setInstallIncidentalExpenses(String installIncidentalExpenses) { + this.installIncidentalExpenses = installIncidentalExpenses; + } + + public String getInstallPlace() { + return installPlace; + } + + public void setInstallPlace(String installPlace) { + this.installPlace = installPlace; + } + + public String getIntactState() { + return intactState; + } + + public void setIntactState(String intactState) { + this.intactState = intactState; + } + + public int getIsCalibrationTestEquipment() { + return isCalibrationTestEquipment; + } + + public void setIsCalibrationTestEquipment(int isCalibrationTestEquipment) { + this.isCalibrationTestEquipment = isCalibrationTestEquipment; + } + + public int getIsDel() { + return isDel; + } + + public void setIsDel(int isDel) { + this.isDel = isDel; + } + + public String getIsFixedAssets() { + return isFixedAssets; + } + + public void setIsFixedAssets(String isFixedAssets) { + this.isFixedAssets = isFixedAssets; + } + + public int getIsMeasureAccount() { + return isMeasureAccount; + } + + public void setIsMeasureAccount(int isMeasureAccount) { + this.isMeasureAccount = isMeasureAccount; + } + + public int getIsStandardSupportEquipment() { + return isStandardSupportEquipment; + } + + public void setIsStandardSupportEquipment(int isStandardSupportEquipment) { + this.isStandardSupportEquipment = isStandardSupportEquipment; + } + + public String getLabelBind() { + return labelBind; + } + + public void setLabelBind(String labelBind) { + this.labelBind = labelBind; + } + + public String getMajorCategory() { + return majorCategory; + } + + public void setMajorCategory(String majorCategory) { + this.majorCategory = majorCategory; + } + + public String getMajorCategoryName() { + return majorCategoryName; + } + + public void setMajorCategoryName(String majorCategoryName) { + this.majorCategoryName = majorCategoryName; + } + + public String getManagerLevel() { + return managerLevel; + } + + public void setManagerLevel(String managerLevel) { + this.managerLevel = managerLevel; + } + + public String getManagerLevelName() { + return managerLevelName; + } + + public void setManagerLevelName(String managerLevelName) { + this.managerLevelName = managerLevelName; + } + + public String getManagerState() { + return managerState; + } + + public void setManagerState(String managerState) { + this.managerState = managerState; + } + + public String getManagerStateName() { + return managerStateName; + } + + public void setManagerStateName(String managerStateName) { + this.managerStateName = managerStateName; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getManufacturerCountry() { + return manufacturerCountry; + } + + public void setManufacturerCountry(String manufacturerCountry) { + this.manufacturerCountry = manufacturerCountry; + } + + public String getManufacturingDate() { + return manufacturingDate; + } + + public void setManufacturingDate(String manufacturingDate) { + this.manufacturingDate = manufacturingDate; + } + + public String getManufacturingNo() { + return manufacturingNo; + } + + public void setManufacturingNo(String manufacturingNo) { + this.manufacturingNo = manufacturingNo; + } + + public int getMesureCycle() { + return mesureCycle; + } + + public void setMesureCycle(int mesureCycle) { + this.mesureCycle = mesureCycle; + } + + public String getMesureDate() { + return mesureDate; + } + + public void setMesureDate(String mesureDate) { + this.mesureDate = mesureDate; + } + + public String getMesureDeptName() { + return mesureDeptName; + } + + public void setMesureDeptName(String mesureDeptName) { + this.mesureDeptName = mesureDeptName; + } + + public String getMesureRange() { + return mesureRange; + } + + public void setMesureRange(String mesureRange) { + this.mesureRange = mesureRange; + } + + public String getMesureResult() { + return mesureResult; + } + + public void setMesureResult(String mesureResult) { + this.mesureResult = mesureResult; + } + + public String getMesureResultName() { + return mesureResultName; + } + + public void setMesureResultName(String mesureResultName) { + this.mesureResultName = mesureResultName; + } + + public String getMesureType() { + return mesureType; + } + + public void setMesureType(String mesureType) { + this.mesureType = mesureType; + } + + public String getMesureTypeName() { + return mesureTypeName; + } + + public void setMesureTypeName(String mesureTypeName) { + this.mesureTypeName = mesureTypeName; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getOriginValue() { + return originValue; + } + + public void setOriginValue(String originValue) { + this.originValue = originValue; + } + + public String getOverallDimension() { + return overallDimension; + } + + public void setOverallDimension(String overallDimension) { + this.overallDimension = overallDimension; + } + + public String getPresentOriginValue() { + return presentOriginValue; + } + + public void setPresentOriginValue(String presentOriginValue) { + this.presentOriginValue = presentOriginValue; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSinglePrice() { + return singlePrice; + } + + public void setSinglePrice(String singlePrice) { + this.singlePrice = singlePrice; + } + + public String getSupportStandardEquipmentName() { + return supportStandardEquipmentName; + } + + public void setSupportStandardEquipmentName(String supportStandardEquipmentName) { + this.supportStandardEquipmentName = supportStandardEquipmentName; + } + + public String getSupportStandardEquipmentNo() { + return supportStandardEquipmentNo; + } + + public void setSupportStandardEquipmentNo(String supportStandardEquipmentNo) { + this.supportStandardEquipmentNo = supportStandardEquipmentNo; + } + + public String getTechnicalLevel() { + return technicalLevel; + } + + public void setTechnicalLevel(String technicalLevel) { + this.technicalLevel = technicalLevel; + } + + public String getUncertainty() { + return uncertainty; + } + + public void setUncertainty(String uncertainty) { + this.uncertainty = uncertainty; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getUseDept() { + return useDept; + } + + public void setUseDept(String useDept) { + this.useDept = useDept; + } + + public String getUseDeptName() { + return useDeptName; + } + + public void setUseDeptName(String useDeptName) { + this.useDeptName = useDeptName; + } + + public String getUsePerson() { + return usePerson; + } + + public void setUsePerson(String usePerson) { + this.usePerson = usePerson; + } + + public String getUsePersonName() { + return usePersonName; + } + + public void setUsePersonName(String usePersonName) { + this.usePersonName = usePersonName; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String get到期时间() { + return 到期时间; + } + + public void set到期时间(String 到期时间) { + this.到期时间 = 到期时间; + } + + public String get设备名称() { + return 设备名称; + } + + public void set设备名称(String 设备名称) { + this.设备名称 = 设备名称; + } + + public String get负责人() { + return 负责人; + } + + public void set负责人(String 负责人) { + this.负责人 = 负责人; + } + } +} diff --git a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt index 51b94c9..ab802fc 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/TagReaderHub.kt @@ -1,6 +1,7 @@ package com.casic.xz.meterage.utils import android.content.Context +import android.util.Log import com.casic.xz.meterage.callback.OnTagScanResultCallback import com.pengxh.kt.lite.base.BaseSingleton import com.rfid.API.* @@ -21,7 +22,6 @@ private var reader = CommonReader(context, "Reader1", GlobalData.ConnectType.RS232.toString(), "") private var isScanning = false - private var dataMap = HashMap() init { reader.protocol = ProtocolVersion.CPP @@ -55,9 +55,10 @@ reader.OnTagDataReceivedHandle = TagDataReceivedHandle { _, tag -> if (tag.tagType == 0) { val tid = Util.convertByteArrayToHexString(tag.tid) - if (!dataMap.containsKey(tid)) { - dataMap[tid] = tid + if (tid != "000000000000000000000000000000000000000000000000") { callback.onTagTidScanned(false, tid) + } else { + Log.d(kTag, "initTagScanResultCallback => tid 错误") } } else { callback.onTagTidScanned(true, tag.barcode) @@ -74,7 +75,6 @@ param.isLoop = true //0 表示从tid去第0 个字节开始读,8表示读8 个字长度 ,如果tid 有24个字节长度,需要把8 改为12 param.tidParameter = byteArrayOf(0, 12) - dataMap.clear() reader.reader_Inventory(param, 0x00.toByte()) isScanning = true } catch (e: Exception) { diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt index 9f0fc21..fc64e12 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitService.kt @@ -396,6 +396,15 @@ ): String /** + * 测量设备标签识别接口 + */ + @POST("/business/readWriter/equipment/label/readList") + suspend fun getScanResult( + @Header("token") token: String, + @Body requestBody: RequestBody + ): String + + /** * 获取检定规程列表 */ @POST("/meter/standard/regulation/listPage") diff --git a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt index cfb360a..756813c 100644 --- a/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/xz/meterage/utils/retrofit/RetrofitServiceManager.kt @@ -890,6 +890,18 @@ } /** + * 扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表 + */ + suspend fun getScanResult(strSet: Array): String { + val jsonArray = gson.toJsonTree(strSet, typeToken).asJsonArray + + val requestBody = + jsonArray.toString().toRequestBody("application/json;charset=UTF-8".toMediaType()) + + return api.getScanResult(AuthenticationHelper.token!!, requestBody) + } + + /** * 获取检定规程列表 */ suspend fun getVerifyProcedureList(id: String): String { diff --git a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt index 3a66a4b..75392a9 100644 --- a/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt +++ b/app/src/main/java/com/casic/xz/meterage/view/MainActivity.kt @@ -1,5 +1,8 @@ package com.casic.xz.meterage.view +import android.content.Context +import android.os.Handler +import android.os.Message import android.view.KeyEvent import android.view.MenuItem import androidx.fragment.app.Fragment @@ -19,32 +22,70 @@ import com.casic.xz.meterage.vm.ConfigViewModel import com.casic.xz.meterage.vm.PushConfigViewModel import com.casic.xz.meterage.vm.UserViewModel +import com.casic.xz.meterage.widgets.ScanAnimationDialog import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.utils.SaveKeyValues +import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.widget.dialog.AlertControlDialog import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : ApplicationBaseActivity() { +class MainActivity : ApplicationBaseActivity(), Handler.Callback { private val kTag = "MainActivity" + private var context: Context = this@MainActivity private var isScanning = false private var menuItem: MenuItem? = null private var fragmentPages: ArrayList = ArrayList() + private var dataMap = HashMap() private var clickTime: Long = 0 private lateinit var pushConfigViewModel: PushConfigViewModel + private lateinit var weakReferenceHandler: WeakReferenceHandler + private lateinit var scanDialog: ScanAnimationDialog + + override fun handleMessage(msg: Message): Boolean { + if (msg.what == 2023071301) { + AlertControlDialog.Builder() + .setContext(this) + .setTitle("温馨提示") + .setMessage("扫描到${dataMap.size}个设备,是否查看详情?") + .setNegativeButton("取消") + .setPositiveButton("确定") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + val scanResult = ArrayList() + dataMap.forEach { + scanResult.add(it.value) + } + navigatePageTo(scanResult) + //数据处理结束,即刻清除map,防止影响后续扫描 + dataMap.clear() + } + + override fun onCancelClick() { + + } + }).build().show() + } + return true + } override fun initData() { + weakReferenceHandler = WeakReferenceHandler(this) //扫描枪回调 TagReaderHub.obtainInstance(this) .initTagScanResultCallback(object : OnTagScanResultCallback { override fun onTagTidScanned(isBarCode: Boolean, tid: String) { if (!isBarCode) { - runOnUiThread { - "读取到标签,tid:$tid".show(this@MainActivity) + if (!dataMap.containsKey(tid)) { + dataMap[tid] = tid } } } }) + scanDialog = ScanAnimationDialog(this) pushConfigViewModel = ViewModelProvider(this)[PushConfigViewModel::class.java] val clientId = SaveKeyValues.getValue(LocaleConstant.PUSH_ID, "") as String @@ -136,7 +177,7 @@ ImmersionBar.with(this).statusBarDarkFont(true).init() } - override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - clickTime > 2000) { "再按一次退出应用".show(this) @@ -145,26 +186,29 @@ } else { super.onKeyDown(keyCode, event) } - } else if (keyCode == 280 || keyCode == 139) { + } + if (keyCode == 280 || keyCode == 139) { if (!isScanning) { isScanning = true TagReaderHub.obtainInstance(this).startScan() - } else { - TagReaderHub.obtainInstance(this).stopScan() - isScanning = false +// scanDialog.show() } return true } return super.onKeyDown(keyCode, event) } - override fun dispatchKeyEvent(event: KeyEvent): Boolean { - if (event.keyCode == 280 || event.keyCode == 139) { - if (event.action == 1) { + override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { + if (keyCode == 280 || keyCode == 139) { + if (isScanning) { TagReaderHub.obtainInstance(this).stopScan() isScanning = false +// scanDialog.dismiss() + //扫码动画结束 + weakReferenceHandler.sendEmptyMessage(2023071301) } + return true } - return super.dispatchKeyEvent(event) + return super.onKeyUp(keyCode, event) } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt new file mode 100644 index 0000000..a14a920 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/view/TagScanResultActivity.kt @@ -0,0 +1,135 @@ +package com.casic.xz.meterage.view + +import android.content.Context +import androidx.lifecycle.ViewModelProvider +import androidx.recyclerview.widget.DividerItemDecoration +import com.casic.xz.meterage.R +import com.casic.xz.meterage.extensions.formatToYearMonthDay +import com.casic.xz.meterage.extensions.initLayoutImmersionBar +import com.casic.xz.meterage.extensions.isEarlierThenCurrent +import com.casic.xz.meterage.model.ScanResultModel +import com.casic.xz.meterage.utils.LoadingDialogHub +import com.casic.xz.meterage.view.home.EquipmentDetailActivity +import com.casic.xz.meterage.vm.EquipmentViewModel +import com.gyf.immersionbar.ImmersionBar +import com.pengxh.kt.lite.adapter.NormalRecyclerAdapter +import com.pengxh.kt.lite.adapter.ViewHolder +import com.pengxh.kt.lite.base.KotlinBaseActivity +import com.pengxh.kt.lite.extensions.convertColor +import com.pengxh.kt.lite.extensions.navigatePageTo +import com.pengxh.kt.lite.utils.Constant +import com.pengxh.kt.lite.vm.LoadState +import kotlinx.android.synthetic.main.activity_tag_scan.* +import kotlinx.android.synthetic.main.include_search_title.* + +class TagScanResultActivity : KotlinBaseActivity() { + + private var context: Context = this@TagScanResultActivity + private lateinit var equipmentViewModel: EquipmentViewModel + private val tids = ArrayList() + + override fun initData() { + val args = intent.getStringArrayListExtra(Constant.INTENT_PARAM)!! + args.forEach { + tids.add(it) + } + + equipmentViewModel = ViewModelProvider(this)[EquipmentViewModel::class.java] + equipmentViewModel.scanResult.observe(this) { + if (it.code == 200) { + //显示扫描到的列表 + val equipmentAdapter = object : NormalRecyclerAdapter( + R.layout.item_equipment_rv_l, it.data + ) { + override fun convertView( + viewHolder: ViewHolder, position: Int, item: ScanResultModel.DataModel + ) { + val modelNo = if (item.modelNo.isNullOrBlank()) { + "未知" + } else { + item.modelNo + } + + val remark = if (item.remark.isNullOrBlank()) { + "无" + } else { + item.remark + } + + val useDept = if (item.useDeptName.isNullOrBlank()) { + "未知" + } else { + item.useDeptName + } + + val usePerson = if (item.usePersonName.isNullOrBlank()) { + "无" + } else { + item.usePersonName + } + + if (item.validDate.isEarlierThenCurrent()) { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.red.convertColor(context) + ) + } else { + viewHolder.setTextColor( + R.id.deviceDateView, R.color.gray.convertColor(context) + ) + } + + viewHolder.setText(R.id.equipmentName, item.equipmentName) + .setText(R.id.modelView, modelNo) + .setText(R.id.equipmentStateView, item.managerStateName) + .setText(R.id.equipmentCodeView, "装置编号:${item.equipmentNo}") + .setText(R.id.remarkView, "备注:$remark") + .setText(R.id.useDeptView, useDept) + .setText( + R.id.deviceDateView, + "有效期至:${item.validDate.formatToYearMonthDay()}" + ) + .setText(R.id.usePersonView, "管理员:$usePerson") + + if (!item.managerStateName.contains("在用")) { + viewHolder.setBackgroundColor( + R.id.equipmentStateView, R.color.gray.convertColor(context) + ) + } + } + } + scanDeviceRecyclerView.addItemDecoration( + DividerItemDecoration(this, DividerItemDecoration.VERTICAL) + ) + scanDeviceRecyclerView.adapter = equipmentAdapter + equipmentAdapter.setOnItemClickedListener(object : + NormalRecyclerAdapter.OnItemClickedListener { + override fun onItemClicked(position: Int, t: ScanResultModel.DataModel) { + navigatePageTo(t.id) + } + }) + } + } + equipmentViewModel.getScanResult(tids.toTypedArray()) + } + + override fun initEvent() { + leftBackView.setOnClickListener { finish() } + } + + override fun initLayoutView(): Int = R.layout.activity_tag_scan + + override fun observeRequestState() { + equipmentViewModel.loadState.observe(this) { + when (it) { + LoadState.Loading -> LoadingDialogHub.show(this, "结果加载中,请稍后") + else -> LoadingDialogHub.dismiss() + } + } + } + + override fun setupTopBarLayout() { + ImmersionBar.with(this).statusBarDarkFont(true).init() + initLayoutImmersionBar(rootView) + titleView.text = "标签扫描结果" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt index 7359ff3..e1cce6e 100644 --- a/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt +++ b/app/src/main/java/com/casic/xz/meterage/vm/EquipmentViewModel.kt @@ -34,6 +34,7 @@ val remindDeviceCount = MutableLiveData() val remindDeviceList = MutableLiveData() val remindDeviceResult = MutableLiveData() + val scanResult = MutableLiveData() fun getEquipmentList( equipmentNo: String, @@ -378,4 +379,22 @@ }, { it.convertChinese().show(BaseApplication.get()) }) + + fun getScanResult(strSet: Array) = launch({ + loadState.value = LoadState.Loading + val response = RetrofitServiceManager.getScanResult(strSet) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + scanResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + loadState.value = LoadState.Success + } else { + loadState.value = LoadState.Fail + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + loadState.value = LoadState.Fail + it.convertChinese().show(BaseApplication.get()) + }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java new file mode 100644 index 0000000..ffe6012 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/RadarView.java @@ -0,0 +1,377 @@ +package com.casic.xz.meterage.widgets; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.SweepGradient; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.casic.xz.meterage.R; + +import java.util.ArrayList; +import java.util.Iterator; + +public class RadarView extends View { + + //默认的主题颜色 + private final int DEFAULT_COLOR = Color.parseColor("#008CFF"); + + // 圆圈和交叉线的颜色 + private int mCircleColor = DEFAULT_COLOR; + //圆圈的数量 不能小于1 + private int mCircleNum = 3; + //扫描的颜色 RadarView会对这个颜色做渐变透明处理 + private int mSweepColor = DEFAULT_COLOR; + //水滴的颜色 + private int mRaindropColor = DEFAULT_COLOR; + //水滴的数量 这里表示的是水滴最多能同时出现的数量。因为水滴是随机产生的,数量是不确定的 + private int mRaindropNum = 4; + //是否显示交叉线 + private boolean isShowCross = true; + //是否显示水滴 + private boolean isShowRaindrop = true; + //扫描的转速,表示几秒转一圈 + private float mSpeed = 3.0f; + //水滴显示和消失的速度 + private float mFlicker = 3.0f; + + private Paint mCirclePaint;// 圆的画笔 + private Paint mSweepPaint; //扫描效果的画笔 + private Paint mRaindropPaint;// 水滴的画笔 + + private float mDegrees; //扫描时的扫描旋转角度。 + private boolean isScanning = false;//是否扫描 + + //保存水滴数据 + private ArrayList mRaindrops = new ArrayList<>(); + + public RadarView(Context context) { + super(context); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + getAttrs(context, attrs); + init(); + } + + public RadarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + getAttrs(context, attrs); + init(); + } + + /** + * 获取自定义属性值 + * + * @param context + * @param attrs + */ + private void getAttrs(Context context, AttributeSet attrs) { + if (attrs != null) { + TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RadarView); + mCircleColor = mTypedArray.getColor(R.styleable.RadarView_circleColor, DEFAULT_COLOR); + mCircleNum = mTypedArray.getInt(R.styleable.RadarView_circleNum, mCircleNum); + if (mCircleNum < 1) { + mCircleNum = 3; + } + mSweepColor = mTypedArray.getColor(R.styleable.RadarView_sweepColor, DEFAULT_COLOR); + mRaindropColor = mTypedArray.getColor(R.styleable.RadarView_raindropColor, DEFAULT_COLOR); + mRaindropNum = mTypedArray.getInt(R.styleable.RadarView_raindropNum, mRaindropNum); + isShowCross = mTypedArray.getBoolean(R.styleable.RadarView_showCross, true); + isShowRaindrop = mTypedArray.getBoolean(R.styleable.RadarView_showRaindrop, true); + mSpeed = mTypedArray.getFloat(R.styleable.RadarView_speed, mSpeed); + if (mSpeed <= 0) { + mSpeed = 3; + } + mFlicker = mTypedArray.getFloat(R.styleable.RadarView_flicker, mFlicker); + if (mFlicker <= 0) { + mFlicker = 3; + } + mTypedArray.recycle(); + } + } + + /** + * 初始化 + */ + private void init() { + // 初始化画笔 + mCirclePaint = new Paint(); + mCirclePaint.setColor(mCircleColor); + mCirclePaint.setStrokeWidth(1); + mCirclePaint.setStyle(Paint.Style.STROKE); + mCirclePaint.setAntiAlias(true); + + mRaindropPaint = new Paint(); + mRaindropPaint.setStyle(Paint.Style.FILL); + mRaindropPaint.setAntiAlias(true); + + mSweepPaint = new Paint(); + mSweepPaint.setAntiAlias(true); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + //设置宽高,默认200dp + int defaultSize = dp2px(getContext(), 200); + setMeasuredDimension(measureWidth(widthMeasureSpec, defaultSize), + measureHeight(heightMeasureSpec, defaultSize)); + } + + /** + * 测量宽 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureWidth(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingLeft() + getPaddingRight(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumWidth()); + return result; + } + + /** + * 测量高 + * + * @param measureSpec + * @param defaultSize + * @return + */ + private int measureHeight(int measureSpec, int defaultSize) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = defaultSize + getPaddingTop() + getPaddingBottom(); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + result = Math.max(result, getSuggestedMinimumHeight()); + return result; + } + + @Override + protected void onDraw(Canvas canvas) { + + //计算圆的半径 + int width = getWidth() - getPaddingLeft() - getPaddingRight(); + int height = getHeight() - getPaddingTop() - getPaddingBottom(); + int radius = Math.min(width, height) / 2; + + //计算圆的圆心 + int cx = getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight()) / 2; + int cy = getPaddingTop() + (getHeight() - getPaddingTop() - getPaddingBottom()) / 2; + + drawCircle(canvas, cx, cy, radius); + + if (isShowCross) { + drawCross(canvas, cx, cy, radius); + } + + //正在扫描 + if (isScanning) { + if (isShowRaindrop) { + drawRaindrop(canvas, cx, cy, radius); + } + drawSweep(canvas, cx, cy, radius); + //计算雷达扫描的旋转角度 + mDegrees = (mDegrees + (360 / mSpeed / 60)) % 360; + + //触发View重新绘制,通过不断的绘制View的扫描动画效果 + invalidate(); + } + } + + /** + * 画圆 + */ + private void drawCircle(Canvas canvas, int cx, int cy, int radius) { + //画mCircleNum个半径不等的圆圈。 + for (int i = 0; i < mCircleNum; i++) { + canvas.drawCircle(cx, cy, radius - (radius / mCircleNum * i), mCirclePaint); + } + } + + /** + * 画交叉线 + */ + private void drawCross(Canvas canvas, int cx, int cy, int radius) { + //水平线 + canvas.drawLine(cx - radius, cy, cx + radius, cy, mCirclePaint); + + //垂直线 + canvas.drawLine(cx, cy - radius, cx, cy + radius, mCirclePaint); + } + + /** + * 生成水滴。水滴的生成是随机的,并不是每次调用都会生成一个水滴。 + */ + private void generateRaindrop(int cx, int cy, int radius) { + + // 最多只能同时存在mRaindropNum个水滴。 + if (mRaindrops.size() < mRaindropNum) { + // 随机一个20以内的数字,如果这个数字刚好是0,就生成一个水滴。 + // 用于控制水滴生成的概率。 + boolean probability = (int) (Math.random() * 20) == 0; + if (probability) { + int x = 0; + int y = 0; + int xOffset = (int) (Math.random() * (radius - 20)); + int yOffset = (int) (Math.random() * (int) Math.sqrt(1.0 * (radius - 20) * (radius - 20) - xOffset * xOffset)); + + if ((int) (Math.random() * 2) == 0) { + x = cx - xOffset; + } else { + x = cx + xOffset; + } + + if ((int) (Math.random() * 2) == 0) { + y = cy - yOffset; + } else { + y = cy + yOffset; + } + + mRaindrops.add(new Raindrop(x, y, 0, mRaindropColor)); + } + } + } + + /** + * 删除水滴 + */ + private void removeRaindrop() { + Iterator iterator = mRaindrops.iterator(); + while (iterator.hasNext()) { + Raindrop raindrop = iterator.next(); + if (raindrop.radius > 20 || raindrop.alpha < 0) { + iterator.remove(); + } + } + } + + /** + * 画雨点(就是在扫描的过程中随机出现的点)。 + */ + private void drawRaindrop(Canvas canvas, int cx, int cy, int radius) { + generateRaindrop(cx, cy, radius); + for (Raindrop raindrop : mRaindrops) { + mRaindropPaint.setColor(raindrop.changeAlpha()); + canvas.drawCircle(raindrop.x, raindrop.y, raindrop.radius, mRaindropPaint); + //水滴的扩散和透明的渐变效果 + raindrop.radius += 1.0f * 20 / 60 / mFlicker; + raindrop.alpha -= 1.0f * 255 / 60 / mFlicker; + } + removeRaindrop(); + } + + /** + * 画扫描效果 + */ + private void drawSweep(Canvas canvas, int cx, int cy, int radius) { + //扇形的透明的渐变效果 + SweepGradient sweepGradient = new SweepGradient(cx, cy, + new int[]{Color.TRANSPARENT, changeAlpha(mSweepColor, 0), changeAlpha(mSweepColor, 168), + changeAlpha(mSweepColor, 255), changeAlpha(mSweepColor, 255) + }, new float[]{0.0f, 0.6f, 0.99f, 0.998f, 1f}); + mSweepPaint.setShader(sweepGradient); + //先旋转画布,再绘制扫描的颜色渲染,实现扫描时的旋转效果。 + canvas.rotate(-90 + mDegrees, cx, cy); + canvas.drawCircle(cx, cy, radius, mSweepPaint); + } + + /** + * 开始扫描 + */ + public void start() { + if (!isScanning) { + isScanning = true; + invalidate(); + } + } + + /** + * 停止扫描 + */ + public void stop() { + if (isScanning) { + isScanning = false; + mRaindrops.clear(); + mDegrees = 0.0f; + } + } + + /** + * 水滴数据类 + */ + private static class Raindrop { + int x; + int y; + float radius; + int color; + float alpha = 255; + + public Raindrop(int x, int y, float radius, int color) { + this.x = x; + this.y = y; + this.radius = radius; + this.color = color; + } + + /** + * 获取改变透明度后的颜色值 + * + * @return + */ + public int changeAlpha() { + return RadarView.changeAlpha(color, (int) alpha); + } + + } + + /** + * dp转px + */ + private static int dp2px(Context context, float dpVal) { + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + dpVal, context.getResources().getDisplayMetrics()); + } + + /** + * a + * 改变颜色的透明度 + * + * @param color + * @param alpha + * @return + */ + private static int changeAlpha(int color, int alpha) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + return Color.argb(alpha, red, green, blue); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt new file mode 100644 index 0000000..ed3e6c1 --- /dev/null +++ b/app/src/main/java/com/casic/xz/meterage/widgets/ScanAnimationDialog.kt @@ -0,0 +1,18 @@ +package com.casic.xz.meterage.widgets + +import android.app.Dialog +import android.content.Context +import android.os.Bundle +import com.casic.xz.meterage.R +import com.pengxh.kt.lite.extensions.initDialogLayoutParams +import kotlinx.android.synthetic.main.dialog_scan_tag.* + +class ScanAnimationDialog(context: Context) : Dialog(context, R.style.UserDefinedDialogStyle) { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams(0.8f) + setContentView(R.layout.dialog_scan_tag) + setCanceledOnTouchOutside(false) + radarView.start() + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_tag_scan.xml b/app/src/main/res/layout/activity_tag_scan.xml new file mode 100644 index 0000000..1480075 --- /dev/null +++ b/app/src/main/res/layout/activity_tag_scan.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_scan_tag.xml b/app/src/main/res/layout/dialog_scan_tag.xml new file mode 100644 index 0000000..22a7b00 --- /dev/null +++ b/app/src/main/res/layout/dialog_scan_tag.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..df05aaf --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file