diff --git a/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue b/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue index 0c836ae5..c0820745 100644 --- a/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue +++ b/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue @@ -4,6 +4,16 @@
+ + + + + + + + + + diff --git a/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue b/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue index b593d7a2..786151be 100644 --- a/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue +++ b/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue @@ -40,7 +40,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -77,6 +75,12 @@ + + + + + @@ -116,6 +121,9 @@ }, data () { return { + parm1:{ + brand_id:'' + }, model:{ status:1, }, @@ -147,6 +155,10 @@ this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { + canshu(){ + this.parm1.brand_id=this.model.canshu + console.log(this.parm1) + }, add () { this.edit(this.modelDefault); }, diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue index 4e3fbadb..59f7f56c 100644 --- a/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue +++ b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue @@ -3,33 +3,36 @@ - + - + - - - + + + - - - + + + - + + - - + + + + @@ -68,8 +71,20 @@ xs: { span: 24 }, sm: { span: 16 }, }, + labelCol1: { + xs: { span: 24 }, + sm: { span: 3 }, + }, + wrapperCol1: { + xs: { span: 24 }, + sm: { span: 21 }, + }, confirmLoading: false, validatorRules: { + brand:[ + { required: true, message: '请输入品牌名称!'}, + {min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, + ], }, url: { add: "/devicebrand/zyDevicebrand/add", @@ -88,6 +103,9 @@ this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { + shengchan(){ + this.model.manufacturer=this.model.supplier + }, add () { this.edit(this.modelDefault); }, @@ -126,4 +144,4 @@ }, } } - \ No newline at end of file + diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue index 290689cd..0342be94 100644 --- a/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue +++ b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue @@ -16,7 +16,7 @@ - + --> - + - + @@ -67,24 +67,24 @@ - + - - - - - - - - + + + + + - - - + + + + + + @@ -122,8 +122,20 @@ xs: { span: 24 }, sm: { span: 16 }, }, + labelCol1: { + xs: { span: 24 }, + sm: { span: 3 }, + }, + wrapperCol1: { + xs: { span: 24 }, + sm: { span: 21 }, + }, confirmLoading: false, validatorRules: { + model:[ + { required: true, message: '请输入型号名称!'}, + {min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, + ], }, url: { add: "/devicemodel/zyDevicemodel/add", diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicetype/modules/ZyDevicetypeForm.vue b/ant-design-vue-jeecg/src/views/zydevice/devicetype/modules/ZyDevicetypeForm.vue index 958bdbe3..fc467c33 100644 --- a/ant-design-vue-jeecg/src/views/zydevice/devicetype/modules/ZyDevicetypeForm.vue +++ b/ant-design-vue-jeecg/src/views/zydevice/devicetype/modules/ZyDevicetypeForm.vue @@ -56,6 +56,10 @@ }, confirmLoading: false, validatorRules: { + name:[ + { required: true, message: '请输入设备类型!'}, + {min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, + ], }, url: { add: "/devicetype/zyDevicetype/add", diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java index d91662a9..55125280 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java @@ -75,7 +75,28 @@ public class ZyDeviceController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(zyDevice, req.getParameterMap()); +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyDevice, req.getParameterMap()); + QueryWrapper queryWrapper=new QueryWrapper(); + if(zyDevice.getName()!=null){ + queryWrapper.like("name",zyDevice.getName()); + } + if(zyDevice.getCode()!=null){ + queryWrapper.like("code",zyDevice.getCode()); + } + if(zyDevice.getStatus()!=null){ + queryWrapper.eq("status",zyDevice.getStatus()); + } + if(zyDevice.getBrandId()!=null){ + String s="%"+zyDevice.getBrandId()+"%"; + List brand=zyDeviceService.findAllBrand(s); + queryWrapper.in("brand_id",brand); + } + if(zyDevice.getModelId()!=null){ + String s="%"+zyDevice.getModelId()+"%"; + List model=zyDeviceService.findAllModel(s); + queryWrapper.in("model_id",model); + } + Page page = new Page(pageNo, pageSize); IPage pageList = zyDeviceService.page(page, queryWrapper); MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); @@ -192,6 +213,10 @@ public class ZyDeviceController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { + int a=zyDeviceService.find(id); + if(a>=1){ + return Result.error("有工序使用本设备,删除失败!!!"); + } zyDeviceService.removeById(id); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java index eada1e78..ae6d04cb 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java @@ -21,4 +21,12 @@ public interface ZyDeviceMapper extends BaseMapper { @Select("select code from zy_device order by code desc limit 0,1") String getCode(); + + @Select("select id from zy_devicebrand where brand like #{s}") + List findAllBrand(String s); + @Select("select id from zy_devicemodel where model like #{s}") + List findAllModel(String s); + + @Select("select count(1) from zy_process_machine where machineId=#{id}") + int find(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java index 26cb92eb..f471aa48 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java @@ -4,6 +4,8 @@ import org.jeecg.modules.device.entity.ZyDevice; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; +import java.util.List; + /** * @Description: 设备信息 * @Author: jeecg-boot @@ -15,4 +17,10 @@ public interface IZyDeviceService extends IService { ZyDevicemodel findByModelId(String modelId); String getCode(); + + List findAllBrand(String s); + + List findAllModel(String s); + + int find(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java index 95332469..1048379a 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java @@ -9,6 +9,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; + /** * @Description: 设备信息 * @Author: jeecg-boot @@ -29,4 +31,19 @@ public class ZyDeviceServiceImpl extends ServiceImpl i public String getCode() { return zyDeviceMapper.getCode(); } + + @Override + public List findAllBrand(String s) { + return zyDeviceMapper.findAllBrand(s); + } + + @Override + public List findAllModel(String s) { + return zyDeviceMapper.findAllModel(s); + } + + @Override + public int find(String id) { + return zyDeviceMapper.find(id); + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java index e36801f1..8b1b2866 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java @@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.zydevice.devicebrand.entity.ZyDevicebrand; import org.jeecg.modules.zydevice.devicebrand.service.IZyDevicebrandService; +import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -51,8 +52,10 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class ZyDevicebrandController extends JeecgController { @Autowired private IZyDevicebrandService zyDevicebrandService; - - /** + @Autowired + private IZyDevicemodelService zyDevicemodelService; + + /** * 分页列表查询 * * @param zyDevicebrand @@ -127,6 +130,12 @@ public class ZyDevicebrandController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("brand_id",id); + int a=zyDevicemodelService.count(queryWrapper); + if(a>=0){ + return Result.error("本型号已被使用,删除失败!!"); + } zyDevicebrandService.removeById(id); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java index a0874536..cb611445 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java @@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.device.service.IZyDeviceService; import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService; import org.jeecgframework.poi.excel.ExcelImportUtil; @@ -59,7 +60,8 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class ZyDevicemodelController extends JeecgController { @Autowired private IZyDevicemodelService zyDevicemodelService; - + @Autowired + private IZyDeviceService zyDeviceService; /** * 分页列表查询 * @@ -162,6 +164,12 @@ public class ZyDevicemodelController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("model_id",id); + int a=zyDeviceService.count(queryWrapper); + if(a>=1){ + return Result.error("设备型号有使用,删除失败!!!"); + } zyDevicemodelService.removeById(id); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicetype/controller/ZyDevicetypeController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicetype/controller/ZyDevicetypeController.java index 5d39fa65..ea165007 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicetype/controller/ZyDevicetypeController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicetype/controller/ZyDevicetypeController.java @@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService; import org.jeecg.modules.zydevice.devicetype.entity.ZyDevicetype; import org.jeecg.modules.zydevice.devicetype.service.IZyDevicetypeService; import org.jeecgframework.poi.excel.ExcelImportUtil; @@ -49,8 +50,10 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class ZyDevicetypeController extends JeecgController { @Autowired private IZyDevicetypeService zyDevicetypeService; - - /** + @Autowired + private IZyDevicemodelService zyDevicemodelService; + + /** * 分页列表查询 * * @param zyDevicetype @@ -83,6 +86,9 @@ public class ZyDevicetypeController extends JeecgController add(@RequestBody ZyDevicetype zyDevicetype) { + if(zyDevicetype.getName().length()>200){ + return Result.error("添加失败,设备类型名称太长!"); + } QueryWrapper queryWrapper=new QueryWrapper(); queryWrapper.eq("name",zyDevicetype.getName()); int a=zyDevicetypeService.count(queryWrapper); @@ -90,7 +96,7 @@ public class ZyDevicetypeController extends JeecgController edit(@RequestBody ZyDevicetype zyDevicetype) { + if(zyDevicetype.getName().length()>200){ + return Result.error("添加失败,设备类型名称太长!"); + } QueryWrapper queryWrapper=new QueryWrapper(); queryWrapper.eq("name",zyDevicetype.getName()); int a=zyDevicetypeService.count(queryWrapper); @@ -125,6 +134,14 @@ public class ZyDevicetypeController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { + ZyDevicetype zyDevicetype = zyDevicetypeService.getById(id); + //判断型号中是否被使用 + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("devicetype_code",zyDevicetype.getCode()); + int a=zyDevicemodelService.count(queryWrapper); + if(a>=1){ + return Result.error("本类型已被使用,请先删除对应型号!!!"); + } zyDevicetypeService.removeById(id); return Result.OK("删除成功!"); }