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;
@@ -73,12 +75,25 @@
    @Autowired
    private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
    @Autowired
    private IBsBeatSettingService bsBeatSettingService;
    @Autowired
    private IDaParamCollectionService daParamCollectionService;
    /**
     * 导出点检任务列表
     */
    @PostMapping("/deviceResultFeedback")
    public AjaxResult deviceResultFeedback(@RequestBody ParentVO parentVO)
    {
        //如果是240工位就处理一下总成号,坏了找聂磊
        if(parentVO.getStationCode().equals("OP210")){
            parentVO.setProductNum("TZ180XSDSZX01"+parentVO.getProductNum());
        }
        if(parentVO.getStationCode().equals("OP240")){
            parentVO.setProductNum("TZ180XSDSZX01"+parentVO.getProductNum().split("#T")[1]);
        }
        ObjectMapper mapper = new ObjectMapper();
        List<ChildVO> li = parentVO.getCheckList();
        String checkList = "";
@@ -118,36 +133,80 @@
    }
    @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")
    public AjaxResult productionOrderComponentRequest(BsFormulaChildInfo bsFormulaChildInfo){
        List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>()
                .eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getProcessesCode())
                .eq(BsFormulaChildInfo::getOperationType, "2")
        );
        List<ProductionOrderComponentRequest> requests = new ArrayList<>();
        for (BsFormulaChildInfo info : list) {
            ProductionOrderComponentRequest request = new ProductionOrderComponentRequest();
            request.setMaterialCode(info.getMaterialCode());
            request.setOperationSteps(info.getOperationSteps());
            requests.add(request);
    public AjaxResult productionOrderComponentRequest(@RequestParam String stationCode,@RequestParam String confirmTime){
        List<BsBeatSetting> list = bsBeatSettingService.list();
        for (BsBeatSetting bsBeatSetting : list) {
            String workReportResultFeedback = RestfulService.getWorkReportResultFeedback(bsBeatSetting.getProductCode(), stationCode, confirmTime);
            System.out.println(workReportResultFeedback);
        }
        return AjaxResult.success(requests);
        return AjaxResult.success();
    }
    @GetMapping("/pushStartStopTime")
    public AjaxResult pushStartStopTime(@RequestParam String paramCode,@RequestParam String paramName,@RequestParam String productNum){
        daParamCollectionService.pushStartStopTime(paramCode,paramName,productNum);
        return AjaxResult.success();
    }
    /**