diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java index 721ae6a8..bcda8719 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java @@ -30,4 +30,7 @@ public interface RemoteDeviceService { @PostMapping("/deviceTask/createEquipmentOperationTask") public R createEquipmentOperationTask(); + + @PostMapping("/deviceTask/equipmentBKTask") + public R equipmentBKTask(); } diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java index 5ea4b6b6..2e6cf0da 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java @@ -128,6 +128,10 @@ public class QcCheckTaskProduceDTO extends BaseEntity { private String checkTimeEnd; private String typeCode; private String checkType; + private String carName; + private String carCode; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date produceDate; @Excel(name = "抽样数量") private BigDecimal sampleQuality; @@ -144,6 +148,30 @@ public class QcCheckTaskProduceDTO extends BaseEntity { @Excel(name = "C类不合格数量") private BigDecimal cNoOkquality; + public Date getProduceDate() { + return produceDate; + } + + public void setProduceDate(Date produceDate) { + this.produceDate = produceDate; + } + + public String getCarName() { + return carName; + } + + public void setCarName(String carName) { + this.carName = carName; + } + + public String getCarCode() { + return carCode; + } + + public void setCarCode(String carCode) { + this.carCode = carCode; + } + public BigDecimal getaNoOkquality() { return aNoOkquality; } diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcUserMaterialDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcUserMaterialDTO.java new file mode 100644 index 00000000..526c9dce --- /dev/null +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcUserMaterialDTO.java @@ -0,0 +1,258 @@ +package com.op.system.api.domain.quality; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + +/** + * 人员物料绑定对象 qc_user_material + * + * @author Open Platform + * @date 2023-10-09 + */ +public class QcUserMaterialDTO extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** id */ + private String id; + + /** 员工编码 */ + @Excel(name = "员工编码") + private String userCode; + + /** 员工名称 */ + @Excel(name = "员工名称") + private String userName; + + /** 物料编码 */ + @Excel(name = "物料编码") + private String materialCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private String attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private String attr4; + + /** 工厂编码 */ + @Excel(name = "工厂编码") + private String factoryCode; + + /** 删除标识1删除0正常 */ + private String delFlag; + + /** 编号 */ + private String userId; + /** 手机号 */ + private String phonenumber; + private String email; + private String materialNames; + /** 状态 */ + private String status; + + private String materialId; + + private String[] userCodes; + private String label; + private String key; + + private List selectedValues; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + public void setUserCode(String userCode) { + this.userCode = userCode; + } + + public String getUserCode() { + return userCode; + } + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserName() { + return userName; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialCode() { + return materialCode; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialName() { + return materialName; + } + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr1() { + return attr1; + } + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr2() { + return attr2; + } + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr3() { + return attr3; + } + public void setAttr4(String attr4) { + this.attr4 = attr4; + } + + public String getAttr4() { + return attr4; + } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getPhonenumber() { + return phonenumber; + } + + public void setPhonenumber(String phonenumber) { + this.phonenumber = phonenumber; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getMaterialNames() { + return materialNames; + } + + public void setMaterialNames(String materialNames) { + this.materialNames = materialNames; + } + + public String getMaterialId() { + return materialId; + } + + public void setMaterialId(String materialId) { + this.materialId = materialId; + } + public String[] getUserCodes() { + return userCodes; + } + + public void setUserCodes(String[] userCodes) { + this.userCodes = userCodes; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public List getSelectedValues() { + return selectedValues; + } + + public void setSelectedValues(List selectedValues) { + this.selectedValues = selectedValues; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("userCode", getUserCode()) + .append("userName", getUserName()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("userId", getUserId()) + .append("phonenumber", getPhonenumber()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("factoryCode", getFactoryCode()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java index d46844da..9868e0fb 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java @@ -42,6 +42,11 @@ public class RemoteDeviceFallbackFactory implements FallbackFactory> selectEquipmentFaultNumForMonth(String groupCode); + + // 通过设备编码获取设备运行记录 + Map selectSumEquipmentOperation(String equipmentCode); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java index 73a8d947..7b142378 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java @@ -5,7 +5,8 @@ import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.device.domain.EquOperation; import com.op.device.domain.EquOperationRecord; -import io.lettuce.core.dynamic.annotation.Param; +import org.apache.ibatis.annotations.Param; + /** * 设备运行记录Mapper接口 @@ -73,4 +74,16 @@ public interface EquOperationMapper { // 校验当天运行记录数量 int checkInsertOperation(); + + // 获取当前YEAR-2的备份表的运行数据第一条 + EquOperation checkBackupOperation(); + + // 获取备份插入数据数量 + int getBackupOperationNum(); + + // 分批次备份 + int backupOperation(@Param("startIndex") int startIndex,@Param("batchSize") int batchSize); + + // 分批次删除 + int deleteOperation(@Param("delSize") int delSize); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IDeviceTaskService.java b/op-modules/op-device/src/main/java/com/op/device/service/IDeviceTaskService.java index f35a7ac3..28cbe358 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IDeviceTaskService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IDeviceTaskService.java @@ -19,4 +19,6 @@ public interface IDeviceTaskService { AjaxResult createMaintenancePlanTask(); AjaxResult createEquipmentOperationTask(); + + AjaxResult equipmentBKTask(); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java index dd9ba40a..0b9b43d8 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java @@ -32,6 +32,8 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { private DeviceInterfaceMapper deviceInterfaceMapper; @Autowired private EquOperationRecordMapper equOperationRecordMapper; + @Autowired + private EquOperationMapper equOperationMapper; /** * 获取待维修的维修工单 @@ -64,64 +66,6 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { public AjaxResult getEquipmentInfo() { // 获取所有设备信息 List equipmentVOList = deviceInterfaceMapper.selectEquipmentList(); - for (IEquipmentVO equipmentVO : equipmentVOList) { - // 设备状态 - if (equipmentVO.getEquipmentStatus().equals("1")) { - equipmentVO.setEquipmentStatus("正常"); - } else { - equipmentVO.setEquipmentStatus("停用"); - } - - - /* 停机故障率逻辑 */ - double totalTime = 0;// 运行总时间 - double downTime = 0;// 停机时间 - // 通过设备编码获取运行记录中的运行记录List - List operationRecordList = equOperationRecordMapper.selectEquOperationRecordByEquipmentCode(equipmentVO.getEquipmentCode()); - if (operationRecordList.size() != 0) { - for (EquOperationRecord operationRecord : operationRecordList) { - // 运行时间差值 - double diffTime = operationRecord.getEndTime().getTime() - operationRecord.getStartTime().getTime(); - // 开机运行时间运行总时间累加 - if (operationRecord.getType().equals("on")) { - totalTime += diffTime; - } - // 维修停机时间累加(故障) - if (operationRecord.getMaintenanceType().equals("repair")) { - downTime += diffTime; - } - } - - // 设置停机故障率 - if (downTime == 0L) { - // 如果未查到该设备停机故障时间 - equipmentVO.setFailureRate(0D); - } else { - // 计算故障停机率(设备停机时间总和/一定时间内运行总时间(年)) - double failureRate = downTime / totalTime; - System.out.println(failureRate); - equipmentVO.setFailureRate(failureRate); - } - - } - - /* 设备有效利用率逻辑(每月) */ - // 查询该设备下报工单信息(年月日可在该sql中修改) - MesReportWork reportWork = deviceInterfaceMapper.selectReportWorkByEquipmentCode(equipmentVO.getEquipmentCode()); - if (reportWork != null) { - BigDecimal theoryQuantity = reportWork.getQuantity();// 理论产量 - BigDecimal actualQuantity = reportWork.getQuantityFeedback();// 实际产量 - - // 计算该设备有效利用率(实际产量/理论产量) - BigDecimal utilizationRatio = actualQuantity.divide(theoryQuantity, 2, BigDecimal.ROUND_HALF_UP); - equipmentVO.setUtilizationRatio(utilizationRatio.doubleValue()); - - } else { - // 如果未查到该信息,则默认设置为0 - equipmentVO.setUtilizationRatio(0D); - } - - } return success(equipmentVOList); } @@ -204,6 +148,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { @DS("#header.poolName") public AjaxResult getEquipmentIntactRate(EquOperation equOperation) { //查询所有设备(设备停用的除外) + // CAST(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100.00/COUNT(*) as decimal(18,2)) AS intactRate EquOperation equipmentIntactRate = deviceInterfaceMapper.getEquipmentIntactRate(equOperation); return success(equipmentIntactRate); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index 2ba20b72..b3125214 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -366,7 +366,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { equ.setStatus("1"); equOrderMapper.updateEquipmentStatus(equ); // 更新设备运行记录 - updateOperationRecord(equOrder.getEquipmentCode(),"on",""); +// updateOperationRecord(equOrder.getEquipmentCode(),"on",""); //上传附件 if (StringUtils.isNotEmpty(equOrder.getPicturePath())) { String[] ids = equOrder.getPicturePath().split(","); @@ -501,20 +501,20 @@ public class DevicePDAServiceImpl implements IDevicePDAService { Equipment equ = new Equipment(); equ.setEquipmentCode(order.getEquipmentCode()); // 运行记录类型 - String operationType; - // 停机保养 - if (pdadto.getShutDown().equals("1")){ - operationType = "off"; - }else { - operationType = "on"; - } +// String operationType; +// // 停机保养 +// if (pdadto.getShutDown().equals("1")){ +// operationType = "off"; +// }else { +// operationType = "on"; +// } // 更改设备状态为保养中 equ.setStatus("3"); equOrderMapper.updateEquipmentStatus(equ); // 更新设备运行记录 - updateOperationRecord(order.getEquipmentCode(),operationType,"upkeep"); +// updateOperationRecord(order.getEquipmentCode(),operationType,"upkeep"); // 设置开始时间 order.setOrderStart(DateUtils.getNowDate()); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index 6a0686a0..dc3652ed 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -21,6 +21,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -210,6 +211,39 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { return success(); } + /** + * 设备运行记录数据库备份(每年) + * @return + */ + @Override + public AjaxResult equipmentBKTask() { + // 加载sf-cloud库的sys_datasource + SysUser sysUser = new SysUser(); + sysUser.setUserId(1L); + R>> dateSources0 = remoteUserService.getPoolNameList(sysUser); + List> dateSources = dateSources0.getData(); + ExecutorService executorService = new ThreadPoolExecutor( + dateSources.size(), + dateSources.size(), + 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue()); + + try { + dateSources.forEach(dateSource -> { + logger.info("++++++++++++" + dateSource.get("poolName") + "++++设备运行记录数据库备份开始++++++++++"); + Runnable run = () -> backupEquipmentOperation(dateSource.get("poolName")); + executorService.execute(run); + }); + } catch (Exception e) { + logger.error("service == dataClearTask == exception", e); + return error("service == dataClearTask == exception"); + } finally { + executorService.shutdown(); + } + + return success(); + } + public void createSpotCheckPlanFunc(String poolName){ DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key /**equ_plan equ_plan_equ**/ @@ -431,7 +465,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { operation.setCreateTime(DateUtils.getNowDate()); } - int batchSize = 200;// 批次数量 + int batchSize = 100;// 批次数量 // 分批次处理 int batchCount = (operationList.size() + batchSize - 1)/batchSize;// 计算批次数量 @@ -442,7 +476,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { List subList = operationList.subList(startIndex,endIndex); int num = equOperationMapper.insertEquOperationByBatch(subList); - System.out.println("数据源:"+poolName+"--->"+"第"+i+"轮"+"开始索引:"+startIndex+"________结束索引:"+endIndex+"________成功插入数量:"+num); + System.out.println("数据源:"+poolName+"--->"+"第"+(i+1)+"轮"+"开始索引:"+startIndex+"________结束索引:"+endIndex+"________成功插入数量:"+num); } }else { System.out.println("数据源:"+poolName+"当天生成过运行记录"); @@ -450,6 +484,40 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { } + private void backupEquipmentOperation(String poolName) { + DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key + // 校验当前YEAR-2是否备份过数据 + EquOperation check = equOperationMapper.checkBackupOperation(); + if (check == null) { + // 获取插入数量 + int insertNum = equOperationMapper.getBackupOperationNum(); + int insertSize = 100;// 新增批次数量 + + // 分批次备份 + int batchCount = (insertNum + insertSize - 1)/insertSize;// 计算批次数量 + for (int i = 0;i < batchCount; i++) { + int startIndex = i * insertSize;// 索引开始值 + int endIndex = Math.min((i + 1)*insertSize,insertNum);// 索引结束值 + + // 备份至数据库 + int num = equOperationMapper.backupOperation(startIndex,insertSize); + + System.out.println("数据源:"+poolName+"--->"+"第"+(i+1)+"轮备份"+"开始索引:"+startIndex+"________结束索引:"+endIndex+"________成功插入数量:"+num); + } + + // 删除源数据库数据 + int delSize = 100;// 删除批次数量 + for (int i = 0; i < insertNum/delSize+1; i++) { + // 在源数据库中删除 + int num = equOperationMapper.deleteOperation(delSize); + System.out.println("数据源:"+poolName+"--->"+"第"+(i+1)+"轮删除"+"------>成功删除数量:"+num); + } + + }else { + System.out.println("数据源:"+poolName+"---->"+"年份:"+( LocalDate.now().getYear()-2) +"--->已备份"); + } + } + public static void main(String[] args) { int batchSize = 200;// 批次数量 diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml index 90f2288d..48089a27 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml @@ -21,13 +21,22 @@ SELECT - SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END) AS operationEquipment, - SUM(CASE WHEN equipment_status = '0' or equipment_status = '2' THEN 1 Else 0 END) AS faultEquipment, - COUNT(*) AS totalEquipment, - CAST(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100.00/COUNT(*) as decimal(18,2)) AS intactRate + SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END) AS operationEquipment, + SUM(CASE WHEN equipment_status = '0' or equipment_status = '2' THEN 1 Else 0 END) AS faultEquipment, + COUNT(*) AS totalEquipment, + ( + SELECT COUNT(id) + FROM equ_operation + WHERE '4%' > failure_rate AND CONVERT(date, create_time) = CONVERT(date, GETDATE()) + )*100 / + ( + SELECT COUNT(id) + FROM equ_operation + WHERE CONVERT(date, create_time) = CONVERT(date, GETDATE()) + ) AS intactRate FROM base_equipment WHERE del_flag = '0' AND status = '1' @@ -105,4 +123,12 @@ ORDER BY MONTH (eo.create_time) + + \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml index 04a90d78..1eda9f70 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml @@ -89,6 +89,7 @@ and CONVERT(date,create_time) >= #{createTimeStart} and #{createTimeEnd} >= CONVERT(date,create_time) + order by CAST(create_time AS DATE) desc,group_line + + + + insert into equ_operation @@ -188,6 +197,15 @@ + + insert into equ_operation_backup + select s.* + from equ_operation s + where YEAR (s.create_time) = YEAR (GETDATE())-2 + ORDER BY id + OFFSET #{startIndex} ROWS FETCH NEXT #{batchSize} ROWS ONLY + + update equ_operation @@ -230,4 +248,12 @@ #{id} + + + delete + from equ_operation + where id in (select s.id from equ_operation s where YEAR (s.create_time) = YEAR (GETDATE())-2 + ORDER BY id + OFFSET 0 ROWS FETCH NEXT #{delSize} ROWS ONLY) + \ No newline at end of file diff --git a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java index 443cd9a0..e2815c4d 100644 --- a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java +++ b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java @@ -144,4 +144,10 @@ public class RyTask { logger.info("++设备运行记录生成任务开始++createEquipmentOperationTask+++++"); remoteDeviceService.createEquipmentOperationTask(); } + + /** 每年1月1日1:50执行 **/ + public void equipmentBKTask(){ + logger.info("++设备运行记录+数据库备份的数据+开始++equipmentBkTask+++++"); + remoteDeviceService.equipmentBKTask(); + } } diff --git a/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java b/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java index f5613f8d..125378e7 100644 --- a/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java +++ b/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java @@ -83,7 +83,7 @@ public class OpenController extends BaseController { } /**创建生产过程(烘房 首检)检验*/ - @PostMapping(value = "createCheckProduceTask") + @PostMapping(value = "/createCheckProduceTask") public AjaxResult createCheckProduceTask(@RequestBody QcCheckTaskProduceDTO qcCheckTaskProduce) { if(StringUtils.isBlank(qcCheckTaskProduce.getIncomeBatchNo())){ return error("[IncomeBatchNo]不能为空"); diff --git a/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java b/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java index dd58e6f2..07ca7e42 100644 --- a/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java +++ b/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java @@ -7,10 +7,7 @@ import com.op.system.api.domain.mes.MesReportWorkConsumeDTO; import com.op.system.api.domain.mes.MesReportWorkDTO; import com.op.system.api.domain.mes.ProOrderWorkorderDTO; import com.op.system.api.domain.mes.ProRfidProcessDetail; -import com.op.system.api.domain.quality.QcCheckTaskDetailDTO; -import com.op.system.api.domain.quality.QcCheckTaskProduceDTO; -import com.op.system.api.domain.quality.QcCheckTypeProjectDTO; -import com.op.system.api.domain.quality.QcMaterialGroupDetailDTO; +import com.op.system.api.domain.quality.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -78,5 +75,7 @@ public interface OpenMapper { void insertQcCheckTaskProduce(QcCheckTaskProduceDTO qcCheckTaskProduce); public int addBatch(@Param("list") List items); + + QcUserMaterialDTO getUserByMaterial(String materialCode); } diff --git a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java index 9a77787c..d1ecd5f1 100644 --- a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java +++ b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java @@ -23,10 +23,7 @@ import com.op.system.api.domain.mes.MesReportWorkConsumeDTO; import com.op.system.api.domain.mes.MesReportWorkDTO; import com.op.system.api.domain.mes.ProOrderWorkorderDTO; import com.op.system.api.domain.mes.ProRfidProcessDetail; -import com.op.system.api.domain.quality.QcCheckTaskDetailDTO; -import com.op.system.api.domain.quality.QcCheckTaskProduceDTO; -import com.op.system.api.domain.quality.QcCheckTypeProjectDTO; -import com.op.system.api.domain.quality.QcMaterialGroupDetailDTO; +import com.op.system.api.domain.quality.*; import com.op.system.api.domain.sap.SapCloseOrderQuery; import com.op.system.api.domain.sap.SapRFW; import org.apache.commons.lang.StringUtils; @@ -305,6 +302,17 @@ public class OpenServiceImpl implements OpenService { QcCheckTypeProjectDTO qctp= new QcCheckTypeProjectDTO(); qctp.setTypeId(qcCheckTaskProduce.getCheckType());//生产过程检验 qctp.setMaterialCode(qcCheckTaskProduce.getMaterialCode());//特性 + + /**qc_user_material取默认检查人**/ + QcUserMaterialDTO qcUserMaterialDTO = openMapper.getUserByMaterial(qcCheckTaskProduce.getMaterialCode()); + if(qcUserMaterialDTO == null){ + qcCheckTaskProduce.setCheckManCode("mobile"); + qcCheckTaskProduce.setCheckManName("手持测试用户"); + }else{ + qcCheckTaskProduce.setCheckManCode(qcUserMaterialDTO.getUserCode()); + qcCheckTaskProduce.setCheckManName(qcUserMaterialDTO.getUserName()); + } + /**qc_check_type_project**/ List items = openMapper.getTPByTypeMaterial(qctp); if(CollectionUtils.isEmpty(items)){ @@ -328,6 +336,9 @@ public class OpenServiceImpl implements OpenService { qcCheckTaskProduce.setFactoryCode(factoryCode); qcCheckTaskProduce.setCreateTime(nowDate); qcCheckTaskProduce.setTypeCode("produce");//大检验节点 + qcCheckTaskProduce.setIncomeTime(qcCheckTaskProduce.getProduceDate()); + qcCheckTaskProduce.setSupplierCode(qcCheckTaskProduce.getCarCode()); + qcCheckTaskProduce.setSupplierName(qcCheckTaskProduce.getCarName()); openMapper.insertQcCheckTaskProduce(qcCheckTaskProduce); /**qc_check_task_detail**/ for(QcCheckTaskDetailDTO item:items){ diff --git a/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml b/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml index a49649be..b12931ec 100644 --- a/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml +++ b/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml @@ -195,6 +195,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and qctp.type_id = #{typeId} order by qctp.sort + insert into equ_repair_order diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java index 01c5dba5..0a7b37f1 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java @@ -33,7 +33,7 @@ public class ProOrderWorkorder extends TreeEntity { private String orderId; /** 订单编码 */ - @Excel(name = "子订单编码") + @Excel(name = "子订单旧编码") private String orderCode; /** 产品ID */ @@ -211,7 +211,7 @@ public class ProOrderWorkorder extends TreeEntity { } private String prepareId; - + @Excel(name = "子订单新编号") private String workorderCodeSap; /** 批次号 */ @@ -219,9 +219,39 @@ public class ProOrderWorkorder extends TreeEntity { private List batchNumList; private List batchInfo; + private String pproductCode; + @Excel(name = "母产品名称") + private String pproductName; + @Excel(name = "母订单新编号") + private String pworkorderCodeSap; + /** $column.columnComment */ private String factoryCode; + public String getPproductCode() { + return pproductCode; + } + + public void setPproductCode(String pproductCode) { + this.pproductCode = pproductCode; + } + + public String getPproductName() { + return pproductName; + } + + public void setPproductName(String pproductName) { + this.pproductName = pproductName; + } + + public String getPworkorderCodeSap() { + return pworkorderCodeSap; + } + + public void setPworkorderCodeSap(String pworkorderCodeSap) { + this.pworkorderCodeSap = pworkorderCodeSap; + } + public List getBatchInfo() { return batchInfo; } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 16a3d725..421ad7ff 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -166,5 +166,6 @@ public interface ProOrderWorkorderMapper { int updateWhiteWorkOrder(ProOrderWorkorder whiteOrder); ProOrderWorkorder getPWorkOrder(ProOrderWorkorder whiteOrder); + } diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 88fe27ae..853fc9ab 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -38,6 +38,11 @@ + + + + + @@ -49,37 +54,33 @@ diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java index b7629199..0619f7b0 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java @@ -3,6 +3,7 @@ package com.op.quality.controller; import com.op.common.core.utils.StringUtils; import com.op.quality.domain.QcCheckType; import com.op.quality.domain.QcInterface; +import com.op.quality.domain.QcLineChartDto; import com.op.quality.service.IQcInterfaceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -126,4 +127,10 @@ public class QcInterfaceController { public List getMonthOfYearContrast(@RequestBody QcInterface qcInterface) { return qcInterfaceService.getMonthOfYearContrast(qcInterface); } + + @GetMapping("/getLineQcData") + public QcLineChartDto getLineQcData(QcInterface qcInterface) { + return qcInterfaceService.getLineQcData(qcInterface); + } + } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java index 79249d12..cb3bbbe3 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java @@ -45,6 +45,15 @@ public class QcCheckType extends BaseEntity { private String delFlag; private int taskNum; + private String checkManCode; + + public String getCheckManCode() { + return checkManCode; + } + + public void setCheckManCode(String checkManCode) { + this.checkManCode = checkManCode; + } public int getTaskNum() { return taskNum; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java index f10f74a7..b68ed1a5 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java @@ -47,6 +47,33 @@ public class QcInterface extends BaseEntity { private List data; private String reasons; private String typeCode; + private String productDateStart; + private String ProductDateEnd; + private String nameDate; + + public String getNameDate() { + return nameDate; + } + + public void setNameDate(String nameDate) { + this.nameDate = nameDate; + } + + public String getProductDateStart() { + return productDateStart; + } + + public void setProductDateStart(String productDateStart) { + this.productDateStart = productDateStart; + } + + public String getProductDateEnd() { + return ProductDateEnd; + } + + public void setProductDateEnd(String productDateEnd) { + ProductDateEnd = productDateEnd; + } public String getTypeCode() { return typeCode; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartDto.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartDto.java new file mode 100644 index 00000000..554b4226 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartDto.java @@ -0,0 +1,39 @@ +package com.op.quality.domain; + +import java.util.List; + +/** + * echart图返回数据 + * + * @author Open Platform + * @date 2023-07-03 + */ +public class QcLineChartDto { + private List seriesNames; + private List xAxisDatas; + private List seriesDatas; + + public List getSeriesNames() { + return seriesNames; + } + + public void setSeriesNames(List seriesNames) { + this.seriesNames = seriesNames; + } + + public List getxAxisDatas() { + return xAxisDatas; + } + + public void setxAxisDatas(List xAxisDatas) { + this.xAxisDatas = xAxisDatas; + } + + public List getSeriesDatas() { + return seriesDatas; + } + + public void setSeriesDatas(List seriesDatas) { + this.seriesDatas = seriesDatas; + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartSeriesDto.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartSeriesDto.java new file mode 100644 index 00000000..2dce8f24 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartSeriesDto.java @@ -0,0 +1,48 @@ +package com.op.quality.domain; + +import java.util.List; + +/** + * echart图返回数据 + * + * @author Open Platform + * @date 2023-07-03 + */ +public class QcLineChartSeriesDto { + private String name; + private String type; + private String stack; + private List data; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getStack() { + return stack; + } + + public void setStack(String stack) { + this.stack = stack; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java index f39cdaeb..7d8aac35 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java @@ -79,5 +79,5 @@ public interface QcCheckUnqualifiedMapper { List getWorkOrder(QcCheckTaskIncome qcCheckTaskIncome); - int updateWorkOrderStatus(QcCheckTaskIncome qcCheckTaskIncome); + int updateWorkOrderBatchStatus(QcCheckTaskIncome qcCheckTaskIncome); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java index d00c0ad8..8c7d9d92 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java @@ -41,4 +41,8 @@ public interface QcInterfaceMapper { Map getMothNoOkNum(QcInterface qcInterface); List getReasons(QcInterface dto); + + List getLineChartsNames(QcInterface qcInterface); + @MapKey("nameDate") + Map getLineChartsDatas(QcInterface qcInterface); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java index 6676f007..d50e1c97 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java @@ -3,6 +3,7 @@ package com.op.quality.service; import com.op.quality.domain.QcCheckType; import com.op.quality.domain.QcInterface; +import com.op.quality.domain.QcLineChartDto; import java.util.List; import java.util.Map; @@ -35,4 +36,6 @@ public interface IQcInterfaceService { QcInterface getLineDayNoOk(QcInterface qcInterface); List getMonthOfYearContrast(QcInterface qcInterface); + + QcLineChartDto getLineQcData(QcInterface qcInterface); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index f56e54c4..767fffdf 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -285,9 +285,9 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { n = qcCheckTaskProduceMapper.updateQcCheckTaskProduce(qcCheckTaskProduce); - /**pro_order_workorder-->status->w5**/ - qcCheckTaskIncome.setStatus("w5"); - qcCheckUnqualifiedMapper.updateWorkOrderStatus(qcCheckTaskIncome); + /**pro_order_workorder_batch-->qc_status->2**/ + qcCheckTaskIncome.setStatus("2"); + qcCheckUnqualifiedMapper.updateWorkOrderBatchStatus(qcCheckTaskIncome); }else if("product".equals(qcCheckTaskIncome.getTypeCode())){ QcCheckTaskWarehousing warehousing = new QcCheckTaskWarehousing(); warehousing.setCheckStatus("2"); @@ -386,13 +386,16 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckTask.setCheckResult(result);//检验结果Y合格 N不合格 BigDecimal noOkQquality = new BigDecimal("0"); if(qcCheckTaskIncome.getaNoOkquality()!=null){ - noOkQquality.add(qcCheckTaskIncome.getaNoOkquality()); + noOkQquality = noOkQquality.add(qcCheckTaskIncome.getaNoOkquality()); + qcCheckTask.setaNoOkquality(qcCheckTaskIncome.getaNoOkquality()); } if(qcCheckTaskIncome.getbNoOkquality()!=null){ - noOkQquality.add(qcCheckTaskIncome.getbNoOkquality()); + noOkQquality = noOkQquality.add(qcCheckTaskIncome.getbNoOkquality()); + qcCheckTask.setbNoOkquality(qcCheckTaskIncome.getbNoOkquality()); } if(qcCheckTaskIncome.getcNoOkquality()!=null){ - noOkQquality.add(qcCheckTaskIncome.getcNoOkquality()); + noOkQquality = noOkQquality.add(qcCheckTaskIncome.getcNoOkquality()); + qcCheckTask.setcNoOkquality(qcCheckTaskIncome.getcNoOkquality()); } if(qcCheckTask.getNoOkQuality()==null){ qcCheckTask.setNoOkQuality(noOkQquality); @@ -413,9 +416,9 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckTaskIncome.setCheckResult(result.equals("Y")?"1":"2"); qcCheckUnqualifiedMapper.updateQualityStatus(qcCheckTaskIncome); }else if("produce".equals(qcCheckTaskIncome.getTypeCode())){ - /**pro_order_workorder-->status->w5**/ - qcCheckTaskIncome.setStatus("w5"); - qcCheckUnqualifiedMapper.updateWorkOrderStatus(qcCheckTaskIncome); + /**pro_order_workorder_batch-->status->w5**/ + qcCheckTaskIncome.setStatus("2"); + qcCheckUnqualifiedMapper.updateWorkOrderBatchStatus(qcCheckTaskIncome); }else if("product".equals(qcCheckTaskIncome.getTypeCode())){ } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java index 88ee8cb9..d7a9bc58 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java @@ -2,6 +2,7 @@ package com.op.quality.service.impl; import java.util.List; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.utils.DateUtils; @@ -123,7 +124,8 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService { @Override public List getTopTaskInfo(QcCheckType qcCheckType) { DynamicDataSourceContextHolder.push(qcCheckType.getFactoryCode());// 这是数据源的key - return qcCheckTypeMapper.getTopTaskInfo(qcCheckType); + List dtos = qcCheckTypeMapper.getTopTaskInfo(qcCheckType);//检验任务 + return dtos; } } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java index 554e0805..5971c5c5 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java @@ -1,10 +1,9 @@ package com.op.quality.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.utils.DateUtils; -import com.op.quality.domain.QcCheckTaskDetail; -import com.op.quality.domain.QcInterface; -import com.op.quality.domain.QcProCheck; +import com.op.quality.domain.*; import com.op.quality.mapper.QcInterfaceMapper; import com.op.quality.service.IQcInterfaceService; import org.apache.commons.lang.StringUtils; @@ -319,6 +318,53 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService { return dtos; } + @Override + @DS("#header.poolName") + public QcLineChartDto getLineQcData(QcInterface qcInterface) { + QcLineChartDto lineChartDto = new QcLineChartDto(); + + Calendar calendar = Calendar.getInstance(); + Date now = calendar.getTime(); + calendar.set(Calendar.DAY_OF_MONTH, 1); + Date firstDayOfMonth = calendar.getTime(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String startTime = dateFormat.format(firstDayOfMonth); + String endTime = dateFormat.format(now); + qcInterface.setProductDateStart(startTime); + qcInterface.setProductDateEnd(endTime); + //图例名称 + List seriesNames = qcInterfaceMapper.getLineChartsNames(qcInterface); + lineChartDto.setSeriesNames(seriesNames); + //日期名称数组 + List xAxisDatas = getDays(startTime,endTime); + lineChartDto.setxAxisDatas(xAxisDatas); + Map productdatas = qcInterfaceMapper.getLineChartsDatas(qcInterface); + //值 + List seriesDatas = new ArrayList<>(); + QcLineChartSeriesDto lineChartSeriesDto = null; + for(String productName:seriesNames){ + lineChartSeriesDto = new QcLineChartSeriesDto(); + lineChartSeriesDto.setName(productName); + lineChartSeriesDto.setType("line"); + List datas = new ArrayList<>(); + for(String dayStr:xAxisDatas) { + QcInterface data0 = productdatas.get(productName + dayStr); + if (data0 != null) { + BigDecimal rate = new BigDecimal(data0.getNoOkQuality()) + .multiply(new BigDecimal(100)) + .divide(new BigDecimal(data0.getQuality()),2,BigDecimal.ROUND_HALF_UP); + datas.add(rate.toString()); + } else { + datas.add("0"); + } + } + lineChartSeriesDto.setData(datas); + seriesDatas.add(lineChartSeriesDto); + } + lineChartDto.setSeriesDatas(seriesDatas); + return lineChartDto; + } + /**两个日期之间的所有日期**/ public static List getDays(String startTime,String endTime) { diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java index 3c01ce35..e937c8c4 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java @@ -1,5 +1,7 @@ package com.op.quality.service.impl; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -73,6 +75,10 @@ public class QcUserMaterialServiceImpl implements IQcUserMaterialService { @Override @DS("#header.poolName") public int insertQcUserMaterial(QcUserMaterial qcUserMaterial) { + List userCodes = new ArrayList<>(); + userCodes.add(qcUserMaterial.getUserCode()); + qcUserMaterial.setUserCodes(userCodes.toArray(new String[userCodes.size()])); + Date now = DateUtils.getNowDate(); if (StringUtils.isNotEmpty(qcUserMaterial.getUserCodes())) { //删除之前的关联关系 diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml index e234127c..298e7dfc 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml @@ -47,21 +47,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" count(0) taskNum, '检验任务' attr1 from qc_check_task qct - left join qc_check_type qc on qct.check_type = qc.order_code - where qct.check_status = '0' + left join qc_check_type qc on qct.check_type = qc.order_code + where qct.check_status = '0' and qct.check_man_code = #{checkManCode} group by qct.check_type,qc.check_name - union ALL - select qcu.type, - qc.check_name, - count(0) taskNum, - '不合格处理' + union all + select '','', + count(0) taskNum, + '不合格处理' attr1 from qc_check_unqualified qcu - left join qc_check_type qc on qcu.type = qc.order_code - where qcu.status != '2' - group by qcu.type,qc.check_name + left join qc_check_task qct on qcu.task_id = qct.record_id + where qcu.status != '2' and qct.check_man_code = #{checkManCode} - - insert into qc_check_type diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml index 12c5f80f..6696008b 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml @@ -186,8 +186,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update wms_raw_order_in set quality_status = #{checkResult} where order_no = #{orderNo} - - update pro_order_workorder set status = #{status} where workorder_code_sap = #{orderNo} + + update pro_order_workorder_batch set qc_status = #{status} where batch_code = #{incomeBatchNo} diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml index 6f0b51af..edad5b1b 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml @@ -241,4 +241,23 @@ where belong_to = #{recordId} and status = 'N' and del_flag='0' + + diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml index 7693fcec..c08df09b 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml @@ -66,6 +66,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + select id,rfid,factory_id,factory_code,order_id,machine_id,bad_meg,product_id,isqua,file_id,attr1,attr2, @@ -248,7 +253,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" qct.material_code, qct.material_name, qct.quality, qct.unit, qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status, qct.check_man_code,qct.check_man_name, qct.check_time, qct.check_result, - qct.status,qct.create_by,qct.create_time,qct.check_type + qct.status,qct.create_by,qct.create_time,qct.check_type, + qct.noOk_quality,qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality,qct.sample_quality from qc_check_task qct and qct.del_flag = '0' diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml index df89fef3..6d55176d 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml @@ -81,10 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bp.product_code not in ( select um.material_code from qc_user_material um - where um.user_code in - - #{userCode} - + where um.user_code =#{userCode} ) and bp.product_desc_zh like concat('%', #{materialName}, '%') @@ -94,10 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" concat(bp.product_desc_zh,'(',bp.product_code,')') label from qc_user_material um left join base_product bp on um.material_code = bp.product_code - where um.user_code in - - #{userCode} - + where um.user_code = #{userCode} and bp.product_desc_zh like concat('%', #{materialName}, '%') diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java index 11eccfe6..4d4d23de 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java @@ -3,7 +3,6 @@ package com.op.sap.service; import com.op.common.core.domain.R; import com.op.sap.domain.vo.SapOrderReceiptQuery; -import com.op.system.api.domain.sap.SapPurchaseOrderQuery;//SapPurchaseOrderQuery import com.op.system.api.domain.sap.*; import com.op.system.api.model.SapProOrder; diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java index 99448c0c..7e7a9d74 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java @@ -8,7 +8,6 @@ import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.sap.domain.vo.SapOrderReceiptQuery; - import com.op.sap.service.SapOrderService; import com.op.system.api.domain.sap.*;