懒羊羊
2023-11-25 9bd5461a1387becd4da03158061a1ed17ddf6a6c
大屏
已修改10个文件
278 ■■■■■ 文件已修改
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/mapper/PassingStationCollectionMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/mapper/mapping/PassingStationCollectionMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/service/PassingStationCollectionService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/service/impl/PassingStationCollectionServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java 245 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/ProductionOrdeInfoMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/mapping/ProductionOrdeInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/ProductionOrdeInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/GlobalVariable.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/mapper/PassingStationCollectionMapper.java
@@ -63,4 +63,6 @@
    int updateSFC(@Param("sfcCode") String sfcCode, @Param("childSfcCode") String childSfcCode);
    Page<PassingStationCollectionResult> PassRate(@Param("page") Page page, @Param("paramCondition") PassingStationCollectionParam paramCondition);
    int bigCenterRightTable(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("qualifiedFlag") String qualifiedFlag, @Param("workOrderNo") String workOrderNo);
}
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/mapper/mapping/PassingStationCollectionMapper.xml
@@ -136,4 +136,15 @@
            location_code
    </select>
    <select id="bigCenterRightTable" resultType="Integer">
        SELECT COUNT(*) AS sumNumber FROM cm_passing_station_collection
        WHERE 1 = 1
          AND location_code = 'OP170'
          AND work_order_no = #{workOrderNo}
          AND create_time BETWEEN #{startTime} AND #{endTime}
        <if test="qualifiedFlag != null and qualifiedFlag != ''">
            and out_rs_sign = #{qualifiedFlag}
        </if>
    </select>
</mapper>
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/service/PassingStationCollectionService.java
@@ -80,4 +80,5 @@
    LayuiPageInfo PassRate(PassingStationCollectionParam param);
    int bigCenterRightTable(String startTime,String endTime,String qualifiedFlag,String workOrderNo);
}
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/cm/passingStationCollection/service/impl/PassingStationCollectionServiceImpl.java
@@ -101,6 +101,11 @@
    }
    @Override
    public int bigCenterRightTable(String startTime, String endTime,String qualifiedFlag,String workOrderNo) {
        return this.baseMapper.bigCenterRightTable(startTime,endTime,qualifiedFlag,workOrderNo);
    }
    @Override
    public Integer getRepairQty() {
        return baseMapper.getRepairQty();
    }
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java
@@ -6,6 +6,12 @@
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.view.PoiBaseView;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.bs.locationInfo.entity.LocationInfo;
import cn.stylefeng.guns.modular.bs.locationInfo.service.LocationInfoService;
import cn.stylefeng.guns.modular.bs.materialInfo.entity.MaterialInfo;
import cn.stylefeng.guns.modular.bs.materialInfo.service.MaterialInfoService;
import cn.stylefeng.guns.modular.cm.passingStationCollection.entity.PassingStationCollection;
import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.entity.ProductionOrdeInfo;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult;
@@ -530,6 +536,245 @@
        return value.trim();
    }
    @Autowired
    MaterialInfoService materialInfoService;
    @Autowired
    PassingStationCollectionService passingStationCollectionService;
    @Autowired
    LocationInfoService locationInfoService;
    /**
     * 大屏车间工单信息接口
     * @return
     */
    @ResponseBody
    @CrossOrigin
    @RequestMapping("/topData")
    public ResponseData topData(ProductionOrdeInfoParam productionOrdeInfoParam) {
        Map map = new HashMap<String,String>();
        ProductionOrdeInfo result = null;
        //但前工单
        List<ProductionOrdeInfo> orderStatus = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3"));
        if(productionOrdeInfoParam.getWorkOrderNo() != null && !productionOrdeInfoParam.getWorkOrderNo().equals("")){
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", productionOrdeInfoParam.getWorkOrderNo()));
            result = workOrderNo.get(0);
        }else if(orderStatus.size()!=0){
            result = orderStatus.get(0);
        }else {
            List<ProductionOrdeInfoResult> results = productionOrdeInfoService.orderDescListFive();
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", results.get(0).getWorkOrderNo()));
            result = workOrderNo.get(0);
        }
        //产品
        List<MaterialInfo> materialCode = materialInfoService.list(new QueryWrapper<MaterialInfo>().eq("material_code", result.getMaterialCode()));
        Integer planQty = result.getPlanQty();
        Integer actualQty = result.getActualQty();
        Date date2 = new Date(); // 第二个日期
        long diffInMillis =result.getPlanEndTime().getTime() - date2.getTime(); //计算两个日期的毫秒差
        long diffInHours = diffInMillis / (60 * 60 * 1000); // 将毫秒差转换为小时差
        List<PassingStationCollection> list = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
                .eq("out_rs_sign", "2")
                .eq("work_order_no", result.getWorkOrderNo())
                .eq("location_code", "OP1060")
        );
        Integer NgNumber = list.size();
        map.put("workOrderNo",result.getWorkOrderNo());
        map.put("planQty",planQty);
        map.put("actualQty",actualQty);
        map.put("materialName",materialCode.get(0).getMaterialName());
        map.put("completionRate",Math.round((float) actualQty / planQty * 100));
        map.put("remainder",diffInHours);
        map.put("NgNumber",NgNumber);
        if(list.size() == 0){
            map.put("passRate","100");
        }else {
            map.put("passRate",Math.round((float) NgNumber / actualQty * 100));
        }
        return ResponseData.success(map);
    }
    @ResponseBody
    @CrossOrigin
    @RequestMapping("/centerLeftData")
    public ResponseData centerLeftData(ProductionOrdeInfoParam productionOrdeInfoParam) {
        Map map = new HashMap<String,String>();
        List categoryList = new ArrayList();
        List lineDataList = new ArrayList();
        List barDataList = new ArrayList();
        ProductionOrdeInfo result = null;
        //但前工单
        List<ProductionOrdeInfo> orderStatus = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3"));
        if(productionOrdeInfoParam.getWorkOrderNo() != null && !productionOrdeInfoParam.getWorkOrderNo().equals("")){
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", productionOrdeInfoParam.getWorkOrderNo()));
            result = workOrderNo.get(0);
        }else if(orderStatus.size()!=0){
            result = orderStatus.get(0);
        }else {
            List<ProductionOrdeInfoResult> results = productionOrdeInfoService.orderDescListFive();
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", results.get(0).getWorkOrderNo()));
            result = workOrderNo.get(0);
        }
        for (String o : getLocationList()) {
            List<PassingStationCollection> list = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
                    .eq("location_code", o)
                    .eq("out_rs_sign", "2")
                    .eq("work_order_no",result.getWorkOrderNo())
            );
            List<PassingStationCollection> lineList = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
                    .eq("location_code", o)
                    .eq("work_order_no",result.getWorkOrderNo())
            );
            categoryList.add(o);
            barDataList.add(list.size());
            lineDataList.add(lineList.size());
        }
        map.put("category",categoryList);
        map.put("barData",barDataList);
        map.put("lineData",lineDataList);
        return ResponseData.success(map);
    }
    @ResponseBody
    @CrossOrigin
    @RequestMapping("/bottomData")
    public ResponseData bottomData(ProductionOrdeInfoParam productionOrdeInfoParam) {
        Map map = new HashMap<String,String>();
        List unqualifiedList = new ArrayList();
        List qualifiedList = new ArrayList();
        List passRate = new ArrayList();
//        List<ProductionOrdeInfo> orderStatus = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3"));
//        ProductionOrdeInfo result = orderStatus.get(0);
        ProductionOrdeInfo result = null;
        //但前工单
        List<ProductionOrdeInfo> orderStatus = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3"));
        if(productionOrdeInfoParam.getWorkOrderNo() != null && !productionOrdeInfoParam.getWorkOrderNo().equals("")){
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", productionOrdeInfoParam.getWorkOrderNo()));
            result = workOrderNo.get(0);
        }else if(orderStatus.size()!=0){
            result = orderStatus.get(0);
        }else {
            List<ProductionOrdeInfoResult> results = productionOrdeInfoService.orderDescListFive();
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", results.get(0).getWorkOrderNo()));
            result = workOrderNo.get(0);
        }
        for (String o : getLocationList()) {
            List<PassingStationCollection> list = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
                    .eq("location_code", o)
                    .eq("out_rs_sign", "2")
                    .eq("work_order_no",result.getWorkOrderNo())
            );
            Integer unqualified = list.size();
            Integer qualified = result.getActualQty()-list.size();
            unqualifiedList.add(unqualified);
            qualifiedList.add(qualified);
            if(unqualified == 0){
                passRate.add(100);
            }else {
                passRate.add(Math.round((float) qualified / result.getActualQty() * 100));
            }
        }
        map.put("unqualifiedList",unqualifiedList);
        map.put("qualifiedList",qualifiedList);
        map.put("passRate",passRate);
        return ResponseData.success(map);
    }
    @ResponseBody
    @CrossOrigin
    @RequestMapping("/centerRightData")
    public ResponseData centerRightData(ProductionOrdeInfoParam productionOrdeInfoParam) {
//        List<ProductionOrdeInfo> orderStatus = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3"));
//        ProductionOrdeInfo result = orderStatus.get(0);
        ProductionOrdeInfo result = null;
        //但前工单
        List<ProductionOrdeInfo> orderStatus = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3"));
        if(productionOrdeInfoParam.getWorkOrderNo() != null && !productionOrdeInfoParam.getWorkOrderNo().equals("")){
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", productionOrdeInfoParam.getWorkOrderNo()));
            result = workOrderNo.get(0);
        }else if(orderStatus.size()!=0){
            result = orderStatus.get(0);
        }else {
            List<ProductionOrdeInfoResult> results = productionOrdeInfoService.orderDescListFive();
            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", results.get(0).getWorkOrderNo()));
            result = workOrderNo.get(0);
        }
        Integer targetNumber = 70;
        List resultList = new ArrayList();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String format1 = format.format(new Date());
        String paramPrefix = format1+" ";
        for (String s : getCenterRightSpit()) {
            List itemList = new ArrayList();
            int outTotal = passingStationCollectionService.bigCenterRightTable(paramPrefix+s+":00",paramPrefix+s.substring(0,1)+":59:59",null,result.getWorkOrderNo());
            int i = passingStationCollectionService.bigCenterRightTable(paramPrefix+s+":00",paramPrefix+s.substring(0,1)+":59:59","1",result.getWorkOrderNo());
            if(outTotal<targetNumber){
                itemList.add(boldText(s));
                itemList.add(boldText(targetNumber.toString()));
                itemList.add(boldText(String.valueOf(outTotal)));
                itemList.add(boldText(String.valueOf(targetNumber-outTotal)));
                itemList.add(boldText(Math.round((float) i / outTotal * 100)+"%"));
            }else {
                itemList.add(s);
                itemList.add(targetNumber);
                itemList.add(outTotal);
                itemList.add(targetNumber-outTotal);
                itemList.add(Math.round((float) i / outTotal * 100)+"%");
            }
           resultList.add(itemList);
        }
        return ResponseData.success(resultList);
    }
    @ResponseBody
    @CrossOrigin
    @RequestMapping("/orderDescListFive")
    public ResponseData orderDescListFive() {
        List list = new ArrayList();
        List<ProductionOrdeInfoResult> results = productionOrdeInfoService.orderDescListFive();
        for (ProductionOrdeInfoResult result : results) {
            Map itemMap = new HashMap();
            itemMap.put("value",result.getWorkOrderNo());
            itemMap.put("label",result.getWorkOrderNo());
            list.add(itemMap);
        }
        return ResponseData.success(list);
    }
    public static List<String> getLocationList(){
        List<String> locationList = new ArrayList<>();
        locationList.add("OP070");
        locationList.add("OP100");
        locationList.add("OP140");
        locationList.add("OP150");
        locationList.add("EOP080");
        locationList.add("EOP090");
        return locationList;
    }
    public static List<String> getCenterRightSpit(){
        List<String> locationList = new ArrayList<>();
        locationList.add("8:00");
        locationList.add("9:00");
        locationList.add("10:00");
        locationList.add("11:00");
        locationList.add("12:00");
        locationList.add("13:00");
        locationList.add("14:00");
        locationList.add("15:00");
        locationList.add("16:00");
        locationList.add("17:00");
        return locationList;
    }
    public static String boldText(String param){
        return "<span style='font-size: 20px' class='colorRed'>"+param+"</span>";
    }
}
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/ProductionOrdeInfoMapper.java
@@ -64,4 +64,6 @@
    List<ProductionOrdeInfoResult> getListMonth();
    List<ProductionOrdeInfoResult> getColumnarDate();
    List<ProductionOrdeInfoResult> orderDescListFive();
}
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/mapping/ProductionOrdeInfoMapper.xml
@@ -142,4 +142,8 @@
            actual_start_time DESC OFFSET 0 ROWS FETCH NEXT 7 ROWS ONLY;
    </select>
    <select id="orderDescListFive" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">
        SELECT TOP 5 * FROM om_production_orde_info ORDER BY actual_start_time DESC
    </select>
</mapper>
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/ProductionOrdeInfoService.java
@@ -81,4 +81,6 @@
    List<ProductionOrdeInfoResult> getListMonth();
    List<ProductionOrdeInfoResult> getColumnarDate();
    List<ProductionOrdeInfoResult> orderDescListFive();
}
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java
@@ -166,6 +166,11 @@
        return baseMapper.getColumnarDate();
    }
    @Override
    public List<ProductionOrdeInfoResult> orderDescListFive() {
        return baseMapper.orderDescListFive();
    }
    private Serializable getKey(ProductionOrdeInfoParam param){
        return param.getId();
    }
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/GlobalVariable.java
@@ -5,6 +5,7 @@
public class GlobalVariable {
//    public static boolean TERMINATED = false;
    public static boolean TERMINATED = true;