diff --git a/ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue b/ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue index 30dc49a3..2cfedd50 100644 --- a/ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue +++ b/ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue @@ -95,6 +95,10 @@ + 确定出库 + + 撤销出库 + 编辑 @@ -115,7 +119,7 @@ - + @@ -126,13 +130,16 @@ import { mixinDevice } from '@/utils/mixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin' import DeliveryModal from './modules/DeliveryModal' + import DeliveryModal1 from './modules/DeliveryModal1' import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' + import { getAction } from '../../api/manage' export default { name: 'DeliveryList', mixins:[JeecgListMixin, mixinDevice], components: { - DeliveryModal + DeliveryModal, + DeliveryModal1 }, data () { return { @@ -197,6 +204,11 @@ align:"center", dataIndex: 'adminId_dictText' }, + { + title:'出库状态', + align:"center", + dataIndex: 'status_dictText' + }, { title: '操作', dataIndex: 'action', @@ -207,6 +219,7 @@ } ], url: { + cxck: "/delivery/delivery/cxck", list: "/delivery/delivery/list", delete: "/delivery/delivery/delete", deleteBatch: "/delivery/delivery/deleteBatch", @@ -227,6 +240,20 @@ }, }, methods: { + cxck(record){ + getAction(this.url.cxck,{ id: record.id}).then((res)=>{ + if(res.success){ + this.loadData(1); + }else{ + that.$message.warning(res.message); + } + }) + }, + qdck: function (record) { + this.$refs.modalFormqdck.edit(record); + this.$refs.modalFormqdck.title = "确定出库"; + this.$refs.modalFormqdck.disableSubmit = false; + }, initDictConfig(){ }, getSuperFieldList(){ diff --git a/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue index 3530446c..45e95852 100644 --- a/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue +++ b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue @@ -3,19 +3,16 @@ - - - - - + - + - + - + - + - - - - - - - - - - - + + @@ -167,9 +151,7 @@ amount: [ { required: true, message: '请输入用量!'}, ], - storehouseId: [ - { required: true, message: '请输入仓库!'}, - ], + itemType: [ { required: true, message: '请输入物品类型!'}, ], @@ -179,12 +161,8 @@ deliveryTime: [ { required: true, message: '请输入出库时间!'}, ], - carrierId: [ - { required: true, message: '请输入取货人!'}, - ], - adminName: [ - { required: true, message: '请输入管理员!'}, - ], + + }, url: { add: "/delivery/delivery/add", diff --git a/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm1.vue b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm1.vue new file mode 100644 index 00000000..f2011fdc --- /dev/null +++ b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm1.vue @@ -0,0 +1,139 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal1.vue b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal1.vue new file mode 100644 index 00000000..ea35d415 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal1.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file 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/demo/delivery/controller/DeliveryController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/controller/DeliveryController.java index 5f22e058..9085d920 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/controller/DeliveryController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/controller/DeliveryController.java @@ -137,6 +137,35 @@ public class DeliveryController extends JeecgController edit1(@RequestBody Delivery delivery) { + delivery.setStatus("1"); + deliveryService.updateById(delivery); + return Result.OK("编辑成功!"); + } + + //重新上线cxsx + @AutoLog(value = "专利列表-重新上线") + @ApiOperation(value="专利列表-重新上线", notes="专利列表-重新上线") + @RequestMapping(value = "/cxck") + public Result cxck(@RequestParam(name="id",required=true) String id) { + Delivery delivery = new Delivery(); + delivery.setId(id); + delivery.setStatus("2"); + deliveryService.updateById(delivery); + return Result.OK("ok!"); + } + + /** * 通过id删除 * diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/entity/Delivery.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/entity/Delivery.java index dd4d1f05..fb1dccbf 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/entity/Delivery.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/entity/Delivery.java @@ -103,4 +103,10 @@ public class Delivery implements Serializable { @Excel(name = "管理员", width = 15) @ApiModelProperty(value = "管理员") private String adminName; + + /**出库状态*/ + @Excel(name = "出库状态", width = 15, dicCode = "ckzt") + @Dict(dicCode = "ckzt") + @ApiModelProperty(value = "出库状态") + private java.lang.String status; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/DeliveryMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/DeliveryMapper.java index b84bdb31..e5515bb2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/DeliveryMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/DeliveryMapper.java @@ -4,6 +4,7 @@ package org.jeecg.modules.demo.delivery.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.jeecg.modules.demo.delivery.entity.Delivery; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -15,4 +16,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface DeliveryMapper extends BaseMapper { + @Select("select storehouse_id from storage where item_type=#{s} and item_code=#{fabricNumber} and amount > #{doubleValue}") + String findStorehouseId(String s, double doubleValue, String fabricNumber); + + @Select("select user_id from storehouse where id =#{storehouseId}") + String getadminid(String storehouseId); + + + + @Select("select storehouse_id from storage where item_type=#{s} and item_code=#{fabricNumber} and amount > #{doubleValue}") + String findStorehouseId2(String s, double doubleValue, String fabricNumber); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java index 7aa4f2bd..b7cba37b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; +import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.Optional; @@ -34,6 +35,10 @@ import java.util.Optional; @Service public class DeliveryServiceImpl extends ServiceImpl implements IDeliveryService { + + @Autowired + DeliveryMapper deliveryMapper; + @Autowired private IZyProductPlanService iZyProductPlanService; @@ -62,14 +67,28 @@ public class DeliveryServiceImpl extends ServiceImpl i delivery.setDeliveryReason("0"); delivery.setItemType("0"); delivery.setAmount(e.getAmount().doubleValue()); -// delivery.setDeliveryTime(new Date()); -// delivery.setCarrierId("TODO"); -// delivery.setAdminId("TODO"); -// delivery.setStorehouseId("TODO"); + delivery.setDeliveryTime(new Date()); + ZyFabric zyFabric = iZyFabricService.getById(e.getFabricId()); if (!ObjectUtils.isEmpty(zyFabric)) { delivery.setItemCode(zyFabric.getFabricNumber()); } + + //取货人 +// delivery.setCarrierId("TODO"); + //管理员 +// delivery.setAdminId("TODO"); + //仓库id +// delivery.setStorehouseId("TODO"); + /*=====================开始=============================王家东添加*/ + /* String StorehouseId = deliveryMapper.findStorehouseId("0",e.getAmount().doubleValue(),zyFabric.getFabricNumber()); + if (StorehouseId!=""){ + delivery.setStorehouseId(StorehouseId); + String adminid =deliveryMapper.getadminid(StorehouseId); + delivery.setStorehouseId(adminid); + }*/ + + /*=====================结束=============================王家东添加*/ deliveryList4Fabric.add(delivery); }); this.saveBatch(deliveryList4Fabric); @@ -82,7 +101,7 @@ public class DeliveryServiceImpl extends ServiceImpl i delivery2.setDeliveryReason("0"); delivery2.setItemType("1"); delivery2.setAmount(e.getAmount().doubleValue()); -// delivery2.setDeliveryTime(new Date()); + delivery2.setDeliveryTime(new Date()); // delivery2.setCarrierId("TODO"); // delivery2.setAdminId("TODO"); // delivery2.setStorehouseId("TODO"); @@ -90,6 +109,15 @@ public class DeliveryServiceImpl extends ServiceImpl i if (!ObjectUtils.isEmpty(zyAccessories)) { delivery2.setItemCode(zyAccessories.getNums()); } + + /* String StorehouseId = deliveryMapper.findStorehouseId2("0",e.getAmount().doubleValue(),zyFabric.getFabricNumber()); + if (StorehouseId!=""){ + delivery2.setStorehouseId(StorehouseId); + String adminid =deliveryMapper.getadminid(StorehouseId); + delivery2.setStorehouseId(adminid); + }*/ + + deliveryList4accessories.add(delivery2); }); this.saveBatch(deliveryList4accessories); 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("删除成功!"); }