From 72a9bc3b1d892e459e083f0ab87d49e54ec6ed70 Mon Sep 17 00:00:00 2001 From: mors <3067699729@qq.com> Date: Fri, 3 Feb 2023 16:53:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B6=E5=8D=95=E7=AE=A1=E7=90=86=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/mixins/JeecgListMixin.js | 2 +- .../src/views/maker/ZyMakerList.vue | 278 ++++++++++-------- .../views/maker/modules/ZyMakerFormDetail.vue | 97 +++--- .../controller/ZyClothsTypeController.java | 1 + .../maker/controller/ZyMakerController.java | 238 ++++++++------- .../jeecg/modules/maker/entity/ZyMaker.java | 7 + .../modules/maker/mapper/ZyMakerMapper.java | 5 + .../maker/service/IZyMakerService.java | 6 + .../service/impl/ZyMakerServiceImpl.java | 92 +++++- 9 files changed, 445 insertions(+), 281 deletions(-) diff --git a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js index 79a3249f..6dee898a 100644 --- a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js +++ b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js @@ -322,7 +322,7 @@ export const JeecgListMixin = { zyStyleFabricHandleAdd: function (id) { this.$refs.modalForm.add(id); this.$refs.modalForm.title = "新增"; - console.log("js层id的传递"+id); + //console.log("js层id的传递"+id); this.$refs.modalForm.disableSubmit = false; }, styleModuleHandleAdd: function (id,typeId,styleNames) { diff --git a/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue b/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue index 5902a2f8..69932155 100644 --- a/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue +++ b/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue @@ -11,25 +11,34 @@
- 新增 + + 制单 导出 - + 导入 - + - 删除 + + + 删除 + - 批量操作 + 批量操作 + +
- 已选择 {{ selectedRowKeys.length }}项 + 已选择 {{ selectedRowKeys.length }}清空
@@ -52,7 +61,8 @@ - 编辑 + - - - 更多 - - - 详情 - - - 二维码 - - - - 删除 - - - - + 详情 + + + 删除 + + + + + + + + + + + + + + + + + + -
@@ -99,106 +113,132 @@ \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/maker/modules/ZyMakerFormDetail.vue b/ant-design-vue-jeecg/src/views/maker/modules/ZyMakerFormDetail.vue index 3a716b67..7e9d1b41 100644 --- a/ant-design-vue-jeecg/src/views/maker/modules/ZyMakerFormDetail.vue +++ b/ant-design-vue-jeecg/src/views/maker/modules/ZyMakerFormDetail.vue @@ -11,17 +11,17 @@ > - - - {{model.code}} - - - {{model.workerCode}} - - - {{model.modelName}} - - + + + {{model.code}} + + + {{model.workerCode}} + + + {{model.modelName}} + + @@ -29,44 +29,43 @@ \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsTypeController.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsTypeController.java index b9c45c65..1f798db9 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsTypeController.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsTypeController.java @@ -237,6 +237,7 @@ public class ZyClothsTypeController extends JeecgController { - @Autowired - private IZyMakerService zyMakerService; - - /** - * 分页列表查询 - * - * @param zyMaker - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "制单管理-分页列表查询") - @ApiOperation(value="制单管理-分页列表查询", notes="制单管理-分页列表查询") - @GetMapping(value = "/list") - public Result queryPageList(ZyMaker zyMaker, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyMaker, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = zyMakerService.page(page, queryWrapper); - return Result.OK(pageList); - } - - /** - * 添加 - * - * @param zyMaker - * @return - */ - @AutoLog(value = "制单管理-添加") - @ApiOperation(value="制单管理-添加", notes="制单管理-添加") - @PostMapping(value = "/add") - public Result add(@RequestBody ZyMaker zyMaker) { - zyMakerService.save(zyMaker); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param zyMaker - * @return - */ - @AutoLog(value = "制单管理-编辑") - @ApiOperation(value="制单管理-编辑", notes="制单管理-编辑") - @PutMapping(value = "/edit") - public Result edit(@RequestBody ZyMaker zyMaker) { - zyMakerService.updateById(zyMaker); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "制单管理-通过id删除") - @ApiOperation(value="制单管理-通过id删除", notes="制单管理-通过id删除") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - zyMakerService.removeById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "制单管理-批量删除") - @ApiOperation(value="制单管理-批量删除", notes="制单管理-批量删除") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.zyMakerService.removeByIds(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @AutoLog(value = "制单管理-通过id查询") - @ApiOperation(value="制单管理-通过id查询", notes="制单管理-通过id查询") - @GetMapping(value = "/queryById") - public Result queryById(@RequestParam(name="id",required=true) String id) { - ZyMaker zyMaker = zyMakerService.getById(id); - if(zyMaker==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(zyMaker); - } + @Autowired + private IZyMakerService zyMakerService; + + /** + * 分页列表查询 + * + * @param zyMaker + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "制单管理-分页列表查询") + @ApiOperation(value = "制单管理-分页列表查询", notes = "制单管理-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(ZyMaker zyMaker, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyMaker, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = zyMakerService.page(page, queryWrapper); + List zyMakerList = zyMakerService.ZyMakerVo(pageList.getRecords()); + pageList.setRecords(zyMakerList); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param zyMaker + * @return + */ + @AutoLog(value = "制单管理-添加") + @ApiOperation(value = "制单管理-添加", notes = "制单管理-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ZyMaker zyMaker) { + zyMakerService.save(zyMaker); + return Result.OK("添加成功!"); + } + + /** + * 制单 + */ + @AutoLog(value = "制单管理-制单") + @ApiOperation(value = "制单管理-制单", notes = "制单管理-制单") + @PostMapping(value = "/listMakerAdd") + public Result listMakerAdd() { + //点击制单 点击后按产品模块分解成制单写入制单表 + zyMakerService.listMakerAdd(); + //zyMakerService.save(zyMaker); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param zyMaker + * @return + */ + @AutoLog(value = "制单管理-编辑") + @ApiOperation(value = "制单管理-编辑", notes = "制单管理-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody ZyMaker zyMaker) { + zyMakerService.updateById(zyMaker); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "制单管理-通过id删除") + @ApiOperation(value = "制单管理-通过id删除", notes = "制单管理-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + zyMakerService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "制单管理-批量删除") + @ApiOperation(value = "制单管理-批量删除", notes = "制单管理-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.zyMakerService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "制单管理-通过id查询") + @ApiOperation(value = "制单管理-通过id查询", notes = "制单管理-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + ZyMaker zyMaker = zyMakerService.getById(id); + if (zyMaker == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyMaker); + } /** - * 导出excel - * - * @param request - * @param zyMaker - */ + * 导出excel + * + * @param request + * @param zyMaker + */ @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, ZyMaker zyMaker) { return super.exportXls(request, zyMaker, ZyMaker.class, "制单管理"); } /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, ZyMaker.class); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java index e6156187..dbf594e7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; import java.util.Date; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -66,6 +67,12 @@ public class ZyMaker implements Serializable { @Excel(name = "工单编号", width = 15) @ApiModelProperty(value = "工单编号") private String workerCode; + /**产品编号*/ + @TableField(exist = false) + private String productCode; + /**产品名称*/ + @TableField(exist = false) + private String productName; /**模块id*/ @Excel(name = "模块id", width = 15) @ApiModelProperty(value = "模块id") diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/mapper/ZyMakerMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/mapper/ZyMakerMapper.java index 01d0e773..1582e764 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/mapper/ZyMakerMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/mapper/ZyMakerMapper.java @@ -3,8 +3,10 @@ package org.jeecg.modules.maker.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.jeecg.modules.maker.entity.ZyMaker; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.workproduct.entity.ZyProduct; /** * @Description: 制单管理 @@ -14,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface ZyMakerMapper extends BaseMapper { + + @Select("select * from zy_product where work_order_id=#{workerCode}") + ZyProduct getProduct(String workerCode); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java index b4d3a93d..36c4c9fd 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java @@ -3,6 +3,8 @@ package org.jeecg.modules.maker.service; import org.jeecg.modules.maker.entity.ZyMaker; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * @Description: 制单管理 * @Author: jeecg-boot @@ -11,4 +13,8 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IZyMakerService extends IService { + //点击制单 点击后按产品模块分解成制单写入制单表 + void listMakerAdd(); + + List ZyMakerVo(List records); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java index 7fd243b7..38479627 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java @@ -1,19 +1,109 @@ package org.jeecg.modules.maker.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.jeecg.modules.maker.entity.ZyMaker; import org.jeecg.modules.maker.mapper.ZyMakerMapper; import org.jeecg.modules.maker.service.IZyMakerService; +import org.jeecg.modules.workorder.entity.WorkOrder; +import org.jeecg.modules.workorder.service.IWorkOrderService; +import org.jeecg.modules.workproduct.entity.ZyProduct; +import org.jeecg.modules.workproduct.service.IZyProductService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * @Description: 制单管理 * @Author: jeecg-boot - * @Date: 2021-11-27 + * @Date: 2021-11-27 * @Version: V1.0 */ @Service public class ZyMakerServiceImpl extends ServiceImpl implements IZyMakerService { + @Autowired + private IWorkOrderService workOrderService; + @Autowired + private IZyProductService productService; + + @Resource + private ZyMakerMapper zyMakerMapper; + + ////点击制单 点击后按产品模块分解成制单写入制单表 + @Override + public void listMakerAdd() { + //先拿到所有产品 产品暂定为服装款式里面的数据 + List workOrderList = workOrderService.list(); + for (WorkOrder workOrder : workOrderList) { + ZyMaker maker = new ZyMaker(); + //制单编号 工单编号(22)+顺序号(2) + maker.setCode(getMakerCode(workOrder.getProductCode())); + //工单编号 + maker.setWorkerCode(workOrder.getProductCode()); + this.save(maker); + } + + } + + @Override + public List ZyMakerVo(List records) { + if (ObjectUtils.isEmpty(records)) { + return null; + } + //根据工单编号找到产品编号 产品名称 + for (ZyMaker maker : records) { + ZyProduct zyProductMapper = zyMakerMapper.getProduct(maker.getWorkerCode()); +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.eq(ZyProduct::getWorkOrderId, maker.getWorkerCode()); +// ZyProduct zyProduct = productService.getOne(queryWrapper); + //产品编号 + if (!ObjectUtils.isEmpty(zyProductMapper)){ + if (StringUtils.hasText(zyProductMapper.getProductCode())) { + maker.setProductCode(zyProductMapper.getProductCode()); + } + if (StringUtils.hasText(zyProductMapper.getProductName())) { + maker.setProductName(zyProductMapper.getProductName()); + } + } + + //产品名称 + + } + return records; + } + + private String getMakerCode(String productCode) { + if (StringUtils.isEmpty(productCode)) { + return "null"; + } + List zyMakerList = this.list(); + List collect = zyMakerList.stream().map(ZyMaker::getCode).collect(Collectors.toList()); + List longList = new ArrayList<>(); + for (String makerCode : collect) { + String newNums = makerCode.trim(); + if (StringUtils.isEmpty(newNums)) continue; + if (newNums.length() <= 2) longList.add(Long.valueOf(newNums)); + else { + //拿到后6位 substring(4) 截掉前4位 + String substring = newNums.substring(newNums.length() - 2); + longList.add(Long.valueOf(substring)); + } + } + long max = Collections.max(longList) + 1; + if (Long.toString(max).length() > 2) { + String toString = Long.toString(max); + return toString.substring(toString.length() - 2); + } + return String.format("%02d", max); + } }