原材料报检:同一批次号不是第一次报检,企业微信通知格式调整
原材料下单:待下单的订单批次号重复的高亮显示
已修改10个文件
106 ■■■■ 文件已修改
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/vo/IfsInventoryQuantityVO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StandardTreeMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-test.yml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/IndustryChainUtils.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
@@ -6,9 +6,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.*;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardTree;
import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -47,8 +47,8 @@
    List<FactoryDto> selectStandardTreeListByPartNo(@Param("partNo") String partNo);
    IPage<IfsInventoryQuantity> selectIfsPage(IPage<IfsInventoryQuantity> page,
                                              @Param("ew") QueryWrapper<IfsInventoryQuantity> ew);
    IPage<IfsInventoryQuantityVO> selectIfsPage(IPage<IfsInventoryQuantity> page,
                                                @Param("ew") QueryWrapper<IfsInventoryQuantity> ew);
    IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page,
                                                    @Param("ew") QueryWrapper<IfsInventoryQuantityDto> ew);
basic-server/src/main/java/com/ruoyi/basic/vo/IfsInventoryQuantityVO.java
@@ -28,4 +28,10 @@
    @ApiModelProperty(value = "同步状态(0:未同步,1:已同步)")
    private Integer syncStatus;
    /**
     * 批次号是否重复报检
     */
    @ApiModelProperty("批次号是否重复报检")
    private Boolean lotBatchNoHasRepeat;
}
basic-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -317,7 +317,7 @@
        order by send_time desc
    </select>
    <select id="selectIfsPage" resultType="com.ruoyi.basic.pojo.IfsInventoryQuantity">
    <select id="selectIfsPage" resultType="com.ruoyi.basic.vo.IfsInventoryQuantityVO">
        SELECT * from ifs_inventory_quantity ifs
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
@@ -141,7 +141,6 @@
    @ApiOperation(value = "报检")
    @PostMapping("/inspectionReportOne")
    public Result<?> inspectionReportOne(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
        return Result.success(rawMaterialOrderService.inspectionReportOne(ifsInventoryQuantity));
    }
@@ -178,7 +177,7 @@
    @ApiOperation(value = "仓库报检查询")
    @GetMapping("/getWarehouseSubmit")
    public Result getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) throws Exception {
    public Result getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) {
        return Result.success(rawMaterialOrderService.getWarehouseSubmit(page, ifsInventoryQuantity));
    }
inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java
@@ -2,21 +2,22 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.*;
import com.ruoyi.basic.dto.IfsInventoryQuantityCheckDto;
import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
import com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.inspect.dto.CopperInsOrderDto;
import com.ruoyi.inspect.dto.OrderSplitDTO;
import com.ruoyi.inspect.dto.SampleProductDto;
import com.ruoyi.inspect.pojo.InsOrder;
import com.ruoyi.inspect.dto.CopperInsOrderDto;
import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
/**
 * @Author zhuo
@@ -32,7 +33,7 @@
     * @param ifsInventoryQuantity
     * @return
     */
    IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity);
    IPage<IfsInventoryQuantityVO> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity);
    /**
     * 查询检验值
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -638,11 +638,12 @@
                if(isSplitOrder){
                    ifsInventoryQuantity.setIsSplitOrder(1);
                }
                //todo:不清楚用途,暂时屏蔽掉
                // 查询产业链检测数据
                String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(),
                        ifsInventoryQuantity.getLineNo(),
                        ifsInventoryQuantity.getReleaseNo());
                ifsInventoryQuantity.setIndustryChain(industryChainAttrFields);
//                String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(),
//                        ifsInventoryQuantity.getLineNo(),
//                        ifsInventoryQuantity.getReleaseNo());
//                ifsInventoryQuantity.setIndustryChain(industryChainAttrFields);
                ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
            }
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -50,6 +50,7 @@
import com.ruoyi.inspect.service.RawMaterialOrderService;
import com.ruoyi.common.numgen.NumberGenerator;
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
import com.ruoyi.system.mapper.UserMapper;
@@ -146,8 +147,15 @@
    }
    @Override
    public IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
        return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
    public IPage<IfsInventoryQuantityVO> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
        IPage<IfsInventoryQuantityVO> ifsInventoryQuantityIPage = standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
        ifsInventoryQuantityIPage.getRecords().forEach(f->{
            Long count = ifsInventoryQuantityMapper.selectCount(Wrappers.<IfsInventoryQuantity>lambdaQuery()
                    .ne(IfsInventoryQuantity::getId,f.getId())
                    .eq(IfsInventoryQuantity::getUpdateBatchNo, f.getUpdateBatchNo()));
            f.setLotBatchNoHasRepeat(count>0);
        });
        return ifsInventoryQuantityIPage;
    }
    @Override
@@ -241,13 +249,32 @@
        threadPoolTaskExecutor.execute(() -> {
            IfsInventoryQuantity inventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryQuantity.getId());
            // 企业微信通知
            String message = "";
            message += "新增报检通知";
            message += "\n批次号: " + inventoryQuantity.getUpdateBatchNo();
            message += "\n零件描述: " + inventoryQuantity.getPartDesc();
            message += "\n抵达数量: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
            WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
            //查询相同批号的历史ifs订单
            List<IfsInventoryQuantity> historyRecords = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
                    .ne(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId())
                    .eq(IfsInventoryQuantity::getIsInspect, 1)
                    .eq(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
            );
            if(CollUtil.isEmpty(historyRecords)){
                // 企业微信通知
                String message = "";
                message += "新增报检通知";
                message += "\n批次号: " + inventoryQuantity.getUpdateBatchNo();
                message += "\n零件描述: " + inventoryQuantity.getPartDesc();
                message += "\n抵达数量: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
                WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
            }else{
                //获取历史抵达数量
                double sum = historyRecords.stream().map(IfsInventoryQuantity::getQtyArrived).mapToDouble(BigDecimal::doubleValue).sum();
                String historyQuantity = sum + inventoryQuantity.getBuyUnitMeas();
                String messageMarkdown = "";
                messageMarkdown += "新增报检通知";
                messageMarkdown += "\n批次号: <font color='warning'>" + inventoryQuantity.getUpdateBatchNo() + "</font>";
                messageMarkdown += "\n零件描述: "+ inventoryQuantity.getPartDesc();
                messageMarkdown += "\n抵达数量: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
                messageMarkdown += "\n历史抵达数量: " + historyQuantity;
                WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), messageMarkdown,"markdown");
            }
        });
        return 1;
    }
ruoyi-admin/src/main/resources/application-test.yml
@@ -150,6 +150,12 @@
  # 质量报检通知
  examiningUrl: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=21993616-9966-4fe4-81b0-68e99a40c964
mes:
  ztzb:
    ip: http://192.168.7.48:8100
    user: chen
    password: u3QMBneOYFqgWoMYdWzjjg==
ifs:
  contract: ZTZB
  contract-key-get: 4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo=
ruoyi-common/src/main/java/com/ruoyi/common/utils/IndustryChainUtils.java
@@ -11,7 +11,7 @@
    //请求表单账号
    private static final String USERNAME = "ZTKJ-N002096";
    //请求表单密码
    private static final String PASSWORD = "Abc12345@";
    private static final String PASSWORD = "Comp&52316167";
    //Base64格式编码
    private static final String PWDBASE64 = Base64.encode(PASSWORD);
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java
@@ -100,9 +100,21 @@
     * @throws Exception
     */
    public static String informWebHook(String webHook, String content) {
        return informWebHook(webHook, content,"text");
    }
    /**
     * 推送群消息
     *
     * @param webHook 企业微信机器人地址
     * @param content 数据
     * @param msgType 消息类型
     * @throws Exception
     */
    public static String informWebHook(String webHook, String content,String msgType) {
        JSONObject jsonObject = new JSONObject()
                .accumulate("msgtype", "text")
                .accumulate("text", new JSONObject()
                .accumulate("msgtype", msgType)
                .accumulate(msgType, new JSONObject()
                        .accumulate("content", content));
        return HttpRequest.post(webHook).header("Content-Type", "application/json").body(jsonObject.toString()).execute().body();
    }