From f40a4112c4698855e25ceb51207f39221a42bd1a Mon Sep 17 00:00:00 2001 From: mors <3067699729@qq.com> Date: Sat, 3 Dec 2022 17:26:06 +0800 Subject: [PATCH] =?UTF-8?q?2022-12-03=20=E8=B5=B5=E7=8E=89=E7=91=9E=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/process/ZyClothsComponentList.vue | 12 ++++-- .../src/views/process/ZyClothsModularList.vue | 2 +- .../process/modules/ZyClothsComponentForm.vue | 35 ++++++++++------ .../process/modules/ZyClothsModularForm.vue | 10 +++-- .../modules/ZyClothsStyleForm.vue | 4 +- .../zystylemodular/modules/ZyProcessList.vue | 3 +- .../modules/ZyStyleModularModal.vue | 3 +- .../zyStyleModular/entity/ZyStyleModular.java | 2 +- .../ZyClothsComponentController.java | 11 +++++ .../controller/ZyClothsModularController.java | 8 ++++ .../demo/base/entity/ZyClothsComponent.java | 6 +++ .../modules/demo/base/entity/ZyProcess.java | 2 +- .../base/mapper/ZyClothsComponentMapper.java | 2 + .../mapper/xml/ZyClothsComponentMapper.xml | 4 ++ .../service/IZyClothsComponentService.java | 3 ++ .../impl/ZyClothsComponentServiceImpl.java | 41 ++++++++++++++++++- .../demo/pro/entity/ZyProcessComponent.java | 2 +- .../entity/ZyProcessModular.java | 2 +- 18 files changed, 119 insertions(+), 33 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/process/ZyClothsComponentList.vue b/ant-design-vue-jeecg/src/views/process/ZyClothsComponentList.vue index b4af96cb..61d22267 100644 --- a/ant-design-vue-jeecg/src/views/process/ZyClothsComponentList.vue +++ b/ant-design-vue-jeecg/src/views/process/ZyClothsComponentList.vue @@ -145,12 +145,16 @@ align:"center", dataIndex: 'partsName' }, + // { + // title:'部件类型', + // align:"center", + // dataIndex: 'componentType' + // }, { - title:'部件类型', - align:"center", - dataIndex: 'componentType' + title: '服装类型', + align: "center", + dataIndex: 'clothsTypeId_dictText' }, - // { // title:'描述', // align:"center", diff --git a/ant-design-vue-jeecg/src/views/process/ZyClothsModularList.vue b/ant-design-vue-jeecg/src/views/process/ZyClothsModularList.vue index c086a43e..9c5815bc 100644 --- a/ant-design-vue-jeecg/src/views/process/ZyClothsModularList.vue +++ b/ant-design-vue-jeecg/src/views/process/ZyClothsModularList.vue @@ -173,7 +173,7 @@ export default { // dataIndex: 'description' // }, { - title: '衣服类型', + title: '服装类型', align: "center", dataIndex: 'clothsTypeId_dictText' }, diff --git a/ant-design-vue-jeecg/src/views/process/modules/ZyClothsComponentForm.vue b/ant-design-vue-jeecg/src/views/process/modules/ZyClothsComponentForm.vue index 7d61698f..75dee5ff 100644 --- a/ant-design-vue-jeecg/src/views/process/modules/ZyClothsComponentForm.vue +++ b/ant-design-vue-jeecg/src/views/process/modules/ZyClothsComponentForm.vue @@ -8,21 +8,31 @@ + + + + + - - + + - - + + - - + + + + + + + @@ -33,11 +43,7 @@ - - - - - + @@ -86,8 +92,11 @@ }, confirmLoading: false, validatorRules: { - nums: [ - { required: true, message: '请输入编号!'}, + // nums: [ + // { required: true, message: '请输入编号!'}, + // ], + clothsTypeId: [ + { required: true, message: '请选择服装类型!'}, ], partsName: [ { required: true, message: '请输入部件名称!'}, diff --git a/ant-design-vue-jeecg/src/views/process/modules/ZyClothsModularForm.vue b/ant-design-vue-jeecg/src/views/process/modules/ZyClothsModularForm.vue index 09468606..05ec500c 100644 --- a/ant-design-vue-jeecg/src/views/process/modules/ZyClothsModularForm.vue +++ b/ant-design-vue-jeecg/src/views/process/modules/ZyClothsModularForm.vue @@ -13,6 +13,7 @@ + @@ -23,14 +24,15 @@ + - - + + - - + + diff --git a/ant-design-vue-jeecg/src/views/zyclothsstyle/modules/ZyClothsStyleForm.vue b/ant-design-vue-jeecg/src/views/zyclothsstyle/modules/ZyClothsStyleForm.vue index 06fa526c..9863cc3b 100644 --- a/ant-design-vue-jeecg/src/views/zyclothsstyle/modules/ZyClothsStyleForm.vue +++ b/ant-design-vue-jeecg/src/views/zyclothsstyle/modules/ZyClothsStyleForm.vue @@ -34,8 +34,8 @@ - - + + diff --git a/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyProcessList.vue b/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyProcessList.vue index 535e9ec7..b702ae1d 100644 --- a/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyProcessList.vue +++ b/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyProcessList.vue @@ -3,6 +3,7 @@
+
@@ -160,7 +161,7 @@ export default { }, //加载传递参数 loadParameter() { - if (this.loadRouteType == false) { + if (this.loadRouteType === false) { this.styleId = this.$route.query.styleId; console.log(this.styleId) this.loadRouteType = true; diff --git a/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyStyleModularModal.vue b/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyStyleModularModal.vue index bee39186..a7ec8596 100644 --- a/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyStyleModularModal.vue +++ b/ant-design-vue-jeecg/src/views/zystylemodular/modules/ZyStyleModularModal.vue @@ -19,7 +19,6 @@ name: 'ZyStyleModularModal', components: { ZyProcessList, - }, data () { return { @@ -40,7 +39,7 @@ }, methods: { add () { - this.model.styleId=this.$route.query.id; + this.model.styleId=this.$route.query.id; this.visible=true this.$nextTick(()=>{ this.$refs.realForm.add(); diff --git a/jeecg-boot/jeecg-boot-module-erp/src/main/java/org/jeecg/modules/demo/zyStyleModular/entity/ZyStyleModular.java b/jeecg-boot/jeecg-boot-module-erp/src/main/java/org/jeecg/modules/demo/zyStyleModular/entity/ZyStyleModular.java index 0444a4d0..f697df02 100644 --- a/jeecg-boot/jeecg-boot-module-erp/src/main/java/org/jeecg/modules/demo/zyStyleModular/entity/ZyStyleModular.java +++ b/jeecg-boot/jeecg-boot-module-erp/src/main/java/org/jeecg/modules/demo/zyStyleModular/entity/ZyStyleModular.java @@ -68,5 +68,5 @@ public class ZyStyleModular implements Serializable { /**序号*/ @Excel(name = "序号", width = 15,dicCode = "序号") @ApiModelProperty(value = "序号") - private Integer order; + private Integer serialnumber; } diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsComponentController.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsComponentController.java index b6a5890e..8b9950ba 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsComponentController.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsComponentController.java @@ -1,5 +1,6 @@ package org.jeecg.modules.demo.base.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -88,6 +89,16 @@ public class ZyClothsComponentController extends JeecgController add(@RequestBody ZyClothsComponent zyClothsComponent) { + //编码规则:服装类型(10)+序号(8) + zyClothsComponent.setNums(zyClothsComponentService.generateNumber(zyClothsComponent)); + //部件名称不能重复 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + List zyClothsComponentList = zyClothsComponentService.list(queryWrapper); + for (ZyClothsComponent zy : zyClothsComponentList) { + if (zyClothsComponent.getPartsName().equals(zy.getPartsName())){ + return Result.error("添加失败!数据已存在"); + } + } zyClothsComponentService.save(zyClothsComponent); return Result.OK("添加成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsModularController.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsModularController.java index 51098213..bcec6b5d 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsModularController.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsModularController.java @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.base.entity.ZyClothsComponent; import org.jeecg.modules.demo.base.entity.ZyClothsModular; import org.jeecg.modules.demo.base.entity.ZyClothsType; import org.jeecg.modules.demo.base.service.IZyClothsModularService; @@ -105,6 +106,13 @@ public class ZyClothsModularController extends JeecgController add(@RequestBody ZyClothsModular zyClothsModular) { //nums,编号,varchar,18,非空,不重复,编码规则:服装类型(10)+序号(8) zyClothsModular.setNums(zyClothsModularService.generateNumber(zyClothsModular)); + //模块名称不能重复 + List zyClothsModularList = zyClothsModularService.list(); + for (ZyClothsModular zy : zyClothsModularList) { + if (zyClothsModular.getModularName().equals(zy.getModularName())){ + return Result.error("添加失败!模块名称已存在"); + } + } zyClothsModularService.save(zyClothsModular); return Result.OK("添加成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyClothsComponent.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyClothsComponent.java index 7448ca16..64c98d96 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyClothsComponent.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyClothsComponent.java @@ -52,6 +52,12 @@ public class ZyClothsComponent implements Serializable { @Excel(name = "图片地址", width = 15) @ApiModelProperty(value = "图片地址") private java.lang.String pictureUrl; + /**服装类型id*/ + @Excel(name = "服装类型id", width = 15, dictTable = "zy_cloths_type", dicText = "type_name", dicCode = "id") + @Dict(dictTable = "zy_cloths_type", dicText = "type_name", dicCode = "id") + @ApiModelProperty(value = "服装类型id") + private java.lang.String clothsTypeId; + /**模块*/ @Excel(name = "模块", width = 15, dictTable = "zy_cloths_modular", dicText = "modular_name", dicCode = "id") @Dict(dictTable = "zy_cloths_modular", dicText = "modular_name", dicCode = "id") diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyProcess.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyProcess.java index 4595a4d8..96c3b8fe 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyProcess.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/entity/ZyProcess.java @@ -179,7 +179,7 @@ public class ZyProcess implements Serializable { */ @Excel(name = "类型名称", width = 15) @ApiModelProperty(value = "类型名称") - @Dict(dictTable = "zy_cloths_type", dicText = "zy_cloths_type", dicCode = "nums") + @Dict(dictTable = "zy_cloths_type", dicText = "type_name", dicCode = "nums") private java.lang.String styleId; /** * 工段代码 diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/ZyClothsComponentMapper.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/ZyClothsComponentMapper.java index febcf394..c65c3a5d 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/ZyClothsComponentMapper.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/ZyClothsComponentMapper.java @@ -22,4 +22,6 @@ public interface ZyClothsComponentMapper extends BaseMapper { public List selectByModular(@Param("modular_id")String modular_id); String getComponentNameById(String componentId); + + List selectNumsList2(); } diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/xml/ZyClothsComponentMapper.xml b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/xml/ZyClothsComponentMapper.xml index 00fd10ba..bf05980e 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/xml/ZyClothsComponentMapper.xml +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/xml/ZyClothsComponentMapper.xml @@ -29,4 +29,8 @@ from zy_cloths_component where id = #{componentId} + diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/IZyClothsComponentService.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/IZyClothsComponentService.java index 7f30145b..d5a0ea36 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/IZyClothsComponentService.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/IZyClothsComponentService.java @@ -18,4 +18,7 @@ public interface IZyClothsComponentService extends IService { List selectList(String id); public List selectByModular(String modular_id); + + /**编码规则:服装类型(10)+序号(8)*/ + String generateNumber(ZyClothsComponent zyClothsComponent); } diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/impl/ZyClothsComponentServiceImpl.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/impl/ZyClothsComponentServiceImpl.java index 8b16bb79..ada0a13d 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/impl/ZyClothsComponentServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/impl/ZyClothsComponentServiceImpl.java @@ -10,8 +10,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +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; /** * @Description: zy_cloths_component @@ -21,7 +26,7 @@ import java.util.List; */ @Service public class ZyClothsComponentServiceImpl extends ServiceImpl implements IZyClothsComponentService { - @Autowired + @Resource private ZyClothsComponentMapper zyClothsComponentMapper; @Override @@ -30,9 +35,41 @@ public class ZyClothsComponentServiceImpl extends ServiceImpl zyProcessVoList=baseMapper.selectProcessVo(list); return zyProcessVoList; } - + @Override public List selectByModular(String modular_id) { return zyClothsComponentMapper.selectByModular(modular_id); } + + /** + * 编码规则:服装类型(10)+序号(8) + */ + @Override + public String generateNumber(ZyClothsComponent zyClothsComponent) { + String nums = zyClothsComponent.getClothsTypeId(); + String substring = nums.substring(nums.length() - 10); + String format = String.format("%08d", orderNumber()); + return substring + format; + } + + private Long orderNumber() { + List listString = zyClothsComponentMapper.selectNumsList2(); + //System.err.println(listString); + List listLong = new ArrayList<>(); + for (String nums : listString) { + String REGEX = "[^0-9]"; + String newNums = Pattern.compile(REGEX).matcher(nums).replaceAll("").trim(); + if (!StringUtils.hasText(newNums)){ + newNums = "0"; + } + if (newNums.length() > 8) { + String substring = nums.substring(nums.length() - 8); + listLong.add(Long.valueOf(substring)); + }else { + listLong.add(Long.valueOf(newNums)); + } + } + System.out.println(listLong); + return Collections.max(listLong)+1; + } } diff --git a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/pro/entity/ZyProcessComponent.java b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/pro/entity/ZyProcessComponent.java index 370dd852..32b73cd5 100644 --- a/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/pro/entity/ZyProcessComponent.java +++ b/jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/pro/entity/ZyProcessComponent.java @@ -52,7 +52,7 @@ public class ZyProcessComponent implements Serializable { /**序号*/ @Excel(name = "序号", width = 15,dicCode = "序号") @ApiModelProperty(value = "序号") - private Integer order; + private Integer serialnumber; /**创建时间*/ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zyProcessModular/entity/ZyProcessModular.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zyProcessModular/entity/ZyProcessModular.java index 57e83acc..c24f3d21 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zyProcessModular/entity/ZyProcessModular.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zyProcessModular/entity/ZyProcessModular.java @@ -65,5 +65,5 @@ public class ZyProcessModular implements Serializable { /**序号*/ @Excel(name = "序号", width = 15,dicCode = "序号") @ApiModelProperty(value = "序号") - private Integer order; + private Integer serialnumber; }