| | |
| | | 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.model.result.PassingStationCollectionResult; |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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.*; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | |
| | | public ResponseData editItem(ProductionOrdeInfoParam productionOrdeInfoParam) { |
| | | if(productionOrdeInfoParam.getFlag()!=null){ |
| | | productionOrdeInfoParam.setActualStartTime(new Date()); |
| | | } |
| | | } |
| | | this.productionOrdeInfoService.update(productionOrdeInfoParam); |
| | | this.productionOrdeInfoService.saveOrderBatchInfo(productionOrdeInfoParam); |
| | | return ResponseData.success(); |
| | |
| | | @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | @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(); |
| | | //完成 |
| | |
| | | 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); |
| | | } |
| | |
| | | @CrossOrigin |
| | | @RequestMapping("/lineChart") |
| | | public ResponseData lineChart(ProductionOrdeInfoParam productionOrdeInfoParam) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<String> list = new ArrayList(); |
| | | List<Integer> planQtyList = new ArrayList(); |
| | | List<Integer> actualQtyList = new ArrayList(); |
| | | 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); |
| | | } |
| | | List<ProductionOrdeInfoResult> ColumnarDateList = productionOrdeInfoService.getColumnarDate(); |
| | | for (ProductionOrdeInfoResult result : ColumnarDateList) { |
| | | String s = format.format(result.getActualStartTime()); |
| | | QueryWrapper<ProductionOrdeInfo> queryWrapper = new QueryWrapper<ProductionOrdeInfo>(); |
| | | queryWrapper.select("SUM(plan_qty) as planQty,SUM(actual_qty) as actualQty"); |
| | | queryWrapper.apply("CONVERT ( VARCHAR ( 100 ), actual_start_time, 23 ) = {0}",s); |
| | | 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(s); |
| | | } |
| | | |
| | | // } |
| | | map.put("category",list); |
| | | map.put("lineData",planQtyList); |
| | | map.put("barData",actualQtyList); |
| | | return ResponseData.success(map); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // List<String> weeks = getFormatDate("month"); |
| | | // System.out.println(JSONObject.toJSONString(weeks)); |
| | | // for (int i = 0; i < 7; i++) { |
| | | // System.out.println(LocalDate.now().minusDays(i)); |
| | | // } |
| | | System.out.println(getWeek()); |
| | | |
| | | @ResponseBody |
| | | @CrossOrigin |
| | | @RequestMapping("/findOrdrList") |
| | | public ResponseData findOrdrList(ProductionOrdeInfoParam productionOrdeInfoParam) { |
| | | ProductionOrdeInfoParam param = new ProductionOrdeInfoParam(); |
| | | param.setProductionLine("");//产线 |
| | | param.setOrderStatus("3");//工单状态 |
| | | List<ProductionOrdeInfoResult> list = productionOrdeInfoService.findListBySpec(param); |
| | | return ResponseData.success(list); |
| | | } |
| | | public static List getWeek(){ |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(LocalDate.now().minusDays(6).toString()); |
| | | list.add(LocalDate.now().minusDays(5).toString()); |
| | | list.add(LocalDate.now().minusDays(4).toString()); |
| | | list.add(LocalDate.now().minusDays(3).toString()); |
| | | list.add(LocalDate.now().minusDays(2).toString()); |
| | | list.add(LocalDate.now().minusDays(1).toString()); |
| | | list.add(LocalDate.now().minusDays(0).toString()); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下载excel导入模板 |
| | |
| | | */ |
| | | @RequestMapping("/downloadExcelTemplate") |
| | | public void downloadExcelTemplate(ModelMap modelMap, HttpServletRequest request, |
| | | HttpServletResponse response) { |
| | | HttpServletResponse response) { |
| | | //初始化表头 |
| | | List<ExcelExportEntity> entity = new ArrayList<>(); |
| | | entity.add(new ExcelExportEntity("生产工单号", "workOrderNo")); |
| | |
| | | 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(); |
| | | List percentageList = new ArrayList(); |
| | | percentageList.add(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); |
| | | } |
| | | List<PassingStationCollectionResult> resultList = passingStationCollectionService.centerLeftData(productionOrdeInfoParam.getWorkOrderNo()); |
| | | int unQuantity = passingStationCollectionService.getUnqualifiedQuantity(productionOrdeInfoParam.getWorkOrderNo()); |
| | | int variableInt = 0; |
| | | if(unQuantity == 0){ |
| | | map.put("category",getLocationList()); |
| | | map.put("barData",getZeroList()); |
| | | map.put("percentage",getPercentageList()); |
| | | |
| | | }else { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | categoryList.add(resultList.get(i).getLocationCode()); |
| | | barDataList.add(resultList.get(i).getNum()); |
| | | variableInt+=Integer.valueOf(resultList.get(i).getNum()); |
| | | percentageList.add(Math.round((float) variableInt / unQuantity * 100)); |
| | | } |
| | | map.put("category",categoryList); |
| | | map.put("barData",barDataList); |
| | | map.put("lineData",lineDataList); |
| | | map.put("percentage",percentageList); |
| | | } |
| | | return ResponseData.success(map); |
| | | // 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()) |
| | | ); |
| | | List<PassingStationCollection> list1 = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>() |
| | | .eq("location_code", o) |
| | | .eq("work_order_no",result.getWorkOrderNo()) |
| | | ); |
| | | Integer unqualified = list.size(); |
| | | Integer qualified = list1.size()-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> getZeroList(){ |
| | | List<String> locationList = new ArrayList<>(); |
| | | locationList.add("0"); |
| | | locationList.add("0"); |
| | | locationList.add("0"); |
| | | locationList.add("0"); |
| | | locationList.add("0"); |
| | | locationList.add("0"); |
| | | return locationList; |
| | | } |
| | | |
| | | public static List<String> getPercentageList(){ |
| | | List<String> locationList = new ArrayList<>(); |
| | | locationList.add("100"); |
| | | locationList.add("100"); |
| | | locationList.add("100"); |
| | | locationList.add("100"); |
| | | locationList.add("100"); |
| | | locationList.add("100"); |
| | | 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>"; |
| | | } |
| | | |
| | | } |
| | | |
| | | |