懒羊羊
2023-09-11 0d7f3104244ca76fdb3a8b70117c51f25dce4c36
大屏
已修改3个文件
133 ■■■■ 文件已修改
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/em/equipmentAlarm/controller/EquipmentAlarmController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java 111 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/mapping/ProductionOrdeInfoMapper.xml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/em/equipmentAlarm/controller/EquipmentAlarmController.java
@@ -138,10 +138,15 @@
        List arrayList = new ArrayList();
        List<EquipmentAlarm> alarmTime = equipmentAlarmService.list(new QueryWrapper<EquipmentAlarm>().orderByDesc("alarm_time"));
        for (int i = 0; i < 10; i++) {
//            List resultList = new ArrayList();
//            resultList.add(alarmTime.get(i).getWorkshopCode());
//            resultList.add(alarmTime.get(i).getEquipmentNo());
//            resultList.add(alarmTime.get(i).getLocationCode());
//            arrayList.add(resultList);
            List resultList = new ArrayList();
            resultList.add(alarmTime.get(i).getWorkshopCode());
            resultList.add(alarmTime.get(i).getEquipmentNo());
//            resultList.add(alarmTime.get(i).getEquipmentNo());
            resultList.add(alarmTime.get(i).getLocationCode());
            resultList.add(alarmTime.get(i).getAlarmTime());
            arrayList.add(resultList);
        }
        return arrayList;
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java
@@ -13,6 +13,7 @@
import cn.stylefeng.guns.sys.modular.system.entity.Dict;
import cn.stylefeng.guns.sys.modular.system.service.DictService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.response.ResponseData;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -27,6 +28,7 @@
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
@@ -132,7 +134,7 @@
    public ResponseData editItem(ProductionOrdeInfoParam productionOrdeInfoParam) {
        if(productionOrdeInfoParam.getFlag()!=null){
            productionOrdeInfoParam.setActualStartTime(new Date());
       }
        }
        this.productionOrdeInfoService.update(productionOrdeInfoParam);
        this.productionOrdeInfoService.saveOrderBatchInfo(productionOrdeInfoParam);
        return ResponseData.success();
@@ -255,8 +257,16 @@
    @CrossOrigin
    @RequestMapping("/lineFinishQty")
    public ResponseData lineFinishQty() {
        List list = this.productionOrdeInfoService.lineFinishQty();
        return ResponseData.success(list);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        List resultList = new ArrayList();
        List<ProductionOrdeInfoResult> list = this.productionOrdeInfoService.lineFinishQty();
        for (ProductionOrdeInfoResult productionOrdeInfo : list) {
            Map map = new HashMap();
            map.put("name",format.format(productionOrdeInfo.getActualStartTime()));
            map.put("value",productionOrdeInfo.getActualQty());
            resultList.add(map);
        }
        return ResponseData.success(resultList);
    }
    /**
@@ -267,14 +277,50 @@
    @CrossOrigin
    @RequestMapping("/workshopOrderDetail")
    public ResponseData workshopOrderDetail(ProductionOrdeInfoParam productionOrdeInfoParam) {
//        NumberFormat numberFormat = NumberFormat.getInstance();
//        numberFormat.setMaximumFractionDigits(2);
//        ProductionOrdeInfo one = productionOrdeInfoService.getOne(new QueryWrapper<ProductionOrdeInfo>()
//                .select("SUM\n" +
//                        "\t( plan_qty ) AS planQty,\n" +
//                        "\tSUM ( actual_qty ) AS actualQty,\n" +
//                        "\tSUM ( scrap_qty ) AS scrapQty ")
//        );
//        //计划
//        Integer plqnQty = one.getPlanQty();
//        //完成
//        Integer actualQty = one.getActualQty();
//        //报废
//        Integer scrapQty = one.getScrapQty();
//        //合格数量
//        Integer paseQty = actualQty-scrapQty;
//
//        Map map = new HashMap<String,String>();
//        map.put("produceQty",plqnQty);
//        map.put("finishQty",actualQty);
//        map.put("paseQty",paseQty);
//        map.put("noPaseQty",scrapQty);
//        map.put("CompletionRate",numberFormat.format((float) actualQty / (float) plqnQty * 100));
//        map.put("PassRate",numberFormat.format((float) paseQty / (float) actualQty * 100));
//        map.put("surplusQty",plqnQty-actualQty);
//        return ResponseData.success(map);
        ProductionOrdeInfoParam param = new ProductionOrdeInfoParam();
        param.setOrderStatus("3");
        ProductionOrdeInfoResult one = new ProductionOrdeInfoResult();
        NumberFormat numberFormat = NumberFormat.getInstance();
        numberFormat.setMaximumFractionDigits(2);
        ProductionOrdeInfo one = productionOrdeInfoService.getOne(new QueryWrapper<ProductionOrdeInfo>()
                .select("SUM\n" +
                        "\t( plan_qty ) AS planQty,\n" +
                        "\tSUM ( actual_qty ) AS actualQty,\n" +
                        "\tSUM ( scrap_qty ) AS scrapQty ")
        );
        List<ProductionOrdeInfoResult> listMonth = productionOrdeInfoService.getListMonth();
        List<ProductionOrdeInfoResult> listBySpec = productionOrdeInfoService.findListBySpec(param);
        if(listBySpec.size() == 0){
            ToolUtil.copyProperties(listMonth.get(0), one);
        }else {
            ToolUtil.copyProperties(listBySpec.get(0), one);
        }
        if(one.getActualQty() == null){
            one.setActualQty(0);
        }
        if(one.getScrapQty() == null){
            one.setScrapQty(0);
        }
        //计划
        Integer plqnQty = one.getPlanQty();
        //完成
@@ -285,12 +331,17 @@
        Integer paseQty = actualQty-scrapQty;
        Map map = new HashMap<String,String>();
        map.put("produceQty",plqnQty);
        map.put("finishQty",actualQty);
        map.put("produceQty",one.getPlanQty());
        map.put("finishQty",one.getActualQty());
        map.put("paseQty",paseQty);
        map.put("noPaseQty",scrapQty);
        map.put("CompletionRate",numberFormat.format((float) actualQty / (float) plqnQty * 100));
        map.put("PassRate",numberFormat.format((float) paseQty / (float) actualQty * 100));
        String format = numberFormat.format((float) paseQty / (float) actualQty * 100);
        if(format.equals("�")){
            map.put("PassRate","0");
        }else {
            map.put("PassRate",format);
        }
        map.put("surplusQty",plqnQty-actualQty);
        return ResponseData.success(map);
    }
@@ -317,28 +368,28 @@
        Map map = new HashMap<String,String>();
//        for (int i = 0; i < 7; i++) {
//            String str = LocalDate.now().minusDays(i).toString();
            for (Object o : getWeek()) {
                QueryWrapper<ProductionOrdeInfo> queryWrapper = new QueryWrapper<ProductionOrdeInfo>();
                queryWrapper.select("SUM(plan_qty) as planQty,SUM(actual_qty) as actualQty");
                queryWrapper.apply("CONVERT ( VARCHAR ( 100 ), plan_start_time, 23 ) = {0}",o.toString() );
                ProductionOrdeInfo one = productionOrdeInfoService.getOne(queryWrapper);
                if(one!=null){
                    if(one.getPlanQty()!=null){
                        planQtyList.add(one.getPlanQty());
                    }else {
                        planQtyList.add(0);
                    }
                    if(one.getActualQty()!=null){
                        actualQtyList.add(one.getActualQty());
                    }else {
                        actualQtyList.add(0);
                    }
        for (Object o : getWeek()) {
            QueryWrapper<ProductionOrdeInfo> queryWrapper = new QueryWrapper<ProductionOrdeInfo>();
            queryWrapper.select("SUM(plan_qty) as planQty,SUM(actual_qty) as actualQty");
            queryWrapper.apply("CONVERT ( VARCHAR ( 100 ), plan_start_time, 23 ) = {0}",o.toString() );
            ProductionOrdeInfo one = productionOrdeInfoService.getOne(queryWrapper);
            if(one!=null){
                if(one.getPlanQty()!=null){
                    planQtyList.add(one.getPlanQty());
                }else {
                    planQtyList.add(0);
                }
                if(one.getActualQty()!=null){
                    actualQtyList.add(one.getActualQty());
                }else {
                    actualQtyList.add(0);
                }
                list.add(o.toString());
            }else {
                planQtyList.add(0);
                actualQtyList.add(0);
            }
            list.add(o.toString());
        }
//        }
        map.put("category",list);
@@ -377,7 +428,7 @@
     */
    @RequestMapping("/downloadExcelTemplate")
    public void downloadExcelTemplate(ModelMap modelMap, HttpServletRequest request,
                          HttpServletResponse response) {
                                      HttpServletResponse response) {
        //初始化表头
        List<ExcelExportEntity> entity = new ArrayList<>();
        entity.add(new ExcelExportEntity("生产工单号", "workOrderNo"));
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/mapper/mapping/ProductionOrdeInfoMapper.xml
@@ -100,8 +100,11 @@
        from om_production_orde_info where 1 = 1
    </select>
    <!--    <select id="lineFinishQty" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">-->
    <!--        SELECT production_line as name,sum(actual_qty)as value  FROM om_production_orde_info GROUP BY production_line-->
    <!--    </select>-->
    <select id="lineFinishQty" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">
        SELECT production_line as name,sum(actual_qty)as value  FROM om_production_orde_info GROUP BY production_line
        SELECT TOP 7 actual_start_time as actualStartTime,actual_qty as actualQty FROM om_production_orde_info WHERE plan_start_time is not null AND actual_qty IS NOT NULL ORDER BY actual_qty DESC
    </select>
    <select id="getOrderWeek" resultType="Map">
@@ -116,9 +119,15 @@
        select SUM(actual_qty) as actualQty FROM om_production_orde_info WHERE CONVERT ( VARCHAR ( 100 ), create_time, 23 ) = #{testdate}
    </select>
    <!--    <select id="getListMonth" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">-->
    <!--        <![CDATA[-->
    <!--        select * from om_production_orde_info where datediff(dd, plan_start_time,getdate())<=6-->
    <!--        ]]>-->
    <!--    </select>-->
    <select id="getListMonth" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">
        <![CDATA[
        select * from om_production_orde_info where datediff(dd, plan_start_time,getdate())<=6
        SELECT TOP 10 * FROM om_production_orde_info ORDER BY actual_start_time DESC
        ]]>
    </select>