刘小明
2024-08-10 69b6617d589d2928ec94f9a47279654fe6f68025
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -240,6 +240,9 @@
            if (record.outLineTime != null) {
                isEnd = true;
            }
            if(StringUtils.isNotBlank(params.getContent())){
                record.nodeContent = params.getContent();
            }
        } else {
            PrProductionNode node = nodeDao.selectByPrimaryKey(workLast.nodeId);
            record.nodeContent = node.content;
@@ -284,7 +287,7 @@
     */
    private Integer getStatus(String status, boolean isEnd, String workType) {
        //组装   2024/07/17 目前组装workType 1 只有MarkOk     //测试    //品检
        if (WORK_TYPE_ASSEMBLY.equals(workType) || WORK_TYPE_TEST.equals(workType) || WORK_TYPE_INSPECTION.equals(workType) || WORK_TYPE_REPAIR.equals(workType)) {
        if (WORK_TYPE_ASSEMBLY.equals(workType) || WORK_TYPE_TEST.equals(workType) || WORK_TYPE_INSPECTION.equals(workType) || WORK_TYPE_REPAIR.equals(workType)|| WORK_TYPE_OTHER.equals(workType)) {
            return switch (status) {
                case QrCodeConstant.MarkOk -> isEnd ? DeviceStatus.COMPLETED.getCode() : DeviceStatus.ASSEMBLING.getCode();
                case QrCodeConstant.MarkQualified -> isEnd ? DeviceStatus.COMPLETED.getCode() : DeviceStatus.ASSEMBLING.getCode();
@@ -304,8 +307,8 @@
     * @return 结果
     */
    private Integer getResult(String status, String workType) {
        //组装
        if (WORK_TYPE_ASSEMBLY.equals(workType)) {
        //组装  临时任务-其他
        if (WORK_TYPE_ASSEMBLY.equals(workType) || WORK_TYPE_OTHER.equals(workType)) {
            return switch (status) {
                case QrCodeConstant.MarkOk -> DeviceResult.PASS.getCode();
                default -> throw new RuntimeException("状态错误");
@@ -349,16 +352,18 @@
        repairInfo.repairTime = new Date();
        repairInfo.repairBy = workLast.userId;
        repairInfo.repairReason = vo.errorMsg;
        repairInfo.fromNode = preDeviceRecord.currNode;
        if (preDeviceRecord != null) {
            repairInfo.fromNode = preDeviceRecord.currNode;
        }
        repairInfoDao.insertSelective(repairInfo);
        StaDeviceLast deviceLast = buildDeviceLast(vo, workLast, vo.deviceNo[0]);
        deviceLast.setRepairId(repairInfo.getId());
        int count = deviceLast.id == null ? deviceLastDao.insertSelective(deviceLast) :
                deviceLastDao.updateByPrimaryKey(deviceLast);
        saveDeviceProductionLog(deviceLast);
        boolean isEndNode = nodeDao.isEndNode(preDeviceRecord.currNode);
        if (isEndNode) {
        //只要经历过结束节点,就一直记录device life
        if (preDeviceRecord != null && preDeviceRecord.getOutLineTime() != null) {
            saveDeviceLife(deviceLast);
        }
        return count;
@@ -408,22 +413,31 @@
        if (workLast == null) {
            throw new RuntimeException("系统中没有该条登录信息");
        }
        //保存工作记录
        StaDeviceProductionLog log = new StaDeviceProductionLog();
        log.setId(null); // 设备生产日志ID设为null,表示新增
        log.setDeviceNo("");  //RepairId  planId  currNode deviceCycleContent  memo
        log.setWorkId(workId);
        log.setStationId(workLast.getStationId());
        log.setNodeContent(vo.getContent());
        log.setStatus(DeviceStatus.COMPLETED.getCode());//完成状态
        log.setResult(DeviceResult.PASS.getCode());//通过
        log.setErrorMsg(vo.getErrorMsg());
        log.setAssistants(workLast.getAssistants());
        log.setInTime(new Date());
        log.setOutTime(new Date());
        log.setUpdatedBy(workLast.getUserId());
        log.setNumber(vo.getNumber());
        int count = deviceProductionLogDao.insertSelective(log);
        int count = 0;
        //保存工作记录 //如果有设备码
        if(vo.deviceNo != null && StringUtils.isNotBlank(vo.deviceNo[0])){
            StaDeviceLast deviceLast = buildDeviceLast(vo, workLast, vo.deviceNo[0]);
            count = deviceLast.id == null ? deviceLastDao.insertSelective(deviceLast) :
                    deviceLastDao.updateByPrimaryKey(deviceLast);
            saveDeviceProductionLog(deviceLast);
        }else{
            StaDeviceProductionLog log = new StaDeviceProductionLog();
            log.setId(null); // 设备生产日志ID设为null,表示新增
            log.setDeviceNo("");  //RepairId  planId  currNode deviceCycleContent  memo
            log.setWorkId(workId);
            log.setStationId(workLast.getStationId());
            log.setNodeContent(vo.getContent());
            log.setStatus(DeviceStatus.COMPLETED.getCode());//完成状态
            log.setResult(DeviceResult.PASS.getCode());//通过
            log.setErrorMsg(vo.getErrorMsg());
            log.setAssistants(workLast.getAssistants());
            log.setInTime(new Date());
            log.setOutTime(new Date());
            log.setUpdatedBy(workLast.getUserId());
            log.setNumber(vo.getNumber());
            count = deviceProductionLogDao.insertSelective(log);
        }
        return count;
    }
@@ -473,6 +487,7 @@
    public List<PltProductQualityInspectionItems> getQualityItems(String proId) {
        Map<String, Object> params = new HashMap<>();
        params.put("proId", proId);//item  start  count
        params.put("disabled", "0");
        //查询符合条件的记录
        return qualityItemsDao.selectSome(params);
    }
@@ -480,6 +495,7 @@
    public List<PltProductTestInspectionItems> getTestItems(String proId) {
        Map<String, Object> params = new HashMap<>();
        params.put("proId", proId);
        params.put("disabled", "0");
        return testItemsDao.selectSome(params);
    }