| | |
| | | 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.*; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | |
| | | */ |
| | | @RequestMapping("/downloadExcelTemplate") |
| | | public void downloadExcelTemplate(ModelMap modelMap, HttpServletRequest request, |
| | | HttpServletResponse response) { |
| | | HttpServletResponse response) { |
| | | //初始化表头 |
| | | List<ExcelExportEntity> entity = new ArrayList<>(); |
| | | entity.add(new ExcelExportEntity("生产工单号", "workOrderNo")); |