Commit b805f280 authored by wanghao's avatar wanghao

1 解绑时 同步计算 老化这边的标检单上的 合格数量 与 不合格数量

parent 075df140
......@@ -20,6 +20,8 @@ public interface ProductStandardInspectionMapper
*/
public ProductStandardInspection selectProductStandardInspectionById(Long productStandardInspectionId);
public ProductStandardInspection selectByProductStandardInspectionNumber(String productStandardInspectionNumber);
public ProductStandardInspection selectByNumber(String number);
......
......@@ -10,6 +10,7 @@ import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.http.HttpUtils;
import com.zehong.system.domain.*;
import com.zehong.system.mapper.PalletDeviceBindingMapper;
import com.zehong.system.mapper.ProductStandardInspectionMapper;
import com.zehong.system.mapper.TTrayInfoMapper;
import com.zehong.system.service.*;
import org.springframework.stereotype.Service;
......@@ -46,6 +47,9 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi
@Resource
private TTrayInfoMapper tTrayInfoMapper;
@Resource
private ProductStandardInspectionMapper productStandardInspectionMapper;
/**
* 查询托盘绑定的设备列
*
......@@ -319,6 +323,34 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi
List<PalletDeviceBinding> mesDeviceDomains = palletDeviceBindings.stream().filter(item -> item.getMotherboardCode() != null).collect(Collectors.toList());
if(mesDeviceDomains.size() == 0) return;
String productStandardInspectionNumber = mesDeviceDomains.get(0).getProductStandardInspectionNumber();
if(StringUtils.isBlank(productStandardInspectionNumber)) {
throw new RuntimeException("产品标准检验编号不能为空");
}
ProductStandardInspection productStandardInspection = productStandardInspectionMapper.selectByProductStandardInspectionNumber(productStandardInspectionNumber);
if(productStandardInspection == null) {
throw new RuntimeException("标检单不存在");
}
// 统计合格数量 (1)
long qualifiedCount = mesDeviceDomains.stream()
.filter(device -> "1".equals(device.getStandardInspectResult()))
.count();
// 统计不合格数量 (0)
long unqualifiedCount = mesDeviceDomains.stream()
.filter(device -> "0".equals(device.getStandardInspectResult()))
.count();
productStandardInspection.setQualifiedNum(qualifiedCount + productStandardInspection.getQualifiedNum());
productStandardInspection.setUnQualifiedNum(unqualifiedCount + productStandardInspection.getUnQualifiedNum());
if(productStandardInspection.getQualifiedNum() >= productStandardInspection.getQuantity()) {
productStandardInspection.setStatus("STANDARD_INSPECTION_COMPLETED");
}
productStandardInspectionMapper.updateProductStandardInspection(productStandardInspection);
// 20251210 领导说 先 保存所有历史数据
palletDeviceUploadHistoryService.batchInsertRealTimeData(mesDeviceDomains);
......
......@@ -73,6 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectProductStandardInspectionVo"/>
where f_product_standard_inspection_id = #{productStandardInspectionId}
</select>
<select id="selectByProductStandardInspectionNumber" parameterType="string" resultMap="ProductStandardInspectionResult">
<include refid="selectProductStandardInspectionVo"/>
where f_product_standard_inspection_number = #{productStandardInspectionNumber}
</select>
<select id="selectByNumber" parameterType="string" resultMap="ProductStandardInspectionResult">
<include refid="selectProductStandardInspectionVo"/>
where f_product_standard_inspection_number = #{productStandardInspectionNumber}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment