admin
2025-04-09 9a0334b6e46d9503246d99be0a3a79945dee7919
jcdm-main/src/main/java/com/jcdm/main/restful/qingYan/service/ExternalInterface.java
@@ -8,6 +8,7 @@
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -45,6 +46,7 @@
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@@ -131,20 +133,64 @@
    }
    @GetMapping("/productionWorkOrderRequest")
    public AjaxResult productionWorkOrderRequest(){
        List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.list();
        List<RestFulOrder> restFulOrders = new ArrayList<>();
        for (OmProductionOrdeInfo omProductionOrdeInfo : list) {
            RestFulOrder order = new RestFulOrder();
            order.setProductionOrderNum(omProductionOrdeInfo.getWorkOrderNo());
            order.setProductNum(omProductionOrdeInfo.getProductNum());
            order.setMaterialCode(omProductionOrdeInfo.getMaterialCode());
            order.setStationCode(omProductionOrdeInfo.getStationCode());
            order.setPlanQty(omProductionOrdeInfo.getPlanQty());
            order.setCreateTime(format.format(omProductionOrdeInfo.getCreateTime()));
            restFulOrders.add(order);
    public AjaxResult productionWorkOrderRequest(@RequestParam String sfcCode){
        List<DaParamCollection> sfcCodelist = daParamCollectionService.list(new LambdaQueryWrapper<DaParamCollection>()
                        .select(DaParamCollection::getSfcCode)
                .eq(DaParamCollection::getSpareField2, "1")
                .groupBy(DaParamCollection::getSfcCode)
        );
        List<String> sfcList = sfcCodelist.stream().map(DaParamCollection::getSfcCode).collect(Collectors.toList());
//        List<String> sfcList = new ArrayList<>();
//        sfcList.add(sfcCode);
        for (Object o : sfcList) {
            ParentVO parentVO = new ParentVO();
            parentVO.setSiteCode("3983");
            parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli()));
            parentVO.setStationCode("M1OP100-2");
            parentVO.setProductNum(o.toString());
            parentVO.setTotalResult("1");
            List<ChildVO> list = new ArrayList<>();
            for (int i = 1; i <= 16; i++) {
                List<DaParamCollection> list1 = daParamCollectionService.list(new LambdaQueryWrapper<DaParamCollection>()
                        .eq(DaParamCollection::getSfcCode, o.toString())
                        .eq(DaParamCollection::getParamCode, "Cell1Code_"+i)
                );
                ChildVO childVO = new ChildVO();
                childVO.setItemType("1");
                childVO.setItemText("Cell1Code_"+i);
                childVO.setItemValue(list1.get(0).getParamValue());
                childVO.setItemCode("电芯编码_"+i);
                childVO.setCheckResult("1");
                childVO.setCheckTime(format.format(new Date()));
                list.add(childVO);
            }
            for (int j = 1; j <= 16; j++) {
                List<DaParamCollection> list1 = daParamCollectionService.list(new LambdaQueryWrapper<DaParamCollection>()
                        .eq(DaParamCollection::getSfcCode, o.toString())
                        .eq(DaParamCollection::getParamCode, "Cell2Code_"+j)
                );
                ChildVO childVO = new ChildVO();
                childVO.setItemType("1");
                childVO.setItemText("Cell2Code_"+j);
                childVO.setItemValue(list1.get(0).getParamValue());
                childVO.setItemCode("电芯编码_"+j);
                childVO.setCheckResult("1");
                childVO.setCheckTime(format.format(new Date()));
                list.add(childVO);
            }
            parentVO.setCheckList(list);
            HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute();
            boolean update = daParamCollectionService.update(new LambdaUpdateWrapper<DaParamCollection>()
                    .set(DaParamCollection::getSpareField2, "2")
                    .eq(DaParamCollection::getSfcCode, parentVO.getProductNum())
            );
            System.out.println(parentVO.getProductNum()+"---------------------------------"+execute.body());
            System.out.println(parentVO);
            System.out.println(parentVO.getProductNum()+"+++++++++"+update);
        }
        return AjaxResult.success(restFulOrders);
        return AjaxResult.success("execute.body()");
    }
    @GetMapping("/productionOrderComponentRequest")