zouyu
7 天以前 56e6e0bf18c39a933aec78762b636fdf2efa8d68
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -20,28 +20,31 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.*;
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.common.config.WechatProperty;
import com.ruoyi.common.constant.InsOrderTypeConstants;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.config.WechatProperty;
import com.ruoyi.common.enums.OrderType;
import com.ruoyi.common.numgen.NumberGenerator;
import com.ruoyi.common.utils.LimsDateUtil;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.WxCpUtils;
import com.ruoyi.common.utils.api.IfsApiUtils;
import com.ruoyi.common.utils.api.MesApiUtils;
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.inspect.dto.CopperInsOrderDto;
import com.ruoyi.inspect.dto.OrderSplitDTO;
import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
import com.ruoyi.inspect.dto.SampleProductDto;
import com.ruoyi.inspect.excel.OrderSplitExcelData;
import com.ruoyi.inspect.excel.OrderSplitExcelListener;
import com.ruoyi.inspect.mapper.InsOrderMapper;
import com.ruoyi.inspect.mapper.InsProductMapper;
import com.ruoyi.inspect.mapper.InsSampleMapper;
import com.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper;
import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
import com.ruoyi.inspect.pojo.InsOrder;
import com.ruoyi.inspect.pojo.InsReport;
@@ -49,8 +52,6 @@
import com.ruoyi.inspect.service.InsOrderService;
import com.ruoyi.inspect.service.InsReportService;
import com.ruoyi.inspect.service.RawMaterialOrderService;
import com.ruoyi.common.numgen.NumberGenerator;
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
import com.ruoyi.system.mapper.UserMapper;
@@ -101,6 +102,8 @@
    private IfsSplitOrderRecordService ifsSplitOrderRecordService;
    private InsUnqualifiedHandlerMapper insUnqualifiedHandlerMapper;
    @Override
    public Result selectStandardTreeListByPartNo(String partNo) {
@@ -148,11 +151,15 @@
    @Override
    public IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
        if(ifsInventoryQuantity.getIsInspect().equals(1)){
            ifsInventoryQuantity.setOrderType(OrderType.RAW.getValue());
        }
        return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
    }
    @Override
    public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
        return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto));
    }
@@ -163,13 +170,14 @@
     * @return
     */
    @Override
    public int inspectionReport(List<Long> ids) {
    public int inspectionReport(List<Long> ids,String orderType) {
        Integer userId = SecurityUtils.getUserId().intValue();
        ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
                .in(IfsInventoryQuantity::getId, ids)
                .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
                .set(IfsInventoryQuantity::getDeclareUserId, userId)
                .set(IfsInventoryQuantity::getIsInspect, 1)
                .set(IfsInventoryQuantity::getOrderType,orderType)
                .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
        );
        threadPoolTaskExecutor.execute(() -> {
@@ -231,6 +239,12 @@
    @Override
    public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) {
        Integer userId = SecurityUtils.getUserId().intValue();
        boolean validateValue = OrderType.validateValue(ifsInventoryQuantity.getOrderType());
        if(!validateValue){
            throw new ErrorException("报检失败,非法的销售订单分类枚举");
        }
        //批次号字母转大写
        ifsInventoryQuantity.setUpdateBatchNo(ifsInventoryQuantity.getUpdateBatchNo().toUpperCase(Locale.ROOT));
        ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
                .eq(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId())
                .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
@@ -238,6 +252,7 @@
                .set(IfsInventoryQuantity::getIsInspect, 1)
                .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
                .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
                .set(IfsInventoryQuantity::getOrderType,ifsInventoryQuantity.getOrderType())
        );
        threadPoolTaskExecutor.execute(() -> {
@@ -389,8 +404,9 @@
        String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
        ifsInventoryQuantityDto.setBeginDeclareDate(null);
        ifsInventoryQuantityDto.setEndDeclareDate(null);
        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
        IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
        ifsByOver.getRecords().forEach(r->r.setOrderTypeName(OrderType.getLabelByValue(r.getOrderType())));
        return ifsByOver;
    }
@@ -507,6 +523,9 @@
        ifsInventoryQuantity.setIsSource(0);
        ifsInventoryQuantity.setState(0);
        ifsInventoryQuantity.setIsFinish(0);
        if(!OrderType.validateValue(ifsInventoryQuantity.getOrderType())){
            throw new ErrorException("新增报检信息失败,非法的销售订单分类枚举");
        }
        ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
    }
@@ -597,16 +616,13 @@
        if (!ifsInventoryQuantity.getInspectStatus().equals(2)) {
            throw new ErrorException("不合格的原材料才能让步放行");
        }
        // todo:需要判断oa流程是否是让步放行
        String toLocation = insOrderService.moveRawMaterial(ifsInventoryQuantity);
        ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
        return ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
                .set(IfsInventoryQuantity::getInspectStatus, 4)
                .set(IfsInventoryQuantity::getToLocation, toLocation)
                .eq(IfsInventoryQuantity::getId, ifsInventoryId));
        return true;
                .eq(IfsInventoryQuantity::getId, ifsInventoryId))>0;
    }
    /**
@@ -770,7 +786,7 @@
        String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
        ifsInventoryQuantityDto.setBeginDeclareDate(null);
        ifsInventoryQuantityDto.setEndDeclareDate(null);
        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
        return standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
    }
@@ -922,7 +938,7 @@
        if(Objects.nonNull(splitOrderList) && !splitOrderList.isEmpty()){
            List<Long> ids = splitOrderList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList());
            ids.add(ifsInventoryQuantity.getId());
            this.inspectionReport(ids);
            this.inspectionReport(ids,OrderType.RAW.getValue());
        }
        //勾选同步到MES,保存订单拆分记录
        if(orderSplitDTO.getPushToMes()){
@@ -940,6 +956,12 @@
        return false;
    }
    @Override
    @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
    public Long getOrderCountByIfsId(Long ifsId) {
        return insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getIfsInventoryId,ifsId).ne(InsOrder::getState,-1));
    }
    /**
     * 添加工时
     * @param insOrder