From fbee524ae40c9197f5359723192f46bed708c4c3 Mon Sep 17 00:00:00 2001 From: wangjiadong <1654135867@qq.com> Date: Tue, 10 Jan 2023 16:48:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/warehousing/WarehousingList.vue | 253 ++++++++++++++++++ .../warehousing/modules/WarehousingForm.vue | 242 +++++++++++++++++ .../warehousing/modules/WarehousingModal.vue | 60 +++++ .../WarehousingModal__Style#Drawer.vue | 84 ++++++ .../controller/WarehousingController.java | 196 ++++++++++++++ .../demo/warehousing/entity/Warehousing.java | 105 ++++++++ .../warehousing/mapper/WarehousingMapper.java | 27 ++ .../mapper/xml/WarehousingMapper.xml | 5 + .../service/IWarehousingService.java | 19 ++ .../service/impl/WarehousingServiceImpl.java | 36 +++ 10 files changed, 1027 insertions(+) create mode 100644 ant-design-vue-jeecg/src/views/warehousing/WarehousingList.vue create mode 100644 ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingForm.vue create mode 100644 ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal.vue create mode 100644 ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal__Style#Drawer.vue create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/controller/WarehousingController.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/entity/Warehousing.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/WarehousingMapper.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/xml/WarehousingMapper.xml create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/service/IWarehousingService.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/service/impl/WarehousingServiceImpl.java diff --git a/ant-design-vue-jeecg/src/views/warehousing/WarehousingList.vue b/ant-design-vue-jeecg/src/views/warehousing/WarehousingList.vue new file mode 100644 index 00000000..0f7763cb --- /dev/null +++ b/ant-design-vue-jeecg/src/views/warehousing/WarehousingList.vue @@ -0,0 +1,253 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingForm.vue b/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingForm.vue new file mode 100644 index 00000000..4b848e10 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingForm.vue @@ -0,0 +1,242 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal.vue b/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal.vue new file mode 100644 index 00000000..2e7b1e0f --- /dev/null +++ b/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal__Style#Drawer.vue new file mode 100644 index 00000000..6d089f17 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/warehousing/modules/WarehousingModal__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/warehousing/controller/WarehousingController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/controller/WarehousingController.java new file mode 100644 index 00000000..b07fb848 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/controller/WarehousingController.java @@ -0,0 +1,196 @@ +package org.jeecg.modules.demo.warehousing.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.warehousing.entity.Warehousing; +import org.jeecg.modules.demo.warehousing.service.IWarehousingService; + +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.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("/warehousing/warehousing") +@Slf4j +public class WarehousingController extends JeecgController { + @Autowired + private IWarehousingService warehousingService; + + /** + * 分页列表查询 + * + * @param warehousing + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "入库表-分页列表查询") + @ApiOperation(value="入库表-分页列表查询", notes="入库表-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(Warehousing warehousing, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(warehousing, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = warehousingService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param warehousing + * @return + */ + @AutoLog(value = "入库表-添加") + @ApiOperation(value="入库表-添加", notes="入库表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody Warehousing warehousing) { + //开始对库存表进行操作 + //查询需要的编号 + String needcode = warehousing.getItemCode(); + //查询需要的类型id + String lxid = warehousing.getItemType(); + //获取数量 + Double sl = warehousing.getAmount(); + //获取库存的数量 + Double kucunsl = warehousingService.kucunsl(needcode,lxid); + Double slcha = kucunsl +sl; + //开始操作库存表 + warehousingService.dokucun(needcode,lxid,sl,slcha); + warehousingService.save(warehousing); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param warehousing + * @return + */ + @AutoLog(value = "入库表-编辑") + @ApiOperation(value="入库表-编辑", notes="入库表-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody Warehousing warehousing) { + //查询需要的编号 + String needcode = warehousing.getItemCode(); + //查询需要的类型id + String lxid = warehousing.getItemType(); + //获取数据库原始数据 + Double yssj = warehousingService.yssj(needcode,lxid); + //获取数量 + Double sl = warehousing.getAmount(); + //获取库存的数量 + Double kucunsl = warehousingService.kucunsl(needcode,lxid); + Double slcha = kucunsl +sl-yssj; + //开始操作库存表 + warehousingService.dokucun(needcode,lxid,sl,slcha); + warehousingService.updateById(warehousing); + return Result.OK("编辑成功!"); + } + + /** + * 通过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) { + warehousingService.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.warehousingService.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) { + Warehousing warehousing = warehousingService.getById(id); + if(warehousing==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(warehousing); + } + + /** + * 导出excel + * + * @param request + * @param warehousing + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Warehousing warehousing) { + return super.exportXls(request, warehousing, Warehousing.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, Warehousing.class); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/entity/Warehousing.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/entity/Warehousing.java new file mode 100644 index 00000000..425a25ff --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/entity/Warehousing.java @@ -0,0 +1,105 @@ +package org.jeecg.modules.demo.warehousing.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("warehousing") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="warehousing对象", description="入库表") +public class Warehousing implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**仓库*/ + @Excel(name = "仓库", width = 15, dictTable = "starehouse", dicText = "name", dicCode = "id") + @Dict(dictTable = "starehouse", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "仓库") + private java.lang.String storehouseId; + /**物品类型*/ + @Excel(name = "物品类型", width = 15, dicCode = "goods_category") + @Dict(dicCode = "goods_category") + @ApiModelProperty(value = "物品类型") + private java.lang.String itemType; + /**物品编码*/ + @Excel(name = "物品编码", width = 15) + @ApiModelProperty(value = "物品编码") + private java.lang.String itemCode; + /**用量*/ + @Excel(name = "用量", width = 15) + @ApiModelProperty(value = "用量") + private java.lang.Double amount; + /**单位*/ + @Excel(name = "单位", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") + @Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") + @ApiModelProperty(value = "单位") + private java.lang.String unit; + /**入库原因*/ + @Excel(name = "入库原因", width = 15, dicCode = "hhcg") + @Dict(dicCode = "hhcg") + @ApiModelProperty(value = "入库原因") + private java.lang.String warehousingReason; + /**入库时间*/ + @Excel(name = "入库时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "入库时间") + private java.util.Date warehousingTime; + /**送货人*/ + @Excel(name = "送货人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") + @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") + @ApiModelProperty(value = "送货人") + private java.lang.String carrierId; + /**管理员*/ + @Excel(name = "管理员", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "id") + @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id") + @ApiModelProperty(value = "管理员") + private java.lang.String adminId; + /**管理员*/ + @Excel(name = "管理员", width = 15) + @ApiModelProperty(value = "管理员") + private java.lang.String adminName; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/WarehousingMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/WarehousingMapper.java new file mode 100644 index 00000000..dc4cf4aa --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/WarehousingMapper.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.demo.warehousing.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.jeecg.modules.demo.warehousing.entity.Warehousing; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 入库表 + * @Author: jeecg-boot + * @Date: 2023-01-10 + * @Version: V1.0 + */ +public interface WarehousingMapper extends BaseMapper { + + @Select("Select amount from storage where item_type=#{lxid} and item_code=#{needcode} ") + Double kucunsl(String needcode, String lxid); + + @Update("UPDATE storage SET amount = #{slcha} WHERE item_code =#{needcode} and item_type=#{lxid}") + void dokucun(String needcode, String lxid, Double slcha); + + @Select("Select amount from warehousing where item_type=#{lxid} and item_code=#{needcode}") + Double yssj(String needcode, String lxid); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/xml/WarehousingMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/xml/WarehousingMapper.xml new file mode 100644 index 00000000..0ec7f862 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/mapper/xml/WarehousingMapper.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/warehousing/service/IWarehousingService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/service/IWarehousingService.java new file mode 100644 index 00000000..b2ac3c06 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/service/IWarehousingService.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.warehousing.service; + +import org.jeecg.modules.demo.warehousing.entity.Warehousing; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 入库表 + * @Author: jeecg-boot + * @Date: 2023-01-10 + * @Version: V1.0 + */ +public interface IWarehousingService extends IService { + + Double kucunsl(String needcode, String lxid); + + void dokucun(String needcode, String lxid, Double sl, Double slcha); + + Double yssj(String needcode, String lxid); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/service/impl/WarehousingServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/service/impl/WarehousingServiceImpl.java new file mode 100644 index 00000000..9bbd6c7b --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/warehousing/service/impl/WarehousingServiceImpl.java @@ -0,0 +1,36 @@ +package org.jeecg.modules.demo.warehousing.service.impl; + +import org.jeecg.modules.demo.warehousing.entity.Warehousing; +import org.jeecg.modules.demo.warehousing.mapper.WarehousingMapper; +import org.jeecg.modules.demo.warehousing.service.IWarehousingService; +import org.springframework.beans.factory.annotation.Autowired; +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 WarehousingServiceImpl extends ServiceImpl implements IWarehousingService { + @Autowired + WarehousingMapper warehousingMapper; + + @Override + public Double kucunsl(String needcode, String lxid) { + return warehousingMapper.kucunsl(needcode,lxid); + } + + @Override + public void dokucun(String needcode, String lxid, Double sl, Double slcha) { + warehousingMapper.dokucun(needcode,lxid,slcha); + } + + @Override + public Double yssj(String needcode, String lxid) { + return warehousingMapper.yssj(needcode,lxid); + } +}