From 124ecca15d3c5d6dcefa9a27aaa3c07c556674e9 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期二, 30 七月 2024 12:34:42 +0800 Subject: [PATCH] PK8000逻辑处理 --- cnas-server/src/main/java/com/yuanchu/mom/mapper/DeviceMapper.java | 2 cnas-server/src/main/resources/mapper/DeviceMapper.xml | 27 + cnas-server/src/main/resources/mapper/PkSlaveMapper.xml | 25 + cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkMasterServiceImpl.java | 339 ++++++++++++++++++++++++++ cnas-server/src/main/java/com/yuanchu/mom/controller/PkMasterController.java | 18 + cnas-server/src/main/java/com/yuanchu/mom/service/PkMasterService.java | 18 + inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 4 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java | 2 cnas-server/src/main/java/com/yuanchu/mom/pojo/PkSlave.java | 80 ++++++ cnas-server/src/main/java/com/yuanchu/mom/mapper/PkSlaveMapper.java | 16 + cnas-server/src/main/java/com/yuanchu/mom/service/PkSlaveService.java | 16 + inspect-server/src/main/resources/mapper/InsProductMapper.xml | 3 cnas-server/src/main/java/com/yuanchu/mom/controller/PkSlaveController.java | 18 + cnas-server/src/main/java/com/yuanchu/mom/service/impl/DeviceServiceImpl.java | 10 inspect-server/src/main/java/com/yuanchu/mom/pojo/InsSample.java | 2 cnas-server/src/main/resources/mapper/PkMasterMapper.xml | 19 + cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java | 33 ++ cnas-server/src/main/java/com/yuanchu/mom/service/DeviceService.java | 3 cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkSlaveServiceImpl.java | 20 + cnas-server/src/main/java/com/yuanchu/mom/pojo/PkMaster.java | 64 ++++ cnas-server/src/main/java/com/yuanchu/mom/mapper/PkMasterMapper.java | 16 + 21 files changed, 723 insertions(+), 12 deletions(-) diff --git a/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java b/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java index 00d3ad2..96dd926 100644 --- a/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java +++ b/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java @@ -10,8 +10,10 @@ import com.yuanchu.mom.dto.DeviceDto; import com.yuanchu.mom.pojo.DataConfig; import com.yuanchu.mom.pojo.Device; +import com.yuanchu.mom.pojo.PkMaster; import com.yuanchu.mom.service.DataConfigService; import com.yuanchu.mom.service.DeviceService; +import com.yuanchu.mom.service.PkMasterService; import com.yuanchu.mom.utils.DataAcquisition; import com.yuanchu.mom.utils.JackSonUtil; import com.yuanchu.mom.vo.Result; @@ -49,6 +51,9 @@ @Autowired private DataConfigService dataConfigService; + @Autowired + private PkMasterService pkMasterService; + @ValueClassify("璁惧") @ApiOperation(value = "鏌ヨ璁惧璇︽儏鍒楄〃") @PostMapping("/selectDeviceParameter") @@ -57,18 +62,21 @@ DeviceDto itemParameter = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), DeviceDto.class); return Result.success(deviceService.selectDeviceParameter(page, itemParameter)); } + @ValueClassify("璁惧") @ApiOperation(value = "娣诲姞璁惧璇︽儏鍙傛暟") @PostMapping("/addDeviceParameter") public Result addDeviceParameter(@RequestBody Device itemParameter) { return Result.success(deviceService.addDeviceParameter(itemParameter)); } + @ValueClassify("璁惧") @ApiOperation(value = "鍒犻櫎璁惧璇︽儏鍙傛暟") @PostMapping("/delDeviceParameter") public Result<?> delDeviceParameter(Integer id) { return Result.success(deviceService.delDeviceParameter(id)); } + @ValueClassify("璁惧") @ApiOperation(value = "淇敼璁惧璇︽儏鍙傛暟") @PostMapping("/upDeviceParameter") @@ -169,8 +177,8 @@ @ApiOperation("/鏁伴噰-鏁版嵁閲囬泦") @GetMapping("/dataCollection") public Result<?> dataAcquisition(HttpServletRequest request, @RequestParam("id") Integer id, - @RequestParam("entrustCode") String entrustCode, - @RequestParam("sampleCode") String sampleCode) { + @RequestParam("entrustCode") String entrustCode, + @RequestParam("sampleCode") String sampleCode) { return deviceService.dataAcquisition(request, id, entrustCode, sampleCode); } @@ -231,9 +239,9 @@ @RequestParam(value = "inspectionItemSubclass", required = false) String inspectionItemSubclass) { if (isDevice) { List<DataConfig> list = dataConfigService.list(Wrappers.<DataConfig>lambdaQuery() - .eq(DataConfig::getDeviceId, deviceId) - .eq(DataConfig::getInspectionItem, inspectionItem) - .eq(DataConfig::getInspectionItemSubclass, inspectionItemSubclass)); + .eq(DataConfig::getDeviceId, deviceId) + .eq(DataConfig::getInspectionItem, inspectionItem) + .eq(DataConfig::getInspectionItemSubclass, inspectionItemSubclass)); return Result.success(list); } else { return Result.success(dataConfigService.selectDataConfigList(deviceId)); @@ -256,5 +264,20 @@ public Result menu() { return Result.success(deviceService.menu()); } + + + @ValueClassify("璁惧") + @ApiOperation(value = "娓╁害寰幆鏁伴噰") + @PostMapping("/temDataAcquisition") + public Result<?> temDataAcquisition(@RequestBody PkMaster pkMaster) { + return Result.success(pkMasterService.temDataAcquisition(pkMaster)); + } + + @ApiOperation(value = "宸︿晶璁惧鏍戝舰鏍�") + @GetMapping("/treeDevice") + @ValueAuth + public Result treeDevice(String deviceName) { + return Result.success(deviceService.treeDevice(deviceName)); + } } diff --git a/cnas-server/src/main/java/com/yuanchu/mom/controller/PkMasterController.java b/cnas-server/src/main/java/com/yuanchu/mom/controller/PkMasterController.java new file mode 100644 index 0000000..72d21e0 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/controller/PkMasterController.java @@ -0,0 +1,18 @@ +package com.yuanchu.mom.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * <p> + * 鍓嶇鎺у埗鍣� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:26 + */ +@RestController +@RequestMapping("/pkMaster") +public class PkMasterController { + +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/controller/PkSlaveController.java b/cnas-server/src/main/java/com/yuanchu/mom/controller/PkSlaveController.java new file mode 100644 index 0000000..098c425 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/controller/PkSlaveController.java @@ -0,0 +1,18 @@ +package com.yuanchu.mom.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * <p> + * 鍓嶇鎺у埗鍣� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:39 + */ +@RestController +@RequestMapping("/pkSlave") +public class PkSlaveController { + +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/mapper/DeviceMapper.java b/cnas-server/src/main/java/com/yuanchu/mom/mapper/DeviceMapper.java index 572a1aa..597c683 100644 --- a/cnas-server/src/main/java/com/yuanchu/mom/mapper/DeviceMapper.java +++ b/cnas-server/src/main/java/com/yuanchu/mom/mapper/DeviceMapper.java @@ -35,5 +35,7 @@ IPage<DeviceDto> selectDeviceParameterPage(Page page, @Param("ew") QueryWrapper<DeviceDto> queryWrappers); List<Map<String, Object>> getInspectionItemSubclass(@Param("id") Integer id); + + List<Map<String, Object>> treeDevice(@Param("deviceName") String deviceName); } diff --git a/cnas-server/src/main/java/com/yuanchu/mom/mapper/PkMasterMapper.java b/cnas-server/src/main/java/com/yuanchu/mom/mapper/PkMasterMapper.java new file mode 100644 index 0000000..85464d7 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/mapper/PkMasterMapper.java @@ -0,0 +1,16 @@ +package com.yuanchu.mom.mapper; + +import com.yuanchu.mom.pojo.PkMaster; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * <p> + * Mapper 鎺ュ彛 + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:26 + */ +public interface PkMasterMapper extends BaseMapper<PkMaster> { + +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/mapper/PkSlaveMapper.java b/cnas-server/src/main/java/com/yuanchu/mom/mapper/PkSlaveMapper.java new file mode 100644 index 0000000..169ecd6 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/mapper/PkSlaveMapper.java @@ -0,0 +1,16 @@ +package com.yuanchu.mom.mapper; + +import com.yuanchu.mom.pojo.PkSlave; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * <p> + * Mapper 鎺ュ彛 + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:39 + */ +public interface PkSlaveMapper extends BaseMapper<PkSlave> { + +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/pojo/PkMaster.java b/cnas-server/src/main/java/com/yuanchu/mom/pojo/PkMaster.java new file mode 100644 index 0000000..7a863c6 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/pojo/PkMaster.java @@ -0,0 +1,64 @@ +package com.yuanchu.mom.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +import com.yuanchu.mom.common.OrderBy; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +/** + * <p> + * + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:26 + */ +@Getter +@Setter +@TableName("device_pk_master") +@ApiModel(value = "PkMaster瀵硅薄", description = "娓╁害寰幆鏁伴噰瀛愯〃") +public class PkMaster extends OrderBy implements Serializable { + + + @ApiModelProperty("涓婚敭id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("濮旀墭鍗曠紪鍙�") + private String entrustCode; + + @ApiModelProperty("鏍峰搧缂栧彿") + private String sampleCode; + + @ApiModelProperty("鍨嬪彿") + private String model; + + @ApiModelProperty("寰幆娆℃暟") + private String cycles; + + @ApiModelProperty("娓╁害寰幆") + private String temperature; + + @ApiModelProperty("鍏夌氦鏍规暟") + private Integer numberOpticalFibers; + + @ApiModelProperty("device_pk_slave鍏宠仈瀛楁") + private String isid; + + @ApiModelProperty("妫�楠屾椂闂�") + private LocalDateTime detectionDate; + + @ApiModelProperty("妫�楠屼汉") + private String detectionPeople; + + +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/pojo/PkSlave.java b/cnas-server/src/main/java/com/yuanchu/mom/pojo/PkSlave.java new file mode 100644 index 0000000..ac89dfe --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/pojo/PkSlave.java @@ -0,0 +1,80 @@ +package com.yuanchu.mom.pojo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.yuanchu.mom.common.OrderBy; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +/** + * <p> + * + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:39 + */ +@Getter +@Setter +@TableName("device_pk_slave") +@ApiModel(value = "PkSlave瀵硅薄", description = "娓╁害寰幆鏁伴噰瀛愯〃") +public class PkSlave extends OrderBy implements Serializable { + + @ApiModelProperty("涓婚敭id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("琛板噺绯荤粺1310(dB/km)-A绔�") + private Double weaken1310A; + + @ApiModelProperty("琛板噺绯荤粺1310(dB/km)-B绔�") + private Double weaken1310B; + + @ApiModelProperty("琛板噺绯荤粺1550(dB/km)-A绔�") + private Double weaken1550A; + + @ApiModelProperty("琛板噺绯荤粺1550(dB/km)-B绔�") + private Double weaken1550B; + + @ApiModelProperty("琛板噺绯荤粺1625(dB/km)-A绔�") + private Double weaken1625A; + + @ApiModelProperty("琛板噺绯荤粺1625(dB/km)-B绔�") + private Double weaken1625B; + + @ApiModelProperty("琛板噺绯荤粺1383(dB/km)-A绔�") + private Double weaken1383A; + + @ApiModelProperty("琛板噺绯荤粺1383(dB/km)-B绔�") + private Double weaken1383B; + + @ApiModelProperty("琛板噺绯荤粺1490(dB/km)-A绔�") + private Double weaken1490A; + + @ApiModelProperty("琛板噺绯荤粺1490(dB/km)-B绔�") + private Double weaken1490B; + + @ApiModelProperty("绠¤壊鏍噄d") + private String insBushingId; + + @ApiModelProperty("鍏夌氦甯d") + private String insFibersId; + + @ApiModelProperty("鍏夌氦缂栧彿id") + private String insFiberId; + + @ApiModelProperty("device_pk_master鍏宠仈瀛楁") + private String shiftId; + + @ApiModelProperty("鍒涘缓鏃堕棿") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/service/DeviceService.java b/cnas-server/src/main/java/com/yuanchu/mom/service/DeviceService.java index a7de1e7..9da6d79 100644 --- a/cnas-server/src/main/java/com/yuanchu/mom/service/DeviceService.java +++ b/cnas-server/src/main/java/com/yuanchu/mom/service/DeviceService.java @@ -5,6 +5,7 @@ import com.yuanchu.mom.dto.ADto; import com.yuanchu.mom.dto.DeviceDto; import com.yuanchu.mom.pojo.Device; +import com.yuanchu.mom.pojo.PkMaster; import com.yuanchu.mom.vo.Result; import javax.servlet.http.HttpServletRequest; @@ -39,4 +40,6 @@ Result<?> dataAcquisition(HttpServletRequest request, Integer id, String entrustCode, String sampleCode); List<ADto> menu(); + + List<Map<String, Object>> treeDevice(String deviceName); } diff --git a/cnas-server/src/main/java/com/yuanchu/mom/service/PkMasterService.java b/cnas-server/src/main/java/com/yuanchu/mom/service/PkMasterService.java new file mode 100644 index 0000000..cca8175 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/service/PkMasterService.java @@ -0,0 +1,18 @@ +package com.yuanchu.mom.service; + +import com.yuanchu.mom.pojo.PkMaster; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * <p> + * 鏈嶅姟绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:26 + */ +public interface PkMasterService extends IService<PkMaster> { + + //娓╁害寰幆鏁伴噰 + int temDataAcquisition(PkMaster pkMaster); +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/service/PkSlaveService.java b/cnas-server/src/main/java/com/yuanchu/mom/service/PkSlaveService.java new file mode 100644 index 0000000..cdb6532 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/service/PkSlaveService.java @@ -0,0 +1,16 @@ +package com.yuanchu.mom.service; + +import com.yuanchu.mom.pojo.PkSlave; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * <p> + * 鏈嶅姟绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:39 + */ +public interface PkSlaveService extends IService<PkSlave> { + +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/service/impl/DeviceServiceImpl.java b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/DeviceServiceImpl.java index 8e19722..0d8377b 100644 --- a/cnas-server/src/main/java/com/yuanchu/mom/service/impl/DeviceServiceImpl.java +++ b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/DeviceServiceImpl.java @@ -956,4 +956,14 @@ return aDtos; } + + @Override + public List<Map<String, Object>> treeDevice(String deviceName) { + List<Map<String, Object>> listMap = deviceMapper.treeDevice(deviceName); + /* Map<String, List<Device>> listMap = devices.stream() + .collect(Collectors.groupingBy(device -> + device.getLargeCategory() != null ? device.getLargeCategory() : "鍏朵粬" + ));*/ + return listMap; + } } diff --git a/cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkMasterServiceImpl.java b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkMasterServiceImpl.java new file mode 100644 index 0000000..527c212 --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkMasterServiceImpl.java @@ -0,0 +1,339 @@ +package com.yuanchu.mom.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.yuanchu.mom.common.GetLook; +import com.yuanchu.mom.exception.ErrorException; +import com.yuanchu.mom.mapper.*; +import com.yuanchu.mom.pojo.*; +import com.yuanchu.mom.service.InsOrderPlanService; +import com.yuanchu.mom.service.PkMasterService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yuanchu.mom.vo.ProductVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.*; + +/** + * <p> + * 鏈嶅姟瀹炵幇绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:26 + */ +@Service +public class PkMasterServiceImpl extends ServiceImpl<PkMasterMapper, PkMaster> implements PkMasterService { + + @Resource + private PkMasterMapper pkMasterMapper; + + @Resource + private PkSlaveMapper pkSlaveMapper; + + @Resource + private InsOrderMapper insOrderMapper; + + @Resource + private InsSampleMapper insSampleMapper; + + @Resource + private InsProductMapper insProductMapper; + + @Resource + private InsProductResultMapper insProductResultMapper; + + @Resource + private InsProductUserMapper insProductUserMapper; + + @Resource + private UserMapper userMapper; + + @Resource + private InsOrderPlanService insOrderPlanService; + + @Resource + GetLook getLook; + + //娓╁害寰幆鏁伴噰 + @Override + @Transactional(rollbackFor = Exception.class) + public int temDataAcquisition(PkMaster pkMaster) { + Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); + //鏌ヨ鏁伴噰鍏宠仈鐨勫瓙琛ㄤ俊鎭� + PkMaster master = pkMasterMapper.selectOne(Wrappers.<PkMaster>lambdaQuery() + .eq(PkMaster::getEntrustCode, pkMaster.getEntrustCode()) + .eq(PkMaster::getSampleCode, pkMaster.getSampleCode()) + .eq(PkMaster::getModel, pkMaster.getModel()) + .eq(PkMaster::getTemperature, pkMaster.getTemperature())); + if (ObjectUtils.isEmpty(master)) { + throw new ErrorException("娌℃湁鎵惧埌瀵瑰簲濮旀墭鍗�" + pkMaster.getEntrustCode() + "鐨勬暟閲囨暟鎹�"); + } + List<PkSlave> pkSlaves = pkSlaveMapper.selectList(Wrappers.<PkSlave>lambdaQuery().eq(PkSlave::getShiftId, master.getIsid())); + if (CollectionUtils.isEmpty(pkSlaves)) { + throw new ErrorException("娌℃湁鎵惧埌瀵瑰簲濮旀墭鍗�" + pkMaster.getEntrustCode() + "鐨勬暟閲囧瓙鏁版嵁"); + } + //鏌ヨ瀵瑰簲鐨勬楠屽崟琛� + InsOrder insOrder = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 1).eq(InsOrder::getEntrustCode, pkMaster.getEntrustCode())); + if (ObjectUtils.isEmpty(insOrder)) { + throw new ErrorException("娌℃湁鎵惧埌瀵瑰簲濮旀墭鍗�" + pkMaster.getEntrustCode()); + } + //鏌ヨ瀵瑰簲妫�楠屾牱鍝乮d + InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() + .eq(InsSample::getInsOrderId, insOrder.getId()) + .eq(InsSample::getSampleCode, pkMaster.getSampleCode()) + .eq(InsSample::getModel, pkMaster.getModel())); + if (ObjectUtils.isEmpty(insSample)) { + throw new ErrorException("娌℃湁鎵惧埌瀵瑰簲濮旀墭鍗曚笅鐨勮鏍峰搧" + pkMaster.getSampleCode()); + } + //鏌ヨ瀵瑰簲妫�楠岄」鐩� + Map<String, Object> map = insOrderPlanService.temCycle(insSample.getId(), pkMaster.getCycles(), pkMaster.getTemperature()); + List<ProductVo> productVos = (List<ProductVo>) map.get("productVos"); + if (CollectionUtils.isEmpty(map)) { + throw new ErrorException("娌℃湁鎵惧埌瀵瑰簲濮旀墭鍗曚笅璇ユ牱鍝佺殑鐩稿叧娓╁害寰幆妫�楠岄」鐩殑寰幆" + pkMaster.getCycles() + "娆�+娓╁害" + pkMaster.getTemperature()); + } + + //todo 濡傛灉娓╁害寰幆鐨勯」鐩畁m鏈夋敼鍔ㄨ繖閲岄渶瑕佹敼鍔� @zss + for (PkSlave pkSlave : pkSlaves) { + for (ProductVo productVo : productVos) { + if (pkSlave.getInsBushingId().equals(productVo.getBushColor()) && + pkSlave.getInsFibersId().equals(productVo.getCode()) && + pkSlave.getInsFiberId().equals(productVo.getColor())) { + //鎵惧埌瀵瑰簲鐨勬暟鎹�(瀵瑰簲濂楃鍏夌氦鐨勬暟鎹�) + List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, productVo.getInsProduct().getId())); + InsProductResult result; + if (CollectionUtils.isEmpty(results)) { + result = new InsProductResult(); + } else { + result = results.get(0); + } + result.setInsProductId(productVo.getInsProduct().getId());//妫�楠岄」鐩甶d + List<Map<String, Object>> iv = new ArrayList<>(); + List<Map<String, Object>> cv = new ArrayList<>(); + if (productVo.getInsProduct().getInspectionItemClass().equals("1310nm")) { + //1310nm澶栫 + Map<String, Object> map1 = new HashMap<>(); + map1.put("u", userId + ""); + map1.put("v", pkSlave.getWeaken1310A()); + iv.add(map1); + //1310nm鍐呯 + Map<String, Object> map2 = new HashMap<>(); + map2.put("u", userId + ""); + map2.put("v", pkSlave.getWeaken1310B()); + iv.add(map2); + //1310nm琛板噺绯绘暟 + Map<String, Object> map3 = new HashMap<>(); + map3.put("v", (pkSlave.getWeaken1310A() + pkSlave.getWeaken1310B()) / 2); + cv.add(map3); + } + else if (productVo.getInsProduct().getInspectionItemClass().equals("1550nm")) { + //1550nm澶栫 + Map<String, Object> map1 = new HashMap<>(); + map1.put("u", userId + ""); + map1.put("v", pkSlave.getWeaken1550A()); + iv.add(map1); + //1550nm鍐呯 + Map<String, Object> map2 = new HashMap<>(); + map2.put("u", userId + ""); + map2.put("v", pkSlave.getWeaken1550B()); + iv.add(map2); + //1550nm琛板噺绯绘暟 + Map<String, Object> map3 = new HashMap<>(); + map3.put("v", (pkSlave.getWeaken1550A() + pkSlave.getWeaken1550B()) / 2); + cv.add(map3); + } + else if (productVo.getInsProduct().getInspectionItemClass().equals("1625nm")) { + //1625nm澶栫 + Map<String, Object> map1 = new HashMap<>(); + map1.put("u", userId + ""); + map1.put("v", pkSlave.getWeaken1625A()); + iv.add(map1); + //1625nm鍐呯 + Map<String, Object> map2 = new HashMap<>(); + map2.put("u", userId + ""); + map2.put("v", pkSlave.getWeaken1625B()); + iv.add(map2); + //1625nm琛板噺绯绘暟 + Map<String, Object> map3 = new HashMap<>(); + map3.put("v", (pkSlave.getWeaken1625A() + pkSlave.getWeaken1625B()) / 2); + cv.add(map3); + } + else if (productVo.getInsProduct().getInspectionItemClass().equals("1383nm")) { + //1383nm澶栫 + Map<String, Object> map1 = new HashMap<>(); + map1.put("u", userId + ""); + map1.put("v", pkSlave.getWeaken1383A()); + iv.add(map1); + //1383nm鍐呯 + Map<String, Object> map2 = new HashMap<>(); + map2.put("u", userId + ""); + map2.put("v", pkSlave.getWeaken1383B()); + iv.add(map2); + //1383nm琛板噺绯绘暟 + Map<String, Object> map3 = new HashMap<>(); + map3.put("v", (pkSlave.getWeaken1383A() + pkSlave.getWeaken1383B()) / 2); + cv.add(map3); + } + else if (productVo.getInsProduct().getInspectionItemClass().equals("1490nm")) { + //1490nm澶栫 + Map<String, Object> map1 = new HashMap<>(); + map1.put("u", userId + ""); + map1.put("v", pkSlave.getWeaken1490A()); + iv.add(map1); + //1490nm鍐呯 + Map<String, Object> map2 = new HashMap<>(); + map2.put("u", userId + ""); + map2.put("v", pkSlave.getWeaken1490B()); + iv.add(map2); + //1490nm琛板噺绯绘暟 + Map<String, Object> map3 = new HashMap<>(); + map3.put("v", (pkSlave.getWeaken1490A() + pkSlave.getWeaken1490B()) / 2); + cv.add(map3); + } + else { + throw new ErrorException("娌℃湁鎵惧埌璇ユ俯搴︾殑妫�楠岄」鐩�" + productVo.getInsProduct().getInspectionItemClass()); + } + result.setInsValue(JSON.toJSONString(iv));//妫�楠屽�� + result.setComValue(JSON.toJSONString(cv));//璁$畻鍊� + result.setEquipValue(null);//璁惧缂栧彿 + result.setEquipName(null);//璁惧鍚嶇О + if (BeanUtil.isEmpty(result.getId())) { + result.setCreateUser(userId); + result.setUpdateUser(userId); + insProductResultMapper.insert(result); + } else { + result.setUpdateUser(userId); + result.setUpdateTime(LocalDateTime.now()); + insProductResultMapper.updateById(result); + } + + InsProduct insProduct = productVo.getInsProduct(); + String comple = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId())).getComValue().split(":")[1].split("\"")[1]; + //棣栧厛鏌ョ湅娓╁害鏄惁鏄�20搴﹀父娓� + if (!pkMaster.getTemperature().equals("20鈩�(甯告俯)")) { + //濡傛灉涓嶆槸鍏堟煡璇㈡槸鍚︽湁鍊� + int a = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, insSample.getId()) + .eq(InsProduct::getInspectionItem, "1") + .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)")).stream().map(InsProduct::getInsResult).anyMatch(ObjectUtils::isEmpty) ? 1 : 0; + if (a == 1) { + throw new ErrorException("鍏堣幏鍙�20鈩�(甯告俯)鐨勬楠屽��,鍐嶈幏鍙栧叾浠栨俯搴�" + pkMaster.getSampleCode()); + } else { + //璁$畻琛板噺宸� + InsProduct insPro = null; + switch (insProduct.getInspectionItemClass()) { + case "1310nm": + //鏌ヨ20鈩�(甯告俯)1310nm鐨勮“鍑忕郴鏁� + try { + insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, insSample.getId()) + .eq(InsProduct::getInspectionItem, "1") + .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)") + .eq(InsProduct::getInspectionItemClass, "1310nm") + .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId())); + } catch (Exception e) { + throw new ErrorException("娌℃湁鏌ュ埌20鈩�(甯告俯),1310nm椤圭洰" + productVo.getInsProduct().getInsFiberId() + "鍏夌氦鐨勬楠岄」鐩�"); + } + break; + case "1550nm": + //鏌ヨ20鈩�(甯告俯)1550nm鐨勮“鍑忕郴鏁� + try { + insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, insSample.getId()) + .eq(InsProduct::getInspectionItem, "1") + .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)") + .eq(InsProduct::getInspectionItemClass, "1550nm") + .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId())); + } catch (Exception e) { + throw new ErrorException("娌℃湁鏌ュ埌20鈩�(甯告俯),1625nm椤圭洰" + productVo.getInsProduct().getInsFiberId() + "鍏夌氦鐨勬楠岄」鐩�"); + } + break; + case "1625nm": + //鏌ヨ20鈩�(甯告俯)1625nm鐨勮“鍑忕郴鏁� + try { + insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, insSample.getId()) + .eq(InsProduct::getInspectionItem, "1") + .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)") + .eq(InsProduct::getInspectionItemClass, "1625nm") + .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId())); + } catch (Exception e) { + throw new ErrorException("娌℃湁鏌ュ埌20鈩�(甯告俯),1625nm椤圭洰" + productVo.getInsProduct().getInsFiberId() + "鍏夌氦鐨勬楠岄」鐩�"); + } + break; + case "1383nm": + //鏌ヨ20鈩�(甯告俯)1383nm鐨勮“鍑忕郴鏁� + try { + insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, insSample.getId()) + .eq(InsProduct::getInspectionItem, "1") + .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)") + .eq(InsProduct::getInspectionItemClass, "1383nm") + .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId())); + } catch (Exception e) { + throw new ErrorException("娌℃湁鏌ュ埌20鈩�(甯告俯),1383nm椤圭洰" + productVo.getInsProduct().getInsFiberId() + "鍏夌氦鐨勬楠岄」鐩�"); + } + break; + case "1490nm": + //鏌ヨ20鈩�(甯告俯)1490nm鐨勮“鍑忕郴鏁� + try { + insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, insSample.getId()) + .eq(InsProduct::getInspectionItem, "1") + .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)") + .eq(InsProduct::getInspectionItemClass, "1490nm") + .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId())); + } catch (Exception e) { + throw new ErrorException("娌℃湁鏌ュ埌20鈩�(甯告俯),1490nm椤圭洰" + productVo.getInsProduct().getInsFiberId() + "鍏夌氦鐨勬楠岄」鐩�"); + } + break; + } + InsProductResult insProductRes = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insPro.getId())); + insProduct.setLastValue(String.valueOf(Math.abs(Double.parseDouble(insProductRes.getComValue().split(":")[1].split("\"")[1]) - Double.parseDouble(comple)))); + String ask = insProduct.getAsk(); + int insResult=1; + switch (ask.charAt(0)) { + case '<': + insResult = Double.parseDouble(insProduct.getLastValue()) < Double.parseDouble(ask.substring(1)) ? 1 : 0; + break; + case '>': + insResult = Double.parseDouble(insProduct.getLastValue()) > Double.parseDouble(ask.substring(1)) ? 1 : 0; + break; + case '=': + insResult = Double.parseDouble(insProduct.getLastValue()) == Double.parseDouble(ask.substring(1)) ? 1 : 0; + break; + case '鈮�': + insResult = Double.parseDouble(insProduct.getLastValue()) <= Double.parseDouble(ask.substring(1)) ? 1 : 0; + break; + case '鈮�': + insResult = Double.parseDouble(insProduct.getLastValue()) >= Double.parseDouble(ask.substring(1)) ? 1 : 0; + break; + } + insProduct.setInsResult(insResult); + } + } + else { + //濡傛灉鏄�20搴﹀父娓�,闇�瑕佺粰鍑哄悎鏍肩殑缁撹 + insProduct.setInsResult(1);//20搴﹀父娓╃殑妫�楠岄」榛樿涓哄悎鏍� + } + insProduct.setUpdateUser(userId); + insProductMapper.updateById(insProduct); + User user = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, pkMaster.getDetectionPeople())); + if (ObjectUtils.isNotEmpty(user)){ + throw new ErrorException("lims绯荤粺娌℃湁鎵惧埌璇ョ敤鎴�"+ pkMaster.getDetectionPeople()); + } + insProductUserMapper.insert(new InsProductUser(null, user.getId(), pkMaster.getDetectionDate(), insProduct.getId())); + } + } + } + return 0; + } +} diff --git a/cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkSlaveServiceImpl.java b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkSlaveServiceImpl.java new file mode 100644 index 0000000..e620b8b --- /dev/null +++ b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/PkSlaveServiceImpl.java @@ -0,0 +1,20 @@ +package com.yuanchu.mom.service.impl; + +import com.yuanchu.mom.pojo.PkSlave; +import com.yuanchu.mom.mapper.PkSlaveMapper; +import com.yuanchu.mom.service.PkSlaveService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * <p> + * 鏈嶅姟瀹炵幇绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-07-29 01:16:39 + */ +@Service +public class PkSlaveServiceImpl extends ServiceImpl<PkSlaveMapper, PkSlave> implements PkSlaveService { + +} diff --git a/cnas-server/src/main/resources/mapper/DeviceMapper.xml b/cnas-server/src/main/resources/mapper/DeviceMapper.xml index be1391a..b9f80a9 100644 --- a/cnas-server/src/main/resources/mapper/DeviceMapper.xml +++ b/cnas-server/src/main/resources/mapper/DeviceMapper.xml @@ -118,9 +118,32 @@ </select> <select id="getInspectionItemSubclass" resultType="map"> - SELECT ip.inspection_item, if(ip.inspection_item_subclass is not null and ip.inspection_item_subclass != '', - ip.inspection_item_subclass, ip.inspection_item) inspection_item_subclass + SELECT ip.inspection_item, + if(ip.inspection_item_subclass is not null and ip.inspection_item_subclass != '', + ip.inspection_item_subclass, ip.inspection_item) inspection_item_subclass FROM ins_product ip where ip.ins_sample_id = #{id} </select> + + + <resultMap id="treeDeviceDto" type="map"> + <result property="largeCategory" column="large_category"/> + <collection property="children" resultMap="DeviceDto" javaType="List"/> + </resultMap> + + <resultMap id="DeviceDto" type="map"> + <id property="id" column="id"/> + <result property="deviceName" column="device_name"/> + </resultMap> + <select id="treeDevice" resultMap="treeDeviceDto"> + select id, + case when large_category is null || large_category ='' then '鍏朵粬' + else large_category end as large_category, device_name + from device + <where> + <if test="deviceName!=null and deviceName!=''"> + and device_name like concat('%',#{deviceName},'%') + </if> + </where> + </select> </mapper> diff --git a/cnas-server/src/main/resources/mapper/PkMasterMapper.xml b/cnas-server/src/main/resources/mapper/PkMasterMapper.xml new file mode 100644 index 0000000..c64186a --- /dev/null +++ b/cnas-server/src/main/resources/mapper/PkMasterMapper.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.yuanchu.mom.mapper.PkMasterMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.PkMaster"> + <id column="id" property="id" /> + <result column="entrust_code" property="entrustCode" /> + <result column="sample_code" property="sampleCode" /> + <result column="model" property="model" /> + <result column="cycles" property="cycles" /> + <result column="temperature" property="temperature" /> + <result column="number_optical_fibers" property="numberOpticalFibers" /> + <result column="ISID" property="isid" /> + <result column="detection_date" property="detectionDate" /> + <result column="detection_people" property="detectionPeople" /> + </resultMap> + +</mapper> diff --git a/cnas-server/src/main/resources/mapper/PkSlaveMapper.xml b/cnas-server/src/main/resources/mapper/PkSlaveMapper.xml new file mode 100644 index 0000000..7263295 --- /dev/null +++ b/cnas-server/src/main/resources/mapper/PkSlaveMapper.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.yuanchu.mom.mapper.PkSlaveMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.PkSlave"> + <id column="id" property="id" /> + <result column="weaken_1310_A" property="weaken1310A" /> + <result column="weaken_1310_B" property="weaken1310B" /> + <result column="weaken_1550_A" property="weaken1550A" /> + <result column="weaken_1550_B" property="weaken1550B" /> + <result column="weaken_1625_A" property="weaken1625A" /> + <result column="weaken_1625_B" property="weaken1625B" /> + <result column="weaken_1383_A" property="weaken1383A" /> + <result column="weaken_1383_B" property="weaken1383B" /> + <result column="weaken_1490_A" property="weaken1490A" /> + <result column="weaken_1490_B" property="weaken1490B" /> + <result column="ins_bushing_id" property="insBushingId" /> + <result column="ins_fibers_id" property="insFibersId" /> + <result column="ins_fiber_id" property="insFiberId" /> + <result column="shift_id" property="shiftId" /> + <result column="create_time" property="createTime" /> + </resultMap> + +</mapper> diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsSample.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsSample.java index b49c75c..eefacfc 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsSample.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsSample.java @@ -112,6 +112,6 @@ private Integer parentId; @TableField(select = false,exist = false) - private Integer num; + private Integer num=1; } \ No newline at end of file diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java index 08d782e..11b1b15 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java @@ -399,7 +399,7 @@ ProductVo productVo = new ProductVo(); productVo.setCode(insFiber.getCode()); productVo.setColor(fiber.getColor()); - productVo.setBushColor(fiber.getBushColor()); + productVo.setBushColor(insBushing.getColor()); if (ObjectUtils.isNotEmpty(insProductResult)) { insProduct.setInsProductResult(insProductResult); } @@ -432,7 +432,7 @@ for (InsProduct insProduct : insProducts) { InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId())); ProductVo productVo = new ProductVo(); - productVo.setCode("/"); + productVo.setCode("-"); productVo.setColor(fiber.getColor()); productVo.setBushColor(fiber.getBushColor()); insProduct.setInsProductResult(insProductResult); diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java index 8408e81..1b61451 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java @@ -159,7 +159,7 @@ insOrder.setState(0); String code = customMapper.selectById(insOrder.getCompanyId()).getCode2(); //insOrder.setEntrustCode(giveCode.giveCode("JCZX-" + code + "-", "ins_order", "", "yyMMdd")); - String giveCode = this.giveCode.giveCode("JCZX-" + code + "-", "ins_order", "", "yyMMdd"); + String giveCode = this.giveCode.giveCode("JCZX-" + code + "-", "ins_sample", "", "yyMMdd"); insOrderMapper.insert(insOrder); AtomicInteger count = new AtomicInteger(); list.forEach(a -> { diff --git a/inspect-server/src/main/resources/mapper/InsProductMapper.xml b/inspect-server/src/main/resources/mapper/InsProductMapper.xml index b877783..d1e6308 100644 --- a/inspect-server/src/main/resources/mapper/InsProductMapper.xml +++ b/inspect-server/src/main/resources/mapper/InsProductMapper.xml @@ -74,7 +74,7 @@ ip.inspection_item_subclass, ip.laboratory, ip.unit, - ipr.equip_value, + ipr.equip_name equipValue, io.entrust_code, ipr.update_time, ip.ins_result, @@ -86,6 +86,7 @@ left join user u on u.id = ipr.update_user where ip.ins_sample_id = #{sampleId} and ip.ins_result is not null + and template_id is not null </select> <select id="selectFiberInsProduct" resultType="com.yuanchu.mom.pojo.InsProduct"> select * from ins_product -- Gitblit v1.9.3