From d514283503b1a4f96f0526c3a15d8677d8a664b1 Mon Sep 17 00:00:00 2001 From: "djz236@163.com" Date: Wed, 30 Aug 2023 18:36:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=AE=A1=E8=B7=AF=EF=BC=8C?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=EF=BC=8C=E5=BA=93=E4=BD=8D=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=87=8C=E7=9A=84=E5=88=86=E9=A1=B5=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E6=88=90=E5=92=8C=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=E7=9A=84=E5=B0=B1=E8=A1=8C=EF=BC=8C=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9A=84=E5=88=A0=E9=99=A4=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=EF=BC=8C=E8=BF=99=E4=B8=AA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C=E4=B8=8D=E7=9F=A5=E9=81=93=E4=B8=BA?= =?UTF-8?q?=E5=95=A5=E4=B9=9F=E4=B8=8D=E8=A1=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/wh/pojo/LocationQuery.java | 22 ++++++++++ .../main/java/com/wh/pojo/ProductQuery.java | 26 +++++++++++ .../main/java/com/wh/pojo/SupplierQuery.java | 19 ++++++++ .../initial/LocationController.java | 28 ++++++++---- .../controller/initial/ProductController.java | 15 +++++-- .../initial/SupplierController.java | 17 ++++++-- .../instorehouse/InStorehouseMainService.java | 11 +++-- .../api/prodstock/ProdStockService.java | 3 ++ .../wh/service/initial/LocationService.java | 14 +++--- .../service/initial/LocationServiceImpl.java | 43 +++++++++++++++++-- .../wh/service/initial/ProductService.java | 6 ++- .../service/initial/ProductServiceImpl.java | 27 ++++++++---- .../wh/service/initial/SupplierService.java | 5 ++- .../service/initial/SupplierServiceImpl.java | 27 ++++++++++++ 14 files changed, 224 insertions(+), 39 deletions(-) create mode 100644 warehousing-system/project/wh-common/src/main/java/com/wh/pojo/LocationQuery.java create mode 100644 warehousing-system/project/wh-common/src/main/java/com/wh/pojo/ProductQuery.java create mode 100644 warehousing-system/project/wh-common/src/main/java/com/wh/pojo/SupplierQuery.java diff --git a/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/LocationQuery.java b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/LocationQuery.java new file mode 100644 index 00000000..5ef70177 --- /dev/null +++ b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/LocationQuery.java @@ -0,0 +1,22 @@ +package com.wh.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.yxt.common.core.query.Query; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class LocationQuery implements Query { + + private String name; //货位名称 + @TableId(type = IdType.AUTO) + private int id; + private String locationId; //货位编号 + private String type; //货位类型 + private String status; //货位状态 + private String storehouse; //所属仓库 + private String storehouseid; +} diff --git a/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/ProductQuery.java b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/ProductQuery.java new file mode 100644 index 00000000..c8816c5b --- /dev/null +++ b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/ProductQuery.java @@ -0,0 +1,26 @@ +package com.wh.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.yxt.common.core.query.Query; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +@ToString +public class ProductQuery implements Query { + @TableId(type = IdType.AUTO) + private int id; + private String barCode; //条码 + private String name; //商品名 + private String anotherName; //别名 + private Double value; //价值 + private Double netWeight; //净重 + private Double roughWeight; //毛重 + private Integer effectiveDays; //有效天数 + private String warehouse; //所属仓库 + private String remarks; //备注 +} diff --git a/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/SupplierQuery.java b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/SupplierQuery.java new file mode 100644 index 00000000..2d0daaa9 --- /dev/null +++ b/warehousing-system/project/wh-common/src/main/java/com/wh/pojo/SupplierQuery.java @@ -0,0 +1,19 @@ +package com.wh.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.yxt.common.core.query.Query; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SupplierQuery implements Query { + @TableId(type = IdType.AUTO) + private int id; + private String name; //供应商名称 + private String contacts; //联系人 + private String number; //电话 + private String remarks; //备注 +} diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java index efd8ec9e..72e580ff 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java @@ -1,14 +1,14 @@ package com.wh.controller.initial; -import com.wh.pojo.Location; -import com.wh.pojo.LocationType; -import com.wh.pojo.LocationVo; -import com.wh.pojo.Storehouse; +import com.wh.pojo.*; import com.wh.pojo.shstorehouse.ShStorehouse; import com.wh.service.initial.LocationService; import com.wh.service.shstorehouse.ShStorehouseService; import com.wh.vo.PageResult; import com.wh.vo.SysResult; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -25,10 +25,13 @@ public class LocationController { @Autowired private ShStorehouseService shStorehouseService; - @GetMapping("list") - public SysResult getLocationList(PageResult pageResult){ - pageResult = locationService.getLocationList(pageResult); - return SysResult.success(pageResult); + @PostMapping("list") + public ResultBean getLocationList(@RequestBody PagerQuery pq){ +// pageResult = locationService.getLocationList(pageResult); +// return SysResult.success(pageResult); + ResultBean rb = ResultBean.fireFail(); + PagerVo pv = locationService.getSupplierList(pq); + return rb.success().setData(pv); } @GetMapping("listAll") public SysResult listAll(PageResult pageResult){ @@ -61,6 +64,15 @@ public class LocationController { locationService.deleteLocation(name); return SysResult.success(); } + @DeleteMapping("deleteById/{id}") + public ResultBean deleteById(@PathVariable String id){ + ResultBean rb = ResultBean.fireFail(); + int i = locationService.deleteById(id); + if(i==0){ + return rb; + } + return rb.success(); + } @GetMapping("getStorehouse") public SysResult getStorehouse(){ diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/ProductController.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/ProductController.java index 92ecba99..6cbde07c 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/ProductController.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/ProductController.java @@ -1,10 +1,16 @@ package com.wh.controller.initial; import com.wh.pojo.Product; +import com.wh.pojo.ProductQuery; import com.wh.pojo.Storehouse; +import com.wh.pojo.shstorehouse.ShStorehouseQuery; +import com.wh.pojo.shstorehouse.ShStorehouseVo; import com.wh.service.initial.ProductService; import com.wh.vo.PageResult; import com.wh.vo.SysResult; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -17,10 +23,11 @@ public class ProductController { @Autowired private ProductService productService; - @GetMapping("list") - public SysResult getProductList(PageResult pageResult){ - pageResult = productService.getProductList(pageResult); - return SysResult.success(pageResult); + @PostMapping("list") + public ResultBean getProductList(@RequestBody PagerQuery pq){ + ResultBean rb = ResultBean.fireFail(); + PagerVo pv = productService.getProductList(pq); + return rb.success().setData(pv); } @PostMapping("addProduct") diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/SupplierController.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/SupplierController.java index 45a5f485..f720fae6 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/SupplierController.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/SupplierController.java @@ -1,9 +1,15 @@ package com.wh.controller.initial; +import com.wh.pojo.Product; +import com.wh.pojo.ProductQuery; import com.wh.pojo.Supplier; +import com.wh.pojo.SupplierQuery; import com.wh.service.initial.SupplierService; import com.wh.vo.PageResult; import com.wh.vo.SysResult; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -15,10 +21,13 @@ public class SupplierController { @Autowired private SupplierService supplierService; - @GetMapping("list") - public SysResult getSupplierList(PageResult pageResult){ - pageResult = supplierService.getSupplierList(pageResult); - return SysResult.success(pageResult); + @PostMapping("list") + public ResultBean getSupplierList(@RequestBody PagerQuery pq){ +// pageResult = supplierService.getSupplierList(pageResult); +// return SysResult.success(pageResult); + ResultBean rb = ResultBean.fireFail(); + PagerVo pv = supplierService.getSupplierList(pq); + return rb.success().setData(pv); } @PostMapping("addSupplier") diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java index c1c90176..e3043c40 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java @@ -70,10 +70,15 @@ public class InStorehouseMainService extends MybatisBaseService locationByLocationId = locationService.getLocationByLocationId(inStoreHouseMainDto.getLocationId()); + if(locationByLocationId==null||locationByLocationId.size()==0){ + return r.setMsg("货位信息不存在"); } + if(locationByLocationId.size()>1){ + return r.setMsg("货位编号重复"); + } + Location location =locationByLocationId.get(0) ; + QueryWrapper purchasenewWrapper = new QueryWrapper<>(); purchasenewWrapper.eq("purchase_no",inStoreHouseMainDto.getNo()); List list1 = purchasenewService.list(purchasenewWrapper); diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/prodstock/ProdStockService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/prodstock/ProdStockService.java index 93295eb1..13dbef7c 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/prodstock/ProdStockService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/prodstock/ProdStockService.java @@ -67,6 +67,9 @@ public class ProdStockService extends MybatisBaseService getSupplierList(PagerQuery pq); void addLocation(Location location); void updataLocation(Location location); - + int deleteById(String id); void deleteLocation(String name); Location getLocationById(String id); List getStorehouse(); @@ -24,4 +23,7 @@ public interface LocationService { List getLocations(); List getLocationsByStoreId(String id); + + + List getLocationByLocationId(String locationId); } diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java index 455045d1..0446bbf5 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java @@ -5,11 +5,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.mapper.initial.LocationMapper; import com.wh.mapper.initial.LocationTypeMapper; import com.wh.mapper.initial.StorehouseMapper; -import com.wh.pojo.Location; -import com.wh.pojo.LocationType; -import com.wh.pojo.LocationVo; -import com.wh.pojo.Storehouse; +import com.wh.pojo.*; import com.wh.vo.PageResult; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.vo.PagerVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -40,6 +39,29 @@ public class LocationServiceImpl implements LocationService{ return pageResult; } + @Override + public PagerVo getSupplierList(PagerQuery pq) { + Page locationPage = new Page<>(pq.getCurrent(),pq.getSize()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + String name = pq.getParams().getName(); + String storehouseid = pq.getParams().getStorehouseid(); + if(!StringUtils.isEmpty(name)){ + queryWrapper.like("name",name); + } + if(!StringUtils.isEmpty(storehouseid)){ + queryWrapper.eq("storehouseid",storehouseid); + } + + locationPage = locationMapper.selectPage(locationPage,queryWrapper); + Integer integer = locationMapper.selectCount(queryWrapper); + PagerVo pv=new PagerVo<>(); + pv.setCurrent(pq.getCurrent()); + pv.setTotal(integer); + pv.setSize(pq.getSize()); + pv.setRecords(locationPage.getRecords()); + return pv; + } + @Override public void addLocation(Location location) { locationMapper.insert(location); @@ -50,6 +72,11 @@ public class LocationServiceImpl implements LocationService{ locationMapper.updateById(location); } + @Override + public int deleteById(String id) { + return locationMapper.deleteById(id); + } + @Override public void deleteLocation(String name) { locationMapper.deleteById(name); @@ -80,4 +107,12 @@ public class LocationServiceImpl implements LocationService{ return locationMapper.getLocationsByStoreId(id); } + @Override + public List getLocationByLocationId(String locationId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("location_id",locationId); + List locations = locationMapper.selectList(queryWrapper); + return locations; + } + } diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductService.java index af7ca276..228b65aa 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductService.java @@ -2,15 +2,19 @@ package com.wh.service.initial; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.wh.pojo.Product; +import com.wh.pojo.ProductQuery; import com.wh.pojo.Storehouse; +import com.wh.pojo.shstorehouse.ShStorehouseVo; import com.wh.vo.PageResult; +import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import org.springframework.util.StringUtils; import java.util.List; public interface ProductService { - PageResult getProductList(PageResult pageResult); + PagerVo getProductList(PagerQuery pq); void addProduct(Product product); diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductServiceImpl.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductServiceImpl.java index 80318b40..8c9f2943 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductServiceImpl.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/ProductServiceImpl.java @@ -5,9 +5,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.mapper.initial.ProductMapper; import com.wh.mapper.initial.StorehouseMapper; import com.wh.pojo.Product; +import com.wh.pojo.ProductQuery; import com.wh.pojo.Storehouse; +import com.wh.pojo.shstorehouse.ShStorehouseVo; import com.wh.vo.PageResult; +import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -26,17 +30,24 @@ public class ProductServiceImpl implements ProductService{ private ProductMapper productMapper; @Override - public PageResult getProductList(PageResult pageResult) { - Page productPage = new Page<>(pageResult.getPageNum(),pageResult.getPageSize()); + public PagerVo getProductList(PagerQuery pq) { + Page productPage = new Page<>(pq.getCurrent(),pq.getSize()); QueryWrapper queryWrapper = new QueryWrapper<>(); - boolean flag = StringUtils.hasLength(pageResult.getQuery()); - - queryWrapper.like(flag,"name",pageResult.getQuery()); + String name = pq.getParams().getName(); + if(!StringUtils.isEmpty(name)){ + queryWrapper.like("name",name); + } productPage = productMapper.selectPage(productPage,queryWrapper); - - pageResult.setTotal((long) productPage.getRecords().size()).setRows(productPage.getRecords()); + Integer integer = productMapper.selectCount(queryWrapper); + // PageResult pageResult=new PageResult(); + // pageResult.setTotal((long) productPage.getRecords().size()).setRows(productPage.getRecords()); + PagerVo pv=new PagerVo<>(); + pv.setCurrent(pq.getCurrent()); + pv.setTotal(integer); + pv.setSize(pq.getSize()); + pv.setRecords(productPage.getRecords()); // System.out.println(productPage.getRecords().size()); - return pageResult; + return pv; } public ResultBean> getProductListByNameAndCode(String name,String code) { ResultBean rb=ResultBean.fireFail(); diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierService.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierService.java index e48d9b38..ebaf0204 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierService.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierService.java @@ -2,11 +2,14 @@ package com.wh.service.initial; import com.wh.pojo.Supplier; +import com.wh.pojo.SupplierQuery; import com.wh.vo.PageResult; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.vo.PagerVo; public interface SupplierService { PageResult getSupplierList(PageResult pageResult); - + PagerVo getSupplierList(PagerQuery pq); void addSupplier(Supplier supplier); void updataSupplier(Supplier supplier); diff --git a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierServiceImpl.java b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierServiceImpl.java index 754401fc..e682b7d5 100644 --- a/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierServiceImpl.java +++ b/warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/SupplierServiceImpl.java @@ -3,8 +3,12 @@ package com.wh.service.initial; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.mapper.initial.SupplierMapper; +import com.wh.pojo.Product; import com.wh.pojo.Supplier; +import com.wh.pojo.SupplierQuery; import com.wh.vo.PageResult; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.vo.PagerVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -27,6 +31,29 @@ public class SupplierServiceImpl implements SupplierService{ return pageResult; } + @Override + public PagerVo getSupplierList(PagerQuery pq) { + Page supplierPage = new Page<>(pq.getCurrent(),pq.getSize()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + String name = pq.getParams().getName(); + String number = pq.getParams().getNumber(); + if(!StringUtils.isEmpty(name)){ + queryWrapper.like("name",name); + } + if(!StringUtils.isEmpty(number)){ + queryWrapper.like("number",number); + } + supplierPage = supplierMapper.selectPage(supplierPage,queryWrapper); + Integer integer = supplierMapper.selectCount(queryWrapper); + // pageResult.setTotal((long) supplierPage.getRecords().size()).setRows(supplierPage.getRecords()); + PagerVo pv=new PagerVo<>(); + pv.setCurrent(pq.getCurrent()); + pv.setTotal(integer); + pv.setSize(pq.getSize()); + pv.setRecords(supplierPage.getRecords()); + return pv; + } + @Override public void addSupplier(Supplier supplier) { supplierMapper.insert(supplier);