liweidong
liweidong-hj 5 days ago
commit df2ce272b7
  1. 36
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/controller/BsEnergyTargetController.java
  2. 5
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/BsEnergyTargetServiceImpl.java
  3. 10
      blade-service/blade-desk/src/main/java/org/springblade/desk/oem/mapper/OemStatementMapper.xml
  4. 97
      blade-service/blade-desk/src/main/java/org/springblade/desk/oem/service/impl/OemStatementServiceImpl.java
  5. 3
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/mapper/WorkPlanMapper.xml
  6. 59
      blade-service/blade-desk/src/main/java/org/springblade/desk/quality/controller/IotThicknessController.java
  7. 10
      blade-service/blade-desk/src/main/java/org/springblade/desk/quality/mapper/InspectionTaskMapper.xml
  8. 32
      blade-service/blade-desk/src/main/java/org/springblade/desk/quality/service/impl/InspectionTaskServiceImpl.java

@ -102,19 +102,43 @@ public class BsEnergyTargetController extends BladeController {
} }
/** /**
* 能耗目标表 新增或修改 * 能耗目标表 新增
*/ */
@PostMapping("/submit") @PostMapping("/save")
@Operation(summary = "新增或修改", description = "传入bsEnergyTargetList") @Operation(summary = "新增或修改", description = "传入bsEnergyTargetList")
public R submit(@Valid @RequestBody List<BsEnergyTargetVO> bsEnergyTargetList) { public R save(@Valid @RequestBody List<BsEnergyTargetVO> bsEnergyTargetList) {
List<String> years = bsEnergyTargetList.stream().map(BsEnergyTargetVO::getYear).collect(Collectors.toList()); List<String> years = bsEnergyTargetList.stream().map(BsEnergyTargetVO::getYear).collect(Collectors.toList());
List<BsEnergyTargetEntity> existList = bsEnergyTargetService.list(new LambdaQueryWrapper<BsEnergyTargetEntity>().in(BsEnergyTargetEntity::getYear, years)); String type = bsEnergyTargetList.get(0).getType();
Map<String, Long> existMap = existList.stream().collect(Collectors.toMap(e -> e.getYear() + "-" + e.getMonth() + "-" + e.getType(), BsEnergyTargetEntity::getId, (oldValue, newValue) -> oldValue)); List<BsEnergyTargetEntity> existList = bsEnergyTargetService.list(new LambdaQueryWrapper<BsEnergyTargetEntity>().in(BsEnergyTargetEntity::getYear, years).eq(BsEnergyTargetEntity::getType, type));
if(CollectionUtils.isNotEmpty(existList)){
String year = existList.get(0).getYear();
return R.fail(year + "年份目标已存在,请勿重复添加");
}
List<BsEnergyTargetEntity> saves = new ArrayList<>();
for (BsEnergyTargetVO bsEnergyTargetVO : bsEnergyTargetList) {
List<BsEnergyTargetEntity> bsEnergyTargetEntities = bsEnergyTargetVO.parseEntities();
saves.addAll(bsEnergyTargetEntities);
}
return R.status(bsEnergyTargetService.saveOrUpdateBatch(saves));
}
/**
* 能耗目标 修改
* @param bsEnergyTargetList
* @return
*/
@PostMapping("/update")
@Operation(summary = "修改", description = "传入bsEnergyTargetList")
public R update(@Valid @RequestBody List<BsEnergyTargetVO> bsEnergyTargetList) {
List<String> years = bsEnergyTargetList.stream().map(BsEnergyTargetVO::getYear).collect(Collectors.toList());
String type = bsEnergyTargetList.get(0).getType();
List<BsEnergyTargetEntity> existList = bsEnergyTargetService.list(new LambdaQueryWrapper<BsEnergyTargetEntity>().in(BsEnergyTargetEntity::getYear, years).eq(BsEnergyTargetEntity::getType, type));
Map<String, Long> existMap = existList.stream().collect(Collectors.toMap(e -> e.getYear() + "-" + e.getMonth(), BsEnergyTargetEntity::getId, (oldValue, newValue) -> oldValue));
List<BsEnergyTargetEntity> saves = new ArrayList<>(); List<BsEnergyTargetEntity> saves = new ArrayList<>();
for (BsEnergyTargetVO bsEnergyTargetVO : bsEnergyTargetList) { for (BsEnergyTargetVO bsEnergyTargetVO : bsEnergyTargetList) {
List<BsEnergyTargetEntity> bsEnergyTargetEntities = bsEnergyTargetVO.parseEntities(); List<BsEnergyTargetEntity> bsEnergyTargetEntities = bsEnergyTargetVO.parseEntities();
for (BsEnergyTargetEntity bsEnergyTarget : bsEnergyTargetEntities) { for (BsEnergyTargetEntity bsEnergyTarget : bsEnergyTargetEntities) {
String key = bsEnergyTarget.getYear() + "-" + bsEnergyTarget.getMonth() + "-" + bsEnergyTarget.getType(); String key = bsEnergyTarget.getYear() + "-" + bsEnergyTarget.getMonth();
if (existMap.containsKey(key)) { if (existMap.containsKey(key)) {
bsEnergyTarget.setId(existMap.get(key)); bsEnergyTarget.setId(existMap.get(key));
} }

@ -25,6 +25,7 @@
*/ */
package org.springblade.desk.energy.service.impl; package org.springblade.desk.energy.service.impl;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -83,6 +84,10 @@ public class BsEnergyTargetServiceImpl extends BaseServiceImpl<BsEnergyTargetMap
.collect(Collectors.toList()); .collect(Collectors.toList());
List<String> years = importList.stream().map(BsEnergyTargetExcel::getYear).collect(Collectors.toList()); List<String> years = importList.stream().map(BsEnergyTargetExcel::getYear).collect(Collectors.toList());
List<BsEnergyTargetEntity> existList = this.list(new LambdaQueryWrapper<BsEnergyTargetEntity>().in(BsEnergyTargetEntity::getYear, years).eq(BsEnergyTargetEntity::getType, type)); List<BsEnergyTargetEntity> existList = this.list(new LambdaQueryWrapper<BsEnergyTargetEntity>().in(BsEnergyTargetEntity::getYear, years).eq(BsEnergyTargetEntity::getType, type));
if(CollectionUtils.isNotEmpty(existList)){
String year = existList.get(0).getYear();
return R.fail(year + "年份目标已存在,请勿重复添加");
}
Map<String, Long> existMap = existList.stream().collect(Collectors.toMap(e -> e.getYear() + "-" + e.getMonth() + "-" + e.getType(), BsEnergyTargetEntity::getId, (oldValue, newValue) -> oldValue)); Map<String, Long> existMap = existList.stream().collect(Collectors.toMap(e -> e.getYear() + "-" + e.getMonth() + "-" + e.getType(), BsEnergyTargetEntity::getId, (oldValue, newValue) -> oldValue));
List<BsEnergyTargetEntity> saves = new ArrayList<>(); List<BsEnergyTargetEntity> saves = new ArrayList<>();
for (BsEnergyTargetVO bsEnergyTargetVO : voList) { for (BsEnergyTargetVO bsEnergyTargetVO : voList) {

@ -122,7 +122,7 @@
c.OC_NAME, c.OC_NAME,
d.REWORK_CODE, d.REWORK_CODE,
d.REWORK_NO, d.REWORK_NO,
d.wo_code, f.wo_code,
d.PUT_STORE_TIME AS PUT_STORE_TIME, d.PUT_STORE_TIME AS PUT_STORE_TIME,
to_char(d.PUT_STORE_TIME, 'yyyy-MM-dd') as PUT_STORE_DATE, to_char(d.PUT_STORE_TIME, 'yyyy-MM-dd') as PUT_STORE_DATE,
d.MAKE_QTY, d.MAKE_QTY,
@ -158,6 +158,7 @@
INNER JOIN BS_OEM c ON a.OC_ID = c.ID AND c.IS_DELETED = 0 INNER JOIN BS_OEM c ON a.OC_ID = c.ID AND c.IS_DELETED = 0
INNER JOIN MES_WORK_ORDER d ON a.WO_ID = d.ID AND d.IS_DELETED = 0 INNER JOIN MES_WORK_ORDER d ON a.WO_ID = d.ID AND d.IS_DELETED = 0
INNER JOIN MES_YIELD_ORDER e ON d.YO_ID = e.ID AND e.IS_DELETED = 0 INNER JOIN MES_YIELD_ORDER e ON d.YO_ID = e.ID AND e.IS_DELETED = 0
INNER JOIN MES_WORK_ORDER_RUN f ON d.WOR_ID = f.ID AND f.IS_DELETED = 0
INNER JOIN MES_OEM_PROCESS g ON b.ID = g.PROCESS_ID AND g.IS_DELETED = 0 INNER JOIN MES_OEM_PROCESS g ON b.ID = g.PROCESS_ID AND g.IS_DELETED = 0
LEFT JOIN MES_OEM_STATEMENT h ON h.WP_ID = a.ID AND h.IS_DELETED = 0 LEFT JOIN MES_OEM_STATEMENT h ON h.WP_ID = a.ID AND h.IS_DELETED = 0
INNER JOIN BS_CRAFT_ABILITY i ON i.ID = a.CA_ID AND i.IS_DELETED = 0 INNER JOIN BS_CRAFT_ABILITY i ON i.ID = a.CA_ID AND i.IS_DELETED = 0
@ -173,7 +174,7 @@
AND d.PUT_STORE_TIME &lt; #{postPlatingStorageTimeEnd} + 1 AND d.PUT_STORE_TIME &lt; #{postPlatingStorageTimeEnd} + 1
</if> </if>
<if test="woCode != null and woCode != ''"> <if test="woCode != null and woCode != ''">
AND d.WO_CODE LIKE CONCAT('%', CONCAT(#{woCode}, '%')) AND f.WO_CODE LIKE CONCAT('%', CONCAT(#{woCode}, '%'))
</if> </if>
<if test="ppsId != null and ppsId != ''"> <if test="ppsId != null and ppsId != ''">
AND a.PPS_ID = #{ppsId} AND a.PPS_ID = #{ppsId}
@ -390,7 +391,7 @@
c.oc_name, c.oc_name,
d.rework_code, d.rework_code,
d.rework_no, d.rework_no,
d.wo_code, f.wo_code,
d.put_store_time, d.put_store_time,
to_char(d.put_store_time, 'yyyy-MM-dd') as PUT_STORE_DATE, to_char(d.put_store_time, 'yyyy-MM-dd') as PUT_STORE_DATE,
d.make_qty, d.make_qty,
@ -423,6 +424,7 @@
INNER JOIN MJMES.bs_oem_customer c on a.oc_id = c.oc_id INNER JOIN MJMES.bs_oem_customer c on a.oc_id = c.oc_id
INNER JOIN MJMES.pr_work_order d ON a.wo_id = d.wo_id INNER JOIN MJMES.pr_work_order d ON a.wo_id = d.wo_id
INNER JOIN MJMES.pj_yield_order e ON d.yo_id = e.yo_id INNER JOIN MJMES.pj_yield_order e ON d.yo_id = e.yo_id
INNER JOIN MJMES.pr_work_order_run f on d.WOR_ID = f.WOR_ID
INNER JOIN MES_OEM_PROCESS g ON a.pps_id = g.PROCESS_ID AND g.IS_DELETED = 0 INNER JOIN MES_OEM_PROCESS g ON a.pps_id = g.PROCESS_ID AND g.IS_DELETED = 0
LEFT JOIN MES_OEM_STATEMENT h ON h.WP_ID = a.wp_id AND h.IS_DELETED = 0 LEFT JOIN MES_OEM_STATEMENT h ON h.WP_ID = a.wp_id AND h.IS_DELETED = 0
INNER JOIN BS_CRAFT_ABILITY i ON i.ID = a.CA_ID AND i.IS_DELETED = 0 INNER JOIN BS_CRAFT_ABILITY i ON i.ID = a.CA_ID AND i.IS_DELETED = 0
@ -437,7 +439,7 @@
AND d.PUT_STORE_TIME &lt; #{postPlatingStorageTimeEnd} + 1 AND d.PUT_STORE_TIME &lt; #{postPlatingStorageTimeEnd} + 1
</if> </if>
<if test="woCode != null and woCode != ''"> <if test="woCode != null and woCode != ''">
AND d.WO_CODE LIKE CONCAT('%', CONCAT(#{woCode}, '%')) AND f.WO_CODE LIKE CONCAT('%', CONCAT(#{woCode}, '%'))
</if> </if>
<if test="ppsId != null and ppsId != ''"> <if test="ppsId != null and ppsId != ''">
AND a.PPS_ID = #{ppsId} AND a.PPS_ID = #{ppsId}

@ -1352,7 +1352,9 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper,
Long caId = statementVO.getCaId(); Long caId = statementVO.getCaId();
String craftIds = statementVO.getCraftIds(); String craftIds = statementVO.getCraftIds();
boolean isContain = false; boolean isContain = false;
if (caId != null && craftIds != null && !craftIds.isBlank()) { if (StringUtils.isEmpty(craftIds)) {
isContain = true;
} else if (caId != null) {
String temp = "," + craftIds + ","; String temp = "," + craftIds + ",";
isContain = temp.contains("," + caId + ","); isContain = temp.contains("," + caId + ",");
} }
@ -1529,21 +1531,29 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper,
if (rule1(statementVO, price)) { if (rule1(statementVO, price)) {
continue; continue;
} }
// (2) 供应商代码 + 工序 + 零件号 + 生产标识 + 现执行价格 // (2) 供应商代码 + 工序 + 零件号 + 计划单号 + 现执行价格
if (rule2(statementVO, price)) { if (rule2(statementVO, price)) {
continue; continue;
} }
// (3) 供应商代码 + 生产标识 + 计划单号 + 标准工序代码 // (3) 供应商代码 + 工序 + 零件号 + 生产标识 + 现执行价格
if (rule3(statementVO)) { if (rule3(statementVO, price)) {
continue; continue;
} }
// (4) 供应商代码 + 生产标识 + 标准工序代码 // (4) 供应商代码 + 工序 + 零件号 + 现执行价格
if (rule4(statementVO)) { if (rule4(statementVO, price)) {
continue;
}
// (5) 供应商代码 + 生产标识 + 计划单号 + 标准工序代码
if (rule5(statementVO)) {
continue;
}
// (6) 供应商代码 + 生产标识 + 标准工序代码
if (rule6(statementVO)) {
continue; continue;
} }
} }
// (5) 供应商代码 + 标准工序代码 + 现执行价格 // (7) 供应商代码 + 标准工序代码 + 现执行价格
if (rule5(statementVO, price)) { if (rule7(statementVO, price)) {
continue; continue;
} }
statementVO.setRosStatus(StatementVO.ERR_SETTLEMENT); statementVO.setRosStatus(StatementVO.ERR_SETTLEMENT);
@ -1764,13 +1774,42 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper,
} }
/** /**
* 匹配规则2 : 供应商代码 + 工序 + 零件号 + 生产标识 + 现执行价格 * 匹配规则2 : 供应商代码 + 工序 + 零件号 + 计划单号 + 现执行价格
* *
* @param statementVO * @param statementVO
* @param price * @param price
* @return * @return
*/ */
private boolean rule2(StatementVO statementVO, BigDecimal price) { private boolean rule2(StatementVO statementVO, BigDecimal price) {
List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList();
if (CollectionUtils.isEmpty(priceSheetList)) {
return false;
}
// 结算单字段
String ocCode = statementVO.getOcCode();
String psName = statementVO.getPsName();
String partCode = statementVO.getPartCode();
String ypCode = statementVO.getYpCode();
for (PriceSheetVO sheet : priceSheetList) {
boolean match = StringUtils.equals(sheet.getSplycode(), ocCode) && StringUtils.equals(sheet.getGxinfo(), psName) && StringUtils.equals(sheet.getPrtno(), partCode) && StringUtils.equals(sheet.getWono(), ypCode);
if (match && price != null && price.compareTo(BigDecimal.ZERO) != 0) {
match = PriceMatcher.isContainsPrice(sheet.getAu_ag_price(), price);
}
if (match && ruleTieredPricing(statementVO, sheet)) {
return setSettlementInfo(statementVO, sheet);
}
}
return false;
}
/**
* 匹配规则3 : 供应商代码 + 工序 + 零件号 + 生产标识 + 现执行价格
*
* @param statementVO
* @param price
* @return
*/
private boolean rule3(StatementVO statementVO, BigDecimal price) {
List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList(); List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList();
if (CollectionUtils.isEmpty(priceSheetList)) { if (CollectionUtils.isEmpty(priceSheetList)) {
return false; return false;
@ -1793,12 +1832,40 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper,
} }
/** /**
* 匹配规则3 : 供应商代码 + 生产标识 + 计划单号 + 标准工序代码 * 匹配规则4 : 供应商代码 + 工序 + 零件号 + 现执行价格
*
* @param statementVO
* @param price
* @return
*/
private boolean rule4(StatementVO statementVO, BigDecimal price) {
List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList();
if (CollectionUtils.isEmpty(priceSheetList)) {
return false;
}
// 结算单字段
String ocCode = statementVO.getOcCode();
String psName = statementVO.getPsName();
String partCode = statementVO.getPartCode();
for (PriceSheetVO sheet : priceSheetList) {
boolean match = StringUtils.equals(sheet.getSplycode(), ocCode) && StringUtils.equals(sheet.getGxinfo(), psName) && StringUtils.equals(sheet.getPrtno(), partCode);
if (match && price != null && price.compareTo(BigDecimal.ZERO) != 0) {
match = PriceMatcher.isContainsPrice(sheet.getAu_ag_price(), price);
}
if (match && ruleTieredPricing(statementVO, sheet)) {
return setSettlementInfo(statementVO, sheet);
}
}
return false;
}
/**
* 匹配规则5 : 供应商代码 + 生产标识 + 计划单号 + 标准工序代码
* *
* @param statementVO * @param statementVO
* @return * @return
*/ */
private boolean rule3(StatementVO statementVO) { private boolean rule5(StatementVO statementVO) {
List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList(); List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList();
if (CollectionUtils.isEmpty(priceSheetList)) { if (CollectionUtils.isEmpty(priceSheetList)) {
return false; return false;
@ -1823,12 +1890,12 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper,
} }
/** /**
* 匹配规则4 : 供应商代码 + 生产标识 + 标准工序代码 * 匹配规则6 : 供应商代码 + 生产标识 + 标准工序代码
* *
* @param statementVO * @param statementVO
* @return * @return
*/ */
private boolean rule4(StatementVO statementVO) { private boolean rule6(StatementVO statementVO) {
List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList(); List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList();
if (CollectionUtils.isEmpty(priceSheetList)) { if (CollectionUtils.isEmpty(priceSheetList)) {
return false; return false;
@ -1852,13 +1919,13 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper,
} }
/** /**
* 匹配规则5 : 供应商代码 + 标准工序代码 + 现执行价格 * 匹配规则7 : 供应商代码 + 标准工序代码 + 现执行价格
* *
* @param statementVO * @param statementVO
* @param price * @param price
* @return * @return
*/ */
private boolean rule5(StatementVO statementVO, BigDecimal price) { private boolean rule7(StatementVO statementVO, BigDecimal price) {
List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList(); List<PriceSheetVO> priceSheetList = statementVO.getPriceSheetList();
if (CollectionUtils.isEmpty(priceSheetList)) { if (CollectionUtils.isEmpty(priceSheetList)) {
return false; return false;

@ -730,7 +730,8 @@
SELECT a.*, b.NAME as PPS_NAME, bu.real_name as CREATE_MAN SELECT a.*, b.NAME as PPS_NAME, bu.real_name as CREATE_MAN
FROM MES_WORK_PLAN a FROM MES_WORK_PLAN a
INNER JOIN BS_PROCESS_SET b ON a.PPS_ID = b.ID AND b.IS_DELETED = 0 INNER JOIN BS_PROCESS_SET b ON a.PPS_ID = b.ID AND b.IS_DELETED = 0
INNER JOIN BLADE_USER bu on a.create_user = bu.ID AND bu.IS_DELETED = 0 LEFT JOIN BLADE_USER bu on a.create_user = bu.ID AND bu.IS_DELETED = 0
WHERE a.IS_DELETED = 0 and a.WO_ID = #{woId} WHERE a.IS_DELETED = 0 and a.WO_ID = #{woId}
ORDER BY a.orders asc
</select> </select>
</mapper> </mapper>

@ -1,11 +1,10 @@
/**
* Author: Tom Shuo
*/
package org.springblade.desk.quality.controller; package org.springblade.desk.quality.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
@ -18,8 +17,8 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.boot.file.BladeFileUtil;
import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -27,12 +26,12 @@ import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.WebUtil;
import org.springblade.desk.basic.util.ExcelExtUtil; import org.springblade.desk.basic.util.ExcelExtUtil;
import org.springblade.desk.device.pojo.entity.EquipmentEntity; import org.springblade.desk.device.pojo.entity.EquipmentEntity;
import org.springblade.desk.device.service.IEquipmentService; import org.springblade.desk.device.service.IEquipmentService;
import org.springblade.desk.quality.constant.QAModuleConst; import org.springblade.desk.quality.constant.QAModuleConst;
import org.springblade.desk.quality.excel.IotThicknessExcel; import org.springblade.desk.quality.excel.IotThicknessExcel;
import org.springblade.desk.quality.pojo.entity.IotHardness;
import org.springblade.desk.quality.pojo.entity.IotThickness; import org.springblade.desk.quality.pojo.entity.IotThickness;
import org.springblade.desk.quality.pojo.vo.IotThicknessVO; import org.springblade.desk.quality.pojo.vo.IotThicknessVO;
import org.springblade.desk.quality.service.IIotThicknessService; import org.springblade.desk.quality.service.IIotThicknessService;
@ -42,7 +41,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.net.InetAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -120,51 +118,32 @@ public class IotThicknessController extends BladeController {
@PostMapping(value = "/queryChyData") @PostMapping(value = "/queryChyData")
public R queryChyData(@RequestBody JSONObject data) throws Exception { public R queryChyData(@RequestBody JSONObject data) {
InetAddress inetAddress = InetAddress.getLocalHost(); String ip = WebUtil.getIP();
String ip = inetAddress.getHostAddress(); List<EquipmentEntity> list = equipmentService.list(Wrappers.lambdaQuery(EquipmentEntity.class).eq(EquipmentEntity::getDeviceIp, ip));
// ip = "192.168.134.115";
QueryWrapper<EquipmentEntity> qw = new QueryWrapper<>();
qw.eq("DEVICE_IP",ip);
EquipmentEntity card = equipmentService.getOne(qw);
//根据ip查询设备 //根据ip查询设备
if (card == null) { if (CollectionUtils.isEmpty(list)) {
return R.fail(-2, "ip未找到对应的测量仪设备!" + ip); return R.fail(-2, "ip未找到对应的测量仪设备!" + ip);
} }
String deviceCode = card.getDeviceCode(); String deviceCode = list.get(0).getDeviceCode();
log.info("找到设备,设备编码: {}", deviceCode); log.info("找到设备,设备编码: {}", deviceCode);
Date startTime = data.getDate("startTime"); Date startTime = data.getDate("startTime");
Date endTime = data.getDate("endTime"); Date endTime = data.getDate("endTime");
Boolean allData = data.getBoolean("allData"); Boolean allData = data.getBoolean("allData");
List<IotThickness> qcHardnessIotList = new ArrayList<>(); LambdaQueryWrapper<IotThickness> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IotThickness::getEquipmentCode, deviceCode);
if (allData) { if (allData) {
// sb.append(" and not_use = 0"); wrapper.eq(IotThickness::getFlagRead, 0);
QueryWrapper<IotThickness> qwhard = new QueryWrapper<>();
// qwhard.eq("EQUIPMENT_CODE","LG020029");
qwhard.eq("EQUIPMENT_CODE",card.getDeviceCode());
qwhard.eq("FLAG_READ",0);
if(startTime != null && endTime != null){
qwhard.between("CREATE_TIME", startTime, endTime);
}
qwhard.orderByDesc("CREATE_TIME");
qcHardnessIotList = service.list(qwhard);
}else { }else {
// sb.append(" and not_use = 1"); wrapper.eq(IotThickness::getFlagRead, 1);
}
if(startTime != null && endTime != null){
QueryWrapper<IotThickness> qwhard = new QueryWrapper<>(); wrapper.between(IotThickness::getCreateTime, startTime, endTime);
// qwhard.eq("EQUIPMENT_CODE","LG020029");
qwhard.eq("EQUIPMENT_CODE",card.getDeviceCode());
qwhard.eq("FLAG_READ",1);
if(startTime != null && endTime != null){
qwhard.between("CREATE_TIME", startTime, endTime);
}
qwhard.orderByDesc("CREATE_TIME");
qcHardnessIotList = service.list(qwhard);
} }
wrapper.orderByDesc(IotThickness::getCreateTime);
List<IotThickness> qcHardnessIotList = service.list(wrapper);
List<JSONObject> resultList = new ArrayList<>(); List<JSONObject> resultList = new ArrayList<>();
@ -190,8 +169,6 @@ public class IotThicknessController extends BladeController {
} }
service.updateById(iot); service.updateById(iot);
} }
// 查到数据后,重置标记(返回null,前端下次请求不带标记)
// timeMarker = null;
} else { } else {
log.info("设备[{}]未查询到新数据", deviceCode); log.info("设备[{}]未查询到新数据", deviceCode);
} }

@ -328,7 +328,7 @@
wo.CARD_NO AS cardNo wo.CARD_NO AS cardNo
FROM MES_WORK_ORDER wo FROM MES_WORK_ORDER wo
-- 车间作业计划 wp -- 车间作业计划 wp
LEFT JOIN MES_WORK_PLAN wp ON wp.WO_ID = wo.ID LEFT JOIN MES_WORK_PLAN wp ON wo.WP_ID = wp.ID
-- 生产订单 yo -- 生产订单 yo
LEFT JOIN MES_YIELD_ORDER yo ON wo.YO_ID = yo.ID LEFT JOIN MES_YIELD_ORDER yo ON wo.YO_ID = yo.ID
-- 工序 -- 工序
@ -338,7 +338,7 @@
-- 班组 ts -- 班组 ts
LEFT JOIN BS_TEAM_SET ts ON wp.MAKE_TEAM = ts.ID LEFT JOIN BS_TEAM_SET ts ON wp.MAKE_TEAM = ts.ID
WHERE WHERE
wo.IS_DELETED = 0 and wo.RUN_STATUS = 2 wo.IS_DELETED = 0
<if test="q.wpId != null"> <if test="q.wpId != null">
AND t.WP_ID = #{q.wpId} AND t.WP_ID = #{q.wpId}
</if> </if>
@ -401,12 +401,12 @@
ps.CODE AS ppsCode ps.CODE AS ppsCode
FROM MES_WORK_ORDER wo FROM MES_WORK_ORDER wo
-- 车间作业计划 wp -- 车间作业计划 wp
LEFT JOIN MES_WORK_PLAN wp ON wp.WO_ID = wo.ID INNER JOIN MES_WORK_PLAN wp ON wp.WO_ID = wo.ID
-- 工序 -- 工序
LEFT JOIN BS_PROCESS_SET ps ON wp.ORDERS = ps.CODE INNER JOIN BS_PROCESS_SET ps ON wp.pps_id = ps.id
WHERE WHERE
wo.IS_DELETED = 0 and wo.id = #{woId} wo.IS_DELETED = 0 and wo.id = #{woId}
ORDER BY wp.orders ASC
</select> </select>
</mapper> </mapper>

@ -692,19 +692,25 @@ public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMap
JSONObject yoJson = new JSONObject(); JSONObject yoJson = new JSONObject();
JSONObject partJson = new JSONObject(); JSONObject partJson = new JSONObject();
JSONObject modelJson = new JSONObject(); JSONObject modelJson = new JSONObject();
partJson.put("partCode", dsPart.getPartCode()); if(dsPart != null){
partJson.put("partName", dsPart.getPartName()); partJson.put("partCode", dsPart.getPartCode());
partJson.put("hardness", dsPart.getHardness()); partJson.put("partName", dsPart.getPartName());
partJson.put("plate", dsPart.getPlate()); partJson.put("hardness", dsPart.getHardness());
partJson.put("material", dsPart.getMaterial()); partJson.put("plate", dsPart.getPlate());
partJson.put("cruxMemo", dsPart.getKeyInfo()); partJson.put("material", dsPart.getMaterial());
partJson.put("memo", dsPart.getRemarks()); partJson.put("cruxMemo", dsPart.getKeyInfo());
yoJson.put("productType", yo.getProductType()); partJson.put("memo", dsPart.getRemarks());
yoJson.put("prodIdent", yo.getProductIdent()); }
yoJson.put("poQty", yo.getYpQty()); if(yo != null){
yoJson.put("poArea", yo.getYpArea()); yoJson.put("productType", yo.getProductType());
yoJson.put("primaryCraft", yo.getPrimaryCraft()); yoJson.put("prodIdent", yo.getProductIdent());
woJson.put("batchNo", wo.getBatchNo()); yoJson.put("poQty", yo.getYpQty());
yoJson.put("poArea", yo.getYpArea());
yoJson.put("primaryCraft", yo.getPrimaryCraft());
}
if(wo != null){
woJson.put("batchNo", wo.getBatchNo());
}
woJson.put("pjYieldOrder", yoJson); woJson.put("pjYieldOrder", yoJson);
modelJson.put("wo", woJson); modelJson.put("wo", woJson);
modelJson.put("dsPart", partJson); modelJson.put("dsPart", partJson);

Loading…
Cancel
Save