inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -42,6 +42,7 @@
import com.ruoyi.inspect.service.InsOrderStateService;
import com.ruoyi.inspect.service.InsProductService;
import com.ruoyi.inspect.service.InsSampleService;
import com.ruoyi.inspect.service.OutsourceOrderFlowService;
import com.ruoyi.inspect.vo.IfsOrderVO;
import com.ruoyi.inspect.vo.InsOrderPrintingVo;
import com.ruoyi.system.mapper.UserMapper;
@@ -93,6 +94,7 @@
    private ApplicationEventPublisher applicationEventPublisher;
    private StandardProductListMapper standardProductListMapper;
    private StructureItemParameterMapper structureItemParameterMapper;
    private OutsourceOrderFlowService outsourceOrderFlowService;
    //获取检验下单数据
@@ -219,6 +221,7 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int addInsOrder(List<SampleProductDto> list, InsOrder insOrder) {
        initOutsourceOrderSource(insOrder);
        // todo: 下单判断抽样计划的唯一性
        if (insOrder.getQuarterItemId() != null) {
            Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
@@ -545,6 +548,16 @@
        Map<String, Object> map = new HashMap<>();
//        InsOrder insOrder = insOrderMapper.selectById(id);
        IfsOrderVO ifsOrderVO = insOrderMapper.selectOrderInfoById(id);
        // 详情同时返回有效处理流程,供检测页面统一选择布局及校验规则。
        if (ifsOrderVO != null) {
            ifsOrderVO.setFlowOrderType(ifsOrderVO.getIfsOrderType());
            if (ifsOrderVO.getIfsInventoryId() != null) {
                IfsInventoryQuantity quantity = ifsInventoryQuantityMapper.selectById(ifsOrderVO.getIfsInventoryId());
                if (quantity != null) {
                    ifsOrderVO.setFlowOrderType(outsourceOrderFlowService.resolve(quantity.getOrderType(), quantity.getMaterialProp()));
                }
            }
        }
        List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory);
        map.put("insOrder", ifsOrderVO);
        map.put("sampleProduct", list);
@@ -552,6 +565,19 @@
        List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory);
        map.put("reportModel", list2);
        return map;
    }
    /** 保存前读取真实销售订单,纠正外协下单来源,避免前端缓存影响实验室分配。 */
    private void initOutsourceOrderSource(InsOrder insOrder) {
        if (insOrder.getIfsInventoryId() == null) {
            return;
        }
        IfsInventoryQuantity quantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
        if (quantity == null) {
            throw new ErrorException("找不到销售订单信息");
        }
        insOrder.setTypeSource(outsourceOrderFlowService.resolveTypeSource(
                quantity.getOrderType(), quantity.getMaterialProp(), insOrder.getTypeSource()));
    }
    @Override
@@ -1259,7 +1285,7 @@
        //1.根据ifs域获取对应库位配置
        IfsProperties properties = ifsApiUtils.getPropByContract(one.getContract());
        //2.判断订单类型是否为原材料
        if(StringUtils.equals(inventoryQuantity.getOrderType(), OrderType.RAW.getValue())){
        if(StringUtils.equals(outsourceOrderFlowService.resolve(one.getOrderType(), one.getMaterialProp()), OrderType.RAW.getValue())){
            toLocation = properties.getRawQualifiedLocation();
        }else{
            toLocation = properties.getProductQualifiedLocation();