1.出厂入厂磅,出厂磅,双击过磅申请时自动获取皮重数据进行填充。

This commit is contained in:
xiaosuonian 2025-06-24 15:14:42 +08:00
parent 50ab1d6ab1
commit f02ba45876
7 changed files with 98 additions and 3 deletions

View File

@ -120,4 +120,12 @@ public class EmpwgtdataController extends BaseController
{
return toAjax(empwgtdataService.removeByIds(Arrays.asList(ids)));
}
@PreAuthorize("@ss.hasPermi('measurement/basedata:empwgtdata:query')")
@GetMapping(value = "/getCarnoEmpwgtData/{carno}")
public AjaxResult getCarnoEmpwgtData(@PathVariable("carno") String carno)
{
return success(empwgtdataService.getCarnoEmpwgtData(carno));
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.basedata.service;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
@ -68,4 +69,6 @@ public interface IEmpwgtdataService extends IService<Empwgtdata>
* @return
*/
public Empwgtdata selectEnableEmpwgtdata(Empwgtdata empwgtdata);
public BigDecimal getCarnoEmpwgtData(String carno);
}

View File

@ -1,8 +1,12 @@
package com.ruoyi.basedata.service.impl;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.util.AllNumberUtil;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -26,6 +30,9 @@ public class EmpwgtdataServiceImpl extends ServiceImpl<EmpwgtdataMapper, Empwgtd
@Autowired
private AllNumberUtil allNumberUtil;
@Autowired
private ISysConfigService configService;
/**
* 查询皮重库
*
@ -133,4 +140,28 @@ public class EmpwgtdataServiceImpl extends ServiceImpl<EmpwgtdataMapper, Empwgtd
public Empwgtdata selectEnableEmpwgtdata(Empwgtdata empwgtdata){
return empwgtdataMapper.selectEnableEmpwgtdata(empwgtdata);
}
public BigDecimal getCarnoEmpwgtData(String carno){
//获取皮重有效时间数据
String hoursStr = configService.selectConfigByKey("HistoryPoundWeightEffectiveTime");
// 将字符串转换为整数
int hours = Integer.parseInt(hoursStr);
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 计算减去指定小时后的时间
LocalDateTime effectiveTime = now.minusHours(hours);
Empwgtdata queryEmp = new Empwgtdata();
queryEmp.setCarno(carno);
//effectiveTime转Date类型
queryEmp.setWeighdt(Date.from(effectiveTime.atZone(ZoneId.systemDefault()).toInstant()));
Empwgtdata empwgtdata = selectEnableEmpwgtdata(queryEmp);
//如果不存在可用的皮重则直接报错
if (empwgtdata == null){
throw new RuntimeException("当前车辆:"+carno+"没有可用的皮重数据!");
}
return empwgtdata.getEmptycarqty();
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.bill.service.impl;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
@ -16,6 +17,7 @@ import com.ruoyi.bill.domain.Poundappli;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.webApi.ApiPostBack;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bill.mapper.PoundBillMapper;
@ -44,6 +46,9 @@ public class PoundBillServiceImpl extends ServiceImpl<PoundBillMapper, PoundBill
@Autowired
private EmpwgtdataServiceImpl empwgtdataService;
@Autowired
private ApiPostBack apiPostBack;
/**
* 查询磅单信息
*
@ -174,6 +179,12 @@ public class PoundBillServiceImpl extends ServiceImpl<PoundBillMapper, PoundBill
}
poundBill.initAddFields(poundBill);
boolean save = save(poundBill);
//调用磅单回调接口
try {
apiPostBack.makePoundBillFormData(poundBill.getId());
} catch (IOException e) {
throw new RuntimeException("磅单:" + poundBill.getUsrcode() + "推送星空时,出现异常:"+e.getMessage());
}
if(save){
return 1;
}else{
@ -285,6 +296,13 @@ public class PoundBillServiceImpl extends ServiceImpl<PoundBillMapper, PoundBill
byId.setDuctmqty(ductmqty);
byId.setBillstate("2");
boolean b = updateById(byId);
//推送榜单信息到星空系统
//调用磅单回调接口
try {
apiPostBack.makePoundBillFormData(poundBill.getId());
} catch (IOException e) {
throw new RuntimeException("磅单:" + poundBill.getUsrcode() + "推送星空时,出现异常:"+e.getMessage());
}
if(b){
return 1;
}else{

View File

@ -162,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by crtdt desc
</select>
<select id="selectPoundBillById" parameterType="Long" resultMap="PoundBillResult">
<select id="selectPoundBillById" parameterType="String" resultMap="PoundBillResult">
<include refid="selectPoundBillVo"/>
where id = #{id}
</select>

View File

@ -50,3 +50,11 @@ export function delEmpwgtdata(id) {
method: 'delete'
})
}
// 查询可用的历史皮重重量数据。
export function getCarnoEmpwgtData(carno) {
return request({
url: '/measurement/basedata/empwgtdata/getCarnoEmpwgtData/' + carno,
method: 'get'
})
}

View File

@ -476,7 +476,7 @@ import { listPoundappli, getPoundappli, delPoundappli, addPoundappli, updatePoun
//
import { listTruepound, getTruepound, delTruepound, addTruepound, updateTruepound } from "@/api/measurement/basedata/truepound"
//
import { listEmpwgtdata,getNumber as getHistoryPoundNumber, getEmpwgtdata, delEmpwgtdata, addEmpwgtdata, updateEmpwgtdata } from "@/api/measurement/basedata/empwgtdata"
import { listEmpwgtdata,getNumber as getHistoryPoundNumber, getEmpwgtdata, delEmpwgtdata, addEmpwgtdata, updateEmpwgtdata,getCarnoEmpwgtData } from "@/api/measurement/basedata/empwgtdata"
//
import { listPoundbill,getNumber as getPoundNumber, getPoundbill, delPoundbill, addPoundbill, addOutPoundbill, addInPoundbill, updatePoundbill,updateInPoundbill } from "@/api/measurement/bill/poundbill"
import {delUser} from "@/api/system/user";
@ -566,6 +566,17 @@ export default {
},
created() {
},
computed:{
searchPound(){
var sqlQuery;
if (this.queryParams.poundid!= null && this.queryParams.poundid!= ""){
sqlQuery = "id = \"" + this.queryParams.poundid + "\"";
}else {
sqlQuery = "";
}
return sqlQuery;
}
},
watch: {
//
'queryParams.poundid': function(newVal, oldVal) {
@ -701,7 +712,23 @@ export default {
var number = response.data.number;
this.form.usrcode = number +"|"+this.form.carno;
this.form.crtdt = response.data.date;
})
});
//
if ("1"===this.queryParams.poundtype)
getCarnoEmpwgtData(this.form.carno).then(response => {
this.form.empmqty = response.data;
var tempwghmqty = new Decimal(this.form.wghmqty);
var tempempmqty = new Decimal(this.form.empmqty)
this.form.netmqty = tempwghmqty.minus(tempempmqty);
var tempnetmqty = new Decimal(this.form.netmqty)
var tempsrccleanmqty = new Decimal(this.form.srccleanmqty);
this.form.netdiffqty = tempnetmqty.minus(tempsrccleanmqty);
if (this.form.netdiffqty > 0){
this.form.ductmqty = this.form.netdiffqty;
}else {
this.form.ductmqty = 0;
}
});
},
//
tareHandleRowClick(row) {