From 14a8105eaff70aadbc02e7d34fe88ed187c1e70e Mon Sep 17 00:00:00 2001 From: Gitea Date: Fri, 16 Dec 2022 16:59:57 +0800 Subject: [PATCH] 2022-12-16 --- .../src/views/zygoods/modules/ZyGoodsForm.vue | 87 +++++++++++++------ .../zygoods/controller/ZyGoodsController.java | 35 ++++++++ .../zystylemodel/entity/ZyStyleModel.java | 2 +- 3 files changed, 97 insertions(+), 27 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/zygoods/modules/ZyGoodsForm.vue b/ant-design-vue-jeecg/src/views/zygoods/modules/ZyGoodsForm.vue index 84232a6e..ba512797 100644 --- a/ant-design-vue-jeecg/src/views/zygoods/modules/ZyGoodsForm.vue +++ b/ant-design-vue-jeecg/src/views/zygoods/modules/ZyGoodsForm.vue @@ -3,9 +3,29 @@ + + + + + + + + + + + + + + + + + + + + - + @@ -38,21 +58,6 @@ - - - - - - - - - - - - - - - @@ -64,17 +69,17 @@ - + - + - + @@ -93,11 +98,7 @@ - - - - - + @@ -123,6 +124,9 @@ }, data () { return { + lx:'zy_cloths_type ,type_name,id', + ks:'zy_cloths_style,style_names,id', + xh:'zy_style_model,model_number,id', model:{ customized:0, recommend:0, @@ -138,15 +142,24 @@ }, confirmLoading: false, validatorRules: { + enterprisesId:[{ + required: true, message: '请选择企业!' + }], + modelId:[{ + required: true, message: '请选择型号!' + }], goodsCode: [ { required: true, message: '请输入商品编号!'}, ], styleId: [ { required: true, message: '请选择款式!'}, ], + clothsTypeId:[{ + required: true, message: '请选择类型!' + }], number: [ { required: false}, - { pattern: /^-?\d+$/, message: '请输入整数!'}, + { pattern: /^[+]{0,1}(\d+)$/, message: '包装个数必须大于等于0!'}, ], unitPrice: [ { required: false}, @@ -164,7 +177,8 @@ url: { add: "/zygoods/zyGoods/add", edit: "/zygoods/zyGoods/edit", - queryById: "/zygoods/zyGoods/queryById" + queryById: "/zygoods/zyGoods/queryById", + zy:"/zygoods/zyGoods/getspbh" } } }, @@ -178,6 +192,27 @@ this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { + getlx(){ + this.lx ="zy_cloths_type ,type_name,id,enterprise_id='" + this.model.enterprisesId + "'"; + }, + getks(){ + this.ks ="zy_cloths_style,style_names,id,type_id='" + this.model.clothsTypeId + "'"; + }, + getxh(){ + this.xh ="zy_style_model,model_number,id,style_id='" + this.model.styleId + "'"; + }, + getspbh(){ + getAction(this.url.zy, {lxid:this.model.clothsTypeId,xhid:this.model.modelId}).then((res) => { + if (res.success) { + // console.log(res.result.nums) + // this.$forceUpdate(); + //写一个接口返回一个拼装好的商品编号 + this.$set(this.model,'goodsCode',res.result); + } else { + + } + }); + }, add () { this.edit(this.modelDefault); }, diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/controller/ZyGoodsController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/controller/ZyGoodsController.java index 53493ae2..6cc69625 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/controller/ZyGoodsController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/controller/ZyGoodsController.java @@ -12,7 +12,9 @@ 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.ZyClothsType; import org.jeecg.modules.demo.base.service.IZyClothsModularService; +import org.jeecg.modules.demo.base.service.IZyClothsTypeService; import org.jeecg.modules.demo.goodsmodule.entity.GoodsModule; import org.jeecg.modules.demo.goodsmodule.service.IGoodsModuleService; import org.jeecg.modules.demo.zygoods.entity.ZyGoods; @@ -65,6 +67,10 @@ public class ZyGoodsController extends JeecgController private IZyClothsModularService zyClothsModularService; @Autowired private IZyClothsStyleService zyClothsStyleService; + @Autowired + private IZyStyleModelService zyStyleModelService; + @Autowired + private IZyClothsTypeService zyClothsTypeService; /** * 分页列表查询 @@ -204,6 +210,35 @@ public class ZyGoodsController extends JeecgController return Result.OK(zyGoods); } + /** + * 动态获取商品编码 + * + * @param + * @return + */ + @AutoLog(value = "商品表-通过id查询") + @ApiOperation(value="商品表-通过id查询", notes="商品表-通过id查询") + @GetMapping(value = "/getspbh") + public Result getspbh(@RequestParam(name="lxid",required=true) String lxid,@RequestParam(name="xhid",required=true) String xhid,HttpServletRequest req) { + String spbh = ""; + ZyClothsType zyClothsType = zyClothsTypeService.getById(lxid); + //服装类型编号 + String lxbh = zyClothsType.getNums(); + //型号编码 + ZyStyleModel zyStyleModel = zyStyleModelService.getById(xhid); + String xhbm =zyStyleModel.getModelNumber(); + //顺序号 + String sxh = ""; + ZyGoods zyGoods = new ZyGoods(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyGoods, req.getParameterMap()); + queryWrapper.eq("cloths_type_id",lxid); + queryWrapper.eq("model_id",xhid); + List list = zyGoodsService.list(queryWrapper); + sxh = list.size()+1+""; + spbh = lxbh + xhbm + sxh; + return Result.OK(spbh); + } + /** * 导出excel * diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodel/entity/ZyStyleModel.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodel/entity/ZyStyleModel.java index 6b4f6b36..23ccf1f3 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodel/entity/ZyStyleModel.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodel/entity/ZyStyleModel.java @@ -47,7 +47,7 @@ public class ZyStyleModel implements Serializable { /**型号编码*/ @Excel(name = "型号编码", width = 15) @ApiModelProperty(value = "型号编码") - private java.lang.Integer modelNumber; + private java.lang.String modelNumber; /**码数*/ @Excel(name = "码数", width = 15) @ApiModelProperty(value = "码数")