Fancy
2024-07-30 bf2368aba60129e66bcac80e60d22dc86ae5c1a3
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepCtrl.java
@@ -1,27 +1,33 @@
package com.dy.pmsStation.assemblyStep;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pmsGlobal.pojoPlt.PltProductFile;
import com.dy.pmsGlobal.pojoPlt.PltProductParams;
import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems;
import com.dy.pmsGlobal.pojoPlt.PltProductTestInspectionItems;
import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan;
import com.dy.pmsGlobal.pojoPr.PrProductionNode;
import com.dy.pmsGlobal.pojoSta.StaDeviceLife;
import com.dy.pmsGlobal.pojoSta.StaDeviceProductionLog;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 *记录组装各步骤
 * 记录组装各步骤
 */
@Slf4j
@RestController
@RequestMapping(path = "assemblyStep")
public class AssemblyStepCtrl {
    private AssemblyStepSv sv;
    @Autowired
    public void setSv(AssemblyStepSv sv) {
        this.sv = sv;
@@ -29,8 +35,55 @@
    @PostMapping(path = "save")
    public BaseResponse save(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.save()");
        log.info("AssemblyStepCtrl.save():" + vo);
        int count = sv.save(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
    /**
     * 测试
     * @param vo
     * @return
     */
    @PostMapping(path = "testing")
    public BaseResponse testing(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.testing():" + vo);
        int count = sv.testing(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
    /**
     * 品检
     * @param vo
     * @return
     */
    @PostMapping(path = "inspectQuality")
    public BaseResponse<Boolean> inspectQuality(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.inspectQuality():" + vo);
        int count = sv.inspectQuality(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
    /**
     * 无任务工作中的其他页面
     * @param vo
     * @return
     */
    @PostMapping(path = "otherWork")
    public BaseResponse<Boolean> otherWork(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.otherWork():" + vo);
        int count = sv.otherWork(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
@@ -40,7 +93,7 @@
    @PostMapping(path = "repair")
    public BaseResponse repair(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.repair()");
        log.info("AssemblyStepCtrl.repair():" + vo);
        int count = sv.repair(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
@@ -48,62 +101,89 @@
            return BaseResponseUtils.buildSuccess(true);
        }
    }
    /**
     * 根据节点的查出节点作业指导书
     *
     * @param
     * @return
     */
    @GetMapping(path="getSopByNodeId")
    public BaseResponse<PrProductionNode> getSopByNodeId(String nodeId){
    @GetMapping(path = "getSopByNodeId")
    public BaseResponse<PrProductionNode> getSopByNodeId(String nodeId) {
        log.info("AssemblyStepCtrl.getSopByNodeId():" + nodeId);
        PrProductionNode result = sv.getSopByNodeId(nodeId);
        return BaseResponseUtils.buildSuccess(result);
    }
    /**
     * 根据产品查出 主要技术参数
     * @param
     * @return
     */
    @GetMapping(path="getParamsByProId")
    public BaseResponse<List<PltProductParams>> getParamsByProId(String proId){
        List<PltProductParams> result = sv.getParamsByProId(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    /**
     * 根据产品查出产品文件 主要技术参数
     * @param
     * @return
     */
    @GetMapping(path="getFileByProId")
    public BaseResponse<List<PltProductFile>> getFileByProId(String proId){
        List<PltProductFile> result = sv.getFileByProId(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "getQualityItems")
    public BaseResponse<List<PltProductQualityInspectionItems>> getQualityItems(String proId) {
        log.info("AssemblyStepCtrl.getQualityItems()");
        List<PltProductQualityInspectionItems> result = sv.getQualityItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "getTestItems")
    public BaseResponse<List<PltProductTestInspectionItems>> getTestItems(String proId) {
        log.info("AssemblyStepCtrl.getTestItems()");
        List<PltProductTestInspectionItems> result = sv.getTestItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    /**
     * 测试或品检都调用这个接口
     * @param vo
     * 根据产品查出 主要技术参数
     *
     * @param
     * @return
     */
    @PostMapping(path = "testing")
    public BaseResponse testing(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.testing()");
        int count = sv.testing(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
    @GetMapping(path = "getParamsByProId")
    public BaseResponse<List<PltProductParams>> getParamsByProId(String proId) {
        log.info("AssemblyStepCtrl.getParamsByProId():" + proId);
        List<PltProductParams> result = sv.getParamsByProId(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    /**
     * 根据产品查出产品文件 主要技术参数
     *
     * @param
     * @return
     */
    @GetMapping(path = "getFileByProId")
    public BaseResponse<List<PltProductFile>> getFileByProId(String proId) {
        log.info("AssemblyStepCtrl.getFileByProId():" + proId);
        List<PltProductFile> result = sv.getFileByProId(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "getQualityItems")
    public BaseResponse<List<PltProductQualityInspectionItems>> getQualityItems(String proId) {
        log.info("AssemblyStepCtrl.getQualityItems():" + proId);
        List<PltProductQualityInspectionItems> result = sv.getQualityItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "getTestItems")
    public BaseResponse<List<PltProductTestInspectionItems>> getTestItems(String proId) {
        log.info("AssemblyStepCtrl.getTestItems():" + proId);
        List<PltProductTestInspectionItems> result = sv.getTestItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "queryByDeviceNo")
    public BaseResponse<Map<String, String>> queryByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryByDeviceNo():" + deviceNo);
        Map<String, String> result = sv.queryByDeviceNo(deviceNo, null);
        if (StringUtils.isBlank(result.get("proName"))) {
            return BaseResponseUtils.buildFail("该编码(" + deviceNo + ")不是主要物料(系统中管控的其他设备)");
        } else {
            return BaseResponseUtils.buildSuccess(true);
            return BaseResponseUtils.buildSuccess(result);
        }
    }
    @GetMapping(path = "queryLifeByDeviceNo")
    public BaseResponse<?> queryLifeByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryLifeByDeviceNo():" + deviceNo);
        List<StaDeviceLife> result = sv.queryLifeByDeviceNo(deviceNo);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "queryLogByDeviceNo")
    public BaseResponse<?> queryLogByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryLogByDeviceNo():" + deviceNo);
        List<StaDeviceProductionLog> result = sv.queryLogByDeviceNo(deviceNo);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "queryPlanByDeviceNo")
    public BaseResponse<PrAssemblyPlan> queryPlanByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryLogByDeviceNo():" + deviceNo);
        PrAssemblyPlan result = sv.queryPlanByDeviceNo(deviceNo);
        return BaseResponseUtils.buildSuccess(result);
    }
}