1.倒短磅新增皮重过期提醒。
This commit is contained in:
parent
72671b142e
commit
1e1da7086f
|
@ -128,4 +128,13 @@ public class EmpwgtdataController extends BaseController
|
||||||
|
|
||||||
return success(empwgtdataService.getCarnoEmpwgtData(carno));
|
return success(empwgtdataService.getCarnoEmpwgtData(carno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:query')")
|
||||||
|
@GetMapping(value = "/getCarnoEmpwgtDataStatus/{carno}")
|
||||||
|
public AjaxResult getCarnoEmpwgtDataStatus(@PathVariable("carno") String carno)
|
||||||
|
{
|
||||||
|
return success(empwgtdataService.getCarnoEmpwgtDataStatus(carno));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,4 +71,11 @@ public interface IEmpwgtdataService extends IService<Empwgtdata>
|
||||||
public Empwgtdata selectEnableEmpwgtdata(Empwgtdata empwgtdata);
|
public Empwgtdata selectEnableEmpwgtdata(Empwgtdata empwgtdata);
|
||||||
|
|
||||||
public Empwgtdata getCarnoEmpwgtData(String carno);
|
public Empwgtdata getCarnoEmpwgtData(String carno);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车牌号,获取当前皮重数据状态。
|
||||||
|
* @param carno
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getCarnoEmpwgtDataStatus(String carno);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.basedata.service.impl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -10,6 +11,7 @@ import com.ruoyi.basedata.domain.Pounddata;
|
||||||
import com.ruoyi.basedata.service.IPounddataService;
|
import com.ruoyi.basedata.service.IPounddataService;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.util.AllNumberUtil;
|
import com.ruoyi.util.AllNumberUtil;
|
||||||
|
import com.ruoyi.util.Util;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -183,5 +185,51 @@ public class EmpwgtdataServiceImpl extends ServiceImpl<EmpwgtdataMapper, Empwgtd
|
||||||
return empwgtdata;
|
return empwgtdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCarnoEmpwgtDataStatus(String carno) {
|
||||||
|
// 获取皮重有效时间配置(默认24小时)
|
||||||
|
int effectiveHours = getConfigAsInt("HistoryPoundWeightEffectiveTime");
|
||||||
|
// 获取皮重过期提醒时间配置(默认4小时)
|
||||||
|
int reminderHours = getConfigAsInt("WeightExTime");
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
Empwgtdata queryEmp = new Empwgtdata();
|
||||||
|
queryEmp.setCarno(carno);
|
||||||
|
|
||||||
|
// 获取有效时间点(当前时间减去有效期)
|
||||||
|
LocalDateTime effectiveTimePoint = LocalDateTime.now().minusHours(effectiveHours);
|
||||||
|
queryEmp.setWeighdt(Util.toDate(effectiveTimePoint));
|
||||||
|
|
||||||
|
// 查询有效皮重数据
|
||||||
|
Empwgtdata empwgtdata = selectEnableEmpwgtdata(queryEmp);
|
||||||
|
|
||||||
|
if (empwgtdata == null) {
|
||||||
|
return String.format("当前车辆: %s 没有可用的皮重数据!请先称皮重", carno);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查皮重状态
|
||||||
|
LocalDateTime weighTime = Util.toLocalDateTime(empwgtdata.getWeighdt());
|
||||||
|
LocalDateTime expiryTime = weighTime.plusHours(effectiveHours);
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
|
// 计算剩余小时数(正数表示未过期,负数表示已过期)
|
||||||
|
long hoursRemaining = ChronoUnit.HOURS.between(now, expiryTime);
|
||||||
|
|
||||||
|
if (hoursRemaining <= 0) {
|
||||||
|
return String.format("当前车辆: %s 的皮重数据已过期,请重新称重", carno);
|
||||||
|
} else if (hoursRemaining <= reminderHours) {
|
||||||
|
return String.format("当前车辆: %s 的皮重数据将在 %d 小时后过期,请及时更新!", carno, hoursRemaining);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""; // 皮重状态正常,返回空字符串
|
||||||
|
}
|
||||||
|
|
||||||
|
// 辅助方法:从配置服务获取整数值,带默认值和异常处理
|
||||||
|
private int getConfigAsInt(String configKey) {
|
||||||
|
try {
|
||||||
|
String value = configService.selectConfigByKey(configKey);
|
||||||
|
return Integer.parseInt(value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("获取配置项 " + configKey + " 出现异常,请检查!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import org.quartz.SchedulerException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -75,4 +78,14 @@ public class Util {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 辅助方法:LocalDateTime转Date
|
||||||
|
public static Date toDate(LocalDateTime localDateTime) {
|
||||||
|
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 辅助方法:Date转LocalDateTime
|
||||||
|
public static LocalDateTime toLocalDateTime(Date date) {
|
||||||
|
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,3 +58,11 @@ export function getCarnoEmpwgtData(carno) {
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询历史皮重重量数据状态。
|
||||||
|
export function getCarnoEmpwgtDataStatus(carno) {
|
||||||
|
return request({
|
||||||
|
url: '/measurement/basedata/empwgtdata/getCarnoEmpwgtDataStatus/' + carno,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -710,7 +710,7 @@ import SearchSelect from "@/components/SearchSelect/index.vue";
|
||||||
//导入物理磅的方法
|
//导入物理磅的方法
|
||||||
import { listTruepound, getTruepound, delTruepound, addTruepound, updateTruepound } from "@/api/measurement/basedata/truepound"
|
import { listTruepound, getTruepound, delTruepound, addTruepound, updateTruepound } from "@/api/measurement/basedata/truepound"
|
||||||
import {mulToString} from "@/api/tool/util";
|
import {mulToString} from "@/api/tool/util";
|
||||||
import {addEmpwgtdata, getCarnoEmpwgtData, listEmpwgtdata} from "@/api/measurement/basedata/empwgtdata";
|
import {addEmpwgtdata, getCarnoEmpwgtData, listEmpwgtdata,getCarnoEmpwgtDataStatus} from "@/api/measurement/basedata/empwgtdata";
|
||||||
//引入主榜单相关数据
|
//引入主榜单相关数据
|
||||||
import { listPoundmst,getNumber, getPoundmst, delPoundmst, addPoundmst, updatePoundmst } from "@/api/measurement/bill/poundmst"
|
import { listPoundmst,getNumber, getPoundmst, delPoundmst, addPoundmst, updatePoundmst } from "@/api/measurement/bill/poundmst"
|
||||||
//引入榜单信息方法
|
//引入榜单信息方法
|
||||||
|
@ -1025,7 +1025,7 @@ watch: {
|
||||||
//根据车号查询历史皮重
|
//根据车号查询历史皮重
|
||||||
handleSearchHistoryPound() {
|
handleSearchHistoryPound() {
|
||||||
this.historyPoundLoading = true
|
this.historyPoundLoading = true
|
||||||
var thisqueryParams = {
|
const thisqueryParams = {
|
||||||
carno:"",
|
carno:"",
|
||||||
isinuse:"Y"
|
isinuse:"Y"
|
||||||
};
|
};
|
||||||
|
@ -1036,7 +1036,19 @@ watch: {
|
||||||
this.queryPageParams.historyPound.total = response.total;
|
this.queryPageParams.historyPound.total = response.total;
|
||||||
this.historyPoundList = response.rows;
|
this.historyPoundList = response.rows;
|
||||||
this.historyPoundLoading = false;
|
this.historyPoundLoading = false;
|
||||||
})
|
});
|
||||||
|
//查询可用历史皮重状态
|
||||||
|
getCarnoEmpwgtDataStatus(this.queryParams.carno).then(response => {
|
||||||
|
const msg = response.msg;
|
||||||
|
if ("" !== msg){
|
||||||
|
//弹出提示框
|
||||||
|
this.$confirm(msg, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
//查询主榜单数据,分页设置为1
|
//查询主榜单数据,分页设置为1
|
||||||
handleSearchMstBillFirst(){
|
handleSearchMstBillFirst(){
|
||||||
|
|
|
@ -748,6 +748,8 @@ export default {
|
||||||
},
|
},
|
||||||
//查询主榜单数据
|
//查询主榜单数据
|
||||||
handleSearchMstBill(){
|
handleSearchMstBill(){
|
||||||
|
// 校验是否选中磅点
|
||||||
|
if (!this.checkPoundSelected())return;
|
||||||
this.mstBillLoading = true
|
this.mstBillLoading = true
|
||||||
this.queryPageParams.mstBill.poundid = this.truepoundData.buspoundid;
|
this.queryPageParams.mstBill.poundid = this.truepoundData.buspoundid;
|
||||||
listPoundmst(this.queryPageParams.mstBill).then(response => {
|
listPoundmst(this.queryPageParams.mstBill).then(response => {
|
||||||
|
|
Loading…
Reference in New Issue