diff --git a/src/main/java/com/pro/bus/controller/PrintController.java b/src/main/java/com/pro/bus/controller/PrintController.java new file mode 100644 index 0000000000000000000000000000000000000000..b59b67d3e95d533129463fd13028dfe4475aedae --- /dev/null +++ b/src/main/java/com/pro/bus/controller/PrintController.java @@ -0,0 +1,74 @@ +package com.pro.bus.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.pro.bus.entity.Process; +import com.pro.bus.service.PrintService; +import com.pro.sys.entity.Result; +import com.pro.utils.Utils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping("/bus") +public class PrintController { + + @Autowired + private PrintService printService; + + /*** + * 去印花页面 + * @return + */ + @RequiresPermissions("/bus/print") + @RequestMapping("print") + public String toprint(@RequestHeader(value="Via",required=false) String via , @RequestHeader("user-agent") String userAgent) {//返回值为视图名称(不一定直接对应路径)){ + boolean is = Utils.isMobileDevice(via, userAgent); + if(is) { + return "mobile/print"; + } + return "bus/print"; + } + + /*** + * 获取印花信息 + * @param page + * @param limit + * @param process + * @return + */ + @RequiresPermissions("/bus/print") + @RequestMapping(value = "getPrint", method = RequestMethod.GET) + @ResponseBody + public Map getPrint(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "limit") Integer limit, Process process) { + PageHelper.startPage(page, limit); + List processes = printService.getPrint(process); + Map map = new HashMap(); + PageInfo pageInfo = new PageInfo(processes); + map.put("code", 0); + map.put("data", pageInfo.getList()); + map.put("count", pageInfo.getTotal()); + map.put("msg", ""); + return map; + } + + /** + * 确认印花 + * @param process_id + * @param print_num + * @return + */ + @RequiresPermissions("/bus/print") + @RequestMapping(value = "cfmPrint/{process_id}/{print_num}", + method = RequestMethod.PUT) + @ResponseBody + public Result cfmPrint(@PathVariable("process_id") Integer process_id, @PathVariable("print_num")Double print_num) { + return printService.cfmPrint(process_id, print_num); + } +} diff --git a/src/main/java/com/pro/bus/mapper/PrintMapper.java b/src/main/java/com/pro/bus/mapper/PrintMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..81b4b3d609c7cfd2b73c79b1a23b0034a991ca89 --- /dev/null +++ b/src/main/java/com/pro/bus/mapper/PrintMapper.java @@ -0,0 +1,30 @@ +package com.pro.bus.mapper; + +import com.pro.bus.entity.Process; +import org.apache.ibatis.annotations.Param; +import org.mybatis.spring.annotation.MapperScan; + +import java.util.List; + +@MapperScan +public interface PrintMapper { + /** + * 获取印花信息 + * @return + */ + List getPrint(); + + /** + * 确认印花 + * @param process_id + * @param print_person + * @return + */ + int cfmPrint(@Param("process_id")Integer process_id, @Param("print_person")String print_person, @Param("print_num")Double print_num); + + /** + * 获取手机印花信息 + * @return + */ + List getMPrint(Process process); +} diff --git a/src/main/java/com/pro/bus/service/PrintService.java b/src/main/java/com/pro/bus/service/PrintService.java new file mode 100644 index 0000000000000000000000000000000000000000..39635bd11e5209aef8d42b7e40bf19e03276921f --- /dev/null +++ b/src/main/java/com/pro/bus/service/PrintService.java @@ -0,0 +1,30 @@ +package com.pro.bus.service; + +import com.pro.bus.entity.Process; +import com.pro.sys.entity.Result; + +import java.util.List; + +public interface PrintService { + /** + * 获取印花信息 + * @param process + * @return + */ + List getPrint(Process process); + + /** + * 确认印花 + * @param process_id + * @param print_num + * @return + */ + Result cfmPrint(Integer process_id, Double print_num); + + /** + * 获取手机印花数据 + * @param process + * @return + */ + List getMPrint(Process process); +} diff --git a/src/main/java/com/pro/bus/service/impl/PrintServiceImpl.java b/src/main/java/com/pro/bus/service/impl/PrintServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..13cb85e5f8dc80a598cd146206e5fbf837f3c567 --- /dev/null +++ b/src/main/java/com/pro/bus/service/impl/PrintServiceImpl.java @@ -0,0 +1,54 @@ +package com.pro.bus.service.impl; + +import com.pro.bus.entity.Process; +import com.pro.bus.mapper.PrintMapper; +import com.pro.bus.service.PrintService; +import com.pro.sys.entity.Result; +import com.pro.sys.entity.User; +import org.apache.shiro.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PrintServiceImpl implements PrintService { + + @Autowired + private PrintMapper printMapper; + + /** + * 获取印花信息 + * @param process + * @return + */ + @Override + public List getPrint(Process process) { + return printMapper.getPrint(); + } + + /** + * 确认印花 + * @param process_id + * @return + */ + @Override + public Result cfmPrint(Integer process_id,Double print_num) { + String print_person = ((User)SecurityUtils.getSubject().getPrincipal()).getU_name(); + System.out.println(process_id+"---"+print_person); + if(printMapper.cfmPrint(process_id,print_person,print_num) > 0){ + return Result.successResult("印花成功"); + } + return Result.failResult("印花失败"); + } + + /** + * 获取手机印花数据 + * @param process + * @return + */ + @Override + public List getMPrint(Process process) { + return printMapper.getMPrint(process); + } +} diff --git a/src/main/java/com/pro/mobile/controller/MobilePrintController.java b/src/main/java/com/pro/mobile/controller/MobilePrintController.java new file mode 100644 index 0000000000000000000000000000000000000000..87c87fc4c79d28fa81d37c541ccb841dea7fc2c2 --- /dev/null +++ b/src/main/java/com/pro/mobile/controller/MobilePrintController.java @@ -0,0 +1,47 @@ +package com.pro.mobile.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.pro.bus.entity.Process; +import com.pro.bus.service.PrintService; +import com.pro.sys.entity.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Controller +@RequestMapping("/bus") +public class MobilePrintController { + @Autowired + private PrintService printService; + + /** + * 获得分页后的印花数据 + * @param page + * @param rows + * @return + */ + @RequestMapping(value = "m_print", + method = RequestMethod.GET) + @ResponseBody + public PageInfo getMprint(Process process, Integer page, Integer rows) { + System.out.println("-------"+process+"---"+page+"---"+rows); + PageHelper.startPage(page, rows); + List list = printService.getMPrint(process); + return new PageInfo(list); + } + + /** + * 手机确认印花 + * @param process + * @return + */ + @RequestMapping(value = "cfmprint", + method = RequestMethod.PUT) + @ResponseBody + public Result cfmprint(@RequestBody Process process) { + return printService.cfmPrint(process.getProcess_id(),process.getPrint_num()); + } +} diff --git a/src/main/resources/mapper/bus/PrintMapper.xml b/src/main/resources/mapper/bus/PrintMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..ce27426da2536ea5579887ec956ffea1c909c2f3 --- /dev/null +++ b/src/main/resources/mapper/bus/PrintMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + bus_process.process_id, + bus_process.plan_id, + bus_process.process_cus, + bus_process.process_std, + bus_process.process_color, + bus_process.group_num, + bus_process.group_date, + bus_process.group_person, + bus_process.pretreat_num, + bus_process.pretreat_date, + bus_process.pretreat_person, + bus_process.dye_num, + bus_process.dye_date, + bus_process.dye_person, + bus_process.print_num, + bus_process.print_date, + bus_process.print_person, + bus_process.arrange_num, + bus_process.arrange_date, + bus_process.arrange_person, + bus_process.check_num, + bus_process.check_date, + bus_process.check_person, + bus_process.process_status + + + + + + UPDATE bus_process + SET + print_num = #{print_num}, + print_date = DATE(NOW()), + print_person = #{print_person}, + process_status = '20' + WHERE + process_id = #{process_id} + + \ No newline at end of file diff --git a/src/main/resources/mapper/bus/ProcessMapper.xml b/src/main/resources/mapper/bus/ProcessMapper.xml index 4e904708a881e741e3bb6e1e881fee2cb4e45925..53a9601d00fb9b5388ba8640e0053fd81dfacda1 100644 --- a/src/main/resources/mapper/bus/ProcessMapper.xml +++ b/src/main/resources/mapper/bus/ProcessMapper.xml @@ -8,6 +8,7 @@ info_color.co_name, info_customer.cus_name, bus_plan.plan_id, + bus_plan.plan_type, bus_plan.plan_num, bus_plan.plan_num-(SELECT IFNULL(SUM(group_num),0) FROM bus_process WHERE bus_process.plan_id=bus_plan.plan_id) rest_num FROM diff --git a/src/main/web/WEB-INF/views/bus/print.jsp b/src/main/web/WEB-INF/views/bus/print.jsp new file mode 100644 index 0000000000000000000000000000000000000000..10a71eccee7f07090f7ed565afebd7453edfc1eb --- /dev/null +++ b/src/main/web/WEB-INF/views/bus/print.jsp @@ -0,0 +1,191 @@ +<%-- + Created by IntelliJ IDEA. + User: lenovo + Date: 2018/8/17 + Time: 10:09 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 印花 + + + + + +
+
+ +
+ +
+ +
+ + +
+
+
+ + + + + + + + + + + + + + + diff --git a/src/main/web/WEB-INF/views/bus/process.jsp b/src/main/web/WEB-INF/views/bus/process.jsp index 8b4479cfef40f4addf311d774f040189f06aa54f..199e97783e517bf3bf209f0615bde803346ad24a 100644 --- a/src/main/web/WEB-INF/views/bus/process.jsp +++ b/src/main/web/WEB-INF/views/bus/process.jsp @@ -63,6 +63,7 @@ + @@ -73,6 +74,12 @@ + diff --git a/src/main/web/WEB-INF/views/mobile/print.jsp b/src/main/web/WEB-INF/views/mobile/print.jsp new file mode 100644 index 0000000000000000000000000000000000000000..c22cfc6ad393def40ef09e6a666499561ac69c46 --- /dev/null +++ b/src/main/web/WEB-INF/views/mobile/print.jsp @@ -0,0 +1,351 @@ +<%-- + Created by IntelliJ IDEA. + User: lenovo + Date: 2018/8/17 + Time: 15:49 + To change this template use File | Settings | File Templates. +--%> +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + + 生产过程云信息系统-主页 + + + + + + + + + + + + +
计划编号计划类型 客户名称 规格名称 花色名称
${plan.plan_id} + 白布产品 + 染色产品 + 无底色印花 + 有底色印花 + ${plan.cus_name} ${plan.standard_name} ${plan.co_name}