Search in sources :

Example 1 with DesignDepInfo

use of com.eservice.api.model.design_dep_info.DesignDepInfo in project sinsim by WilsonHu.

the class DesignDepInfoController method list.

@PostMapping("/list")
public Result list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
    PageHelper.startPage(page, size);
    List<DesignDepInfo> list = designDepInfoService.findAll();
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) DesignDepInfo(com.eservice.api.model.design_dep_info.DesignDepInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 2 with DesignDepInfo

use of com.eservice.api.model.design_dep_info.DesignDepInfo in project sinsim by WilsonHu.

the class DesignDepInfoController method update.

@PostMapping("/update")
public Result update(String jsonDesignDepInfoFormAllInfo) {
    DesignDepInfo designDepInfo = JSON.parseObject(jsonDesignDepInfoFormAllInfo, DesignDepInfo.class);
    if (designDepInfo == null || designDepInfo.equals("")) {
        return ResultGenerator.genFailResult("JSON数据异常");
    }
    if (designDepInfo.getId() == null) {
        return ResultGenerator.genFailResult("异常,Id为空");
    }
    // 自动设置状态
    if (designDepInfo.getDesigner() == null || designDepInfo.getDesigner().equals("")) {
        designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_UNPLANNED);
    } else {
        designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_PLANNED);
    }
    DesignDepInfo designDepInfoOld = designDepInfoService.findById(designDepInfo.getId());
    if (designDepInfoOld == null) {
        return ResultGenerator.genFailResult("异常,根据Id找不到对应的设计");
    }
    // 整体状态DesignStatus, 只考虑常规操作, 即只考虑从未完成到已完成, 不考虑来回改动,
    if (designDepInfoOld.getDrawingFileDone() != designDepInfo.getDrawingFileDone()) {
        if (designDepInfo.getDrawingFileDone()) {
            designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_DRAWING_DONE);
        } else {
        // 对于把已某项 完成改成未完成的情况,不考虑再修改整体状态
        }
    }
    if (designDepInfoOld.getLoadingFileDone() != designDepInfo.getLoadingFileDone()) {
        if (designDepInfo.getLoadingFileDone()) {
            designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_LOADING_DONE);
        }
    }
    if (designDepInfoOld.getHoleDone() != designDepInfo.getHoleDone()) {
        if (designDepInfo.getHoleDone()) {
            designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_HOLE_DONE);
        }
    }
    if (designDepInfoOld.getTubeDone() != designDepInfo.getTubeDone()) {
        if (designDepInfo.getTubeDone()) {
            designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_TUBE_DONE);
        }
    }
    if (designDepInfoOld.getCoverDone() != designDepInfo.getCoverDone()) {
        if (designDepInfo.getCoverDone()) {
            designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_COVER_DONE);
        }
    }
    if (designDepInfoOld.getBomDone() != designDepInfo.getBomDone()) {
        if (designDepInfo.getBomDone()) {
            designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_BOM_DONE);
        }
    }
    if (designDepInfo.getDrawingFileDone() && designDepInfo.getLoadingFileDone() && designDepInfo.getHoleDone() && designDepInfo.getTubeDone() && designDepInfo.getCoverDone() && designDepInfo.getBomDone()) {
        designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_ALL_DONE);
    }
    designDepInfoService.update(designDepInfo);
    return ResultGenerator.genSuccessResult();
}
Also used : DesignDepInfo(com.eservice.api.model.design_dep_info.DesignDepInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 3 with DesignDepInfo

use of com.eservice.api.model.design_dep_info.DesignDepInfo in project sinsim by WilsonHu.

the class DesignDepInfoController method add.

/**
 * 一次性同时上传 信息
 */
@Transactional(rollbackFor = Exception.class)
@PostMapping("/add")
public Result add(String jsonDesignDepInfoFormAllInfo) {
    DesignDepInfo designDepInfo = JSON.parseObject(jsonDesignDepInfoFormAllInfo, DesignDepInfo.class);
    if (designDepInfo == null || designDepInfo.equals("")) {
        return ResultGenerator.genFailResult("JSON数据异常");
    }
    if (designDepInfo.getOrderId() == null) {
        return ResultGenerator.genFailResult("异常,orderId为空");
    }
    // 自动设置状态
    if (designDepInfo.getDesigner() == null || designDepInfo.getDesigner().equals("")) {
        designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_UNPLANNED);
    } else {
        designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_PLANNED);
    }
    designDepInfoService.saveAndGetID(designDepInfo);
    // 返回ID给前端,前端新增联系单时不关闭页面。
    return ResultGenerator.genSuccessResult(designDepInfo.getId());
}
Also used : DesignDepInfo(com.eservice.api.model.design_dep_info.DesignDepInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with DesignDepInfo

use of com.eservice.api.model.design_dep_info.DesignDepInfo in project sinsim by WilsonHu.

the class CommonService method createDesignDepInfo.

/**
 *  在生成订单、改单、拆单 时,自动生成设计单 ---签核完成时--再改:技术部签核完成就生成设计单。
 *
 * @param machineOrder
 */
public void createDesignDepInfo(MachineOrder machineOrder) {
    DesignDepInfo designDepInfo = new DesignDepInfo();
    designDepInfo.setDesignStatus(Constant.STR_DESIGN_STATUS_UNPLANNED);
    designDepInfo.setOrderNum(machineOrder.getOrderNum());
    if (machineOrder.getOrderNum() == null) {
        logger.error(machineOrder.getId() + "订单号为null");
    }
    designDepInfo.setSaleman(machineOrder.getSellman());
    try {
        List<Contract> list = contractService.getContractByOrderNumber(machineOrder.getOrderNum());
        if (list.size() > 1) {
            logger.error(machineOrder.getOrderNum() + ":该编号存在多个合同" + "自动创建设计单 失败");
            return;
        }
        Contract contract1 = list.get(0);
        if (contract1 != null) {
            designDepInfo.setGuestName(contract1.getCustomerName());
        }
        designDepInfo.setCountry(machineOrder.getCountry());
        designDepInfo.setMachineNum(machineOrder.getMachineNum());
        /**
         * 不仅仅是初始化状态,因为还有改单,拆单对应的状态
         */
        // designDepInfo.setOrderSignStatus(Constant.ORDER_INITIAL);
        // 注意这里是订单状态,不是订单签核状态
        designDepInfo.setOrderSignStatus(machineOrder.getStatus());
        designDepInfo.setOrderId(machineOrder.getId());
        designDepInfo.setCreatedDate(new Date());
        designDepInfo.setUpdatedDate(new Date());
        designDepInfoService.save(designDepInfo);
        logger.info("根据订单" + machineOrder.getOrderNum() + " 自动创建设计单");
    } catch (Exception e) {
        logger.error("自动创建设计单 失败 " + e.getMessage());
    }
}
Also used : DesignDepInfo(com.eservice.api.model.design_dep_info.DesignDepInfo) Contract(com.eservice.api.model.contract.Contract)

Example 5 with DesignDepInfo

use of com.eservice.api.model.design_dep_info.DesignDepInfo in project sinsim by WilsonHu.

the class DesignDepInfoController method getDesignAttachedFile.

/**
 * 根据 设计单的ID以及下载类型() 返回设计单的附件的对应类型的文件名称
 * 下载路径的前面部分是统一的,放在xxx_ip/download/下(nginx配置),
 * 比如,访问下面地址可以下载该图纸装车单
 *
 * @param designDepInfoId
 * @return 类似
 */
@PostMapping("/getDesignAttachedFile")
public Result getDesignAttachedFile(@RequestParam Integer designDepInfoId, String fileType) {
    DesignDepInfo ddi = designDepInfoService.findById(designDepInfoId);
    if (null == ddi) {
        return ResultGenerator.genFailResult("根据该 designDepInfoId 找不到对应的设计单");
    }
    String fileName = null;
    switch(fileType) {
        case Constant.STR_DESIGN_UPLOAD_FILE_TYPE_DRAWING:
            if (ddi.getDrawingFiles() == null) {
                return ResultGenerator.genFailResult("该设计单没有 图纸附件");
            }
            fileName = ddi.getDrawingFiles().substring(designAttachedSavedDir.length());
            break;
        case Constant.STR_DESIGN_UPLOAD_FILE_TYPE_LOADINGFILE:
            if (ddi.getLoadingFiles() == null) {
                return ResultGenerator.genFailResult("该设计单没有 装车单附件");
            }
            fileName = ddi.getLoadingFiles().substring(designAttachedSavedDir.length());
            break;
        case Constant.STR_DESIGN_UPLOAD_FILE_TYPE_HOLE:
            if (ddi.getHoleFiles() == null) {
                return ResultGenerator.genFailResult("该设计单没有 点孔附件");
            }
            fileName = ddi.getHoleFiles().substring(designAttachedSavedDir.length());
            break;
        case Constant.STR_DESIGN_UPLOAD_FILE_TYPE_TUBE:
            if (ddi.getTubeFiles() == null) {
                return ResultGenerator.genFailResult("该设计单没有 方管附件");
            }
            fileName = ddi.getTubeFiles().substring(designAttachedSavedDir.length());
            break;
        case Constant.STR_DESIGN_UPLOAD_FILE_TYPE_COVER:
            if (ddi.getCoverFile() == null) {
                return ResultGenerator.genFailResult("该设计单没有 罩盖附件");
            }
            fileName = ddi.getCoverFile().substring(designAttachedSavedDir.length());
            break;
        default:
            return ResultGenerator.genFailResult("没有该类型: " + fileType);
    }
    return ResultGenerator.genSuccessResult(fileName);
}
Also used : DesignDepInfo(com.eservice.api.model.design_dep_info.DesignDepInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

DesignDepInfo (com.eservice.api.model.design_dep_info.DesignDepInfo)5 PostMapping (org.springframework.web.bind.annotation.PostMapping)4 Contract (com.eservice.api.model.contract.Contract)1 PageInfo (com.github.pagehelper.PageInfo)1 Transactional (org.springframework.transaction.annotation.Transactional)1