From 3cae63721b33be5b72246a9551bafad1ecf1cad6 Mon Sep 17 00:00:00 2001 From: wangjiadong <1654135867@qq.com> Date: Tue, 10 Jan 2023 17:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/delivery/DeliveryList.vue | 251 ++++++++++++++++++ .../views/delivery/modules/DeliveryForm.vue | 244 +++++++++++++++++ .../views/delivery/modules/DeliveryModal.vue | 60 +++++ .../modules/DeliveryModal__Style#Drawer.vue | 84 ++++++ .../controller/DeliveryController.java | 208 +++++++++++++++ .../demo/delivery/entity/Delivery.java | 106 ++++++++ .../demo/delivery/mapper/DeliveryMapper.java | 18 ++ .../delivery/mapper/xml/DeliveryMapper.xml | 5 + .../delivery/service/IDeliveryService.java | 15 ++ .../service/impl/DeliveryServiceImpl.java | 20 ++ 10 files changed, 1011 insertions(+) create mode 100644 ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue create mode 100644 ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue create mode 100644 ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal.vue create mode 100644 ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal__Style#Drawer.vue create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/controller/DeliveryController.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/entity/Delivery.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/DeliveryMapper.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/xml/DeliveryMapper.xml create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java diff --git a/ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue b/ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue new file mode 100644 index 00000000..30dc49a3 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/delivery/DeliveryList.vue @@ -0,0 +1,251 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue new file mode 100644 index 00000000..8f381030 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryForm.vue @@ -0,0 +1,244 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal.vue b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal.vue new file mode 100644 index 00000000..0f5fa4c6 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal__Style#Drawer.vue new file mode 100644 index 00000000..5c23f253 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/delivery/modules/DeliveryModal__Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file 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 new file mode 100644 index 00000000..5f22e058 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/controller/DeliveryController.java @@ -0,0 +1,208 @@ +package org.jeecg.modules.demo.delivery.controller; + + + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +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.delivery.entity.Delivery; +import org.jeecg.modules.demo.delivery.service.IDeliveryService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecg.modules.demo.warehousing.service.IWarehousingService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 出库表 + * @Author: jeecg-boot + * @Date: 2023-01-10 + * @Version: V1.0 + */ +@Api(tags="出库表") +@RestController +@RequestMapping("/delivery/delivery") +@Slf4j +public class DeliveryController extends JeecgController { + @Autowired + private IDeliveryService deliveryService; + @Autowired + private IWarehousingService warehousingService; + + /** + * 分页列表查询 + * + * @param delivery + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "出库表-分页列表查询") + @ApiOperation(value="出库表-分页列表查询", notes="出库表-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(Delivery delivery, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(delivery, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = deliveryService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param delivery + * @return + */ + @AutoLog(value = "出库表-添加") + @ApiOperation(value="出库表-添加", notes="出库表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody Delivery delivery) { + //获取编码 + String needbm=delivery.getItemCode(); + //获取类型 + String needlx = delivery.getItemType(); + //获取原始库存数据 + Double yssj = warehousingService.yssj(needbm,needlx); + //获取出库数据 + Double sj =delivery.getAmount(); + Double needsj = yssj - sj; + if (needsj>0){ + warehousingService.dokucun(needbm,needlx,sj,needsj); + deliveryService.save(delivery); + return Result.OK("添加成功!"); + }else { + return Result.error("库存不足"); + } + + } + + /** + * 编辑 + * + * @param delivery + * @return + */ + @AutoLog(value = "出库表-编辑") + @ApiOperation(value="出库表-编辑", notes="出库表-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody Delivery delivery) { + //获取编码 + String needbm=delivery.getItemCode(); + //获取类型 + String needlx = delivery.getItemType(); + //获取原始库存数据 + Double yssj = warehousingService.yssj(needbm,needlx); + //获取出库数据 + Double sj =delivery.getAmount(); + //获取出库表的原始数据 + Double ckbsj = deliveryService.getById(delivery.getId()).getAmount(); + Double needsj =yssj + ckbsj -sj; + if (needsj>0){ + warehousingService.dokucun(needbm,needlx,sj,needsj); + deliveryService.updateById(delivery); + return Result.OK("编辑成功!"); + }else { + return Result.error("库存不足"); + } + + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "出库表-通过id删除") + @ApiOperation(value="出库表-通过id删除", notes="出库表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + deliveryService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "出库表-批量删除") + @ApiOperation(value="出库表-批量删除", notes="出库表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.deliveryService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "出库表-通过id查询") + @ApiOperation(value="出库表-通过id查询", notes="出库表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + Delivery delivery = deliveryService.getById(id); + if(delivery==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(delivery); + } + + /** + * 导出excel + * + * @param request + * @param delivery + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Delivery delivery) { + return super.exportXls(request, delivery, Delivery.class, "出库表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, Delivery.class); + } + +} 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 new file mode 100644 index 00000000..dd4d1f05 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/entity/Delivery.java @@ -0,0 +1,106 @@ +package org.jeecg.modules.demo.delivery.entity; + + + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 出库表 + * @Author: jeecg-boot + * @Date: 2023-01-10 + * @Version: V1.0 + */ +@Data +@TableName("delivery") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="delivery对象", description="出库表") +public class Delivery implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; + /**仓库*/ + @Excel(name = "仓库", width = 15, dictTable = "starehouse", dicText = "name", dicCode = "id") + @Dict(dictTable = "starehouse", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "仓库") + private String storehouseId; + /**物品类型*/ + @Excel(name = "物品类型", width = 15, dicCode = "goods_category") + @Dict(dicCode = "goods_category") + @ApiModelProperty(value = "物品类型") + private String itemType; + /**物品编码*/ + @Excel(name = "物品编码", width = 15) + @ApiModelProperty(value = "物品编码") + private String itemCode; + /**用量*/ + @Excel(name = "用量", width = 15) + @ApiModelProperty(value = "用量") + private java.lang.Double amount; + /**单位*/ + @Excel(name = "单位", width = 15) + @ApiModelProperty(value = "单位") + private String unit; + /**出库原因*/ + @Excel(name = "出库原因", width = 15, dicCode = "scjc") + @Dict(dicCode = "scjc") + @ApiModelProperty(value = "出库原因") + private String deliveryReason; + /**出库时间*/ + @Excel(name = "出库时间", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "出库时间") + private Date deliveryTime; + /**取货人*/ + @Excel(name = "取货人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") + @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") + @ApiModelProperty(value = "取货人") + private String carrierId; + /**管理员*/ + @Excel(name = "管理员", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "id") + @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id") + @ApiModelProperty(value = "管理员") + private String adminId; + /**管理员*/ + @Excel(name = "管理员", width = 15) + @ApiModelProperty(value = "管理员") + private String adminName; +} 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 new file mode 100644 index 00000000..b84bdb31 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/DeliveryMapper.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.demo.delivery.mapper; + + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.delivery.entity.Delivery; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 出库表 + * @Author: jeecg-boot + * @Date: 2023-01-10 + * @Version: V1.0 + */ +public interface DeliveryMapper extends BaseMapper { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/xml/DeliveryMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/xml/DeliveryMapper.xml new file mode 100644 index 00000000..ec2adc93 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/mapper/xml/DeliveryMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java new file mode 100644 index 00000000..b2830be6 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.demo.delivery.service; + + +import org.jeecg.modules.demo.delivery.entity.Delivery; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 出库表 + * @Author: jeecg-boot + * @Date: 2023-01-10 + * @Version: V1.0 + */ +public interface IDeliveryService extends IService { + +} 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 new file mode 100644 index 00000000..f866ebc4 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.demo.delivery.service.impl; + + +import org.jeecg.modules.demo.delivery.entity.Delivery; +import org.jeecg.modules.demo.delivery.mapper.DeliveryMapper; +import org.jeecg.modules.demo.delivery.service.IDeliveryService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 出库表 + * @Author: jeecg-boot + * @Date: 2023-01-10 + * @Version: V1.0 + */ +@Service +public class DeliveryServiceImpl extends ServiceImpl implements IDeliveryService { + +}