正在显示
18 个修改的文件
包含
820 行增加
和
168 行删除
| @@ -3,17 +3,17 @@ package org.jeecg.modules.erp.trade.controller; | @@ -3,17 +3,17 @@ package org.jeecg.modules.erp.trade.controller; | ||
| 3 | import java.io.UnsupportedEncodingException; | 3 | import java.io.UnsupportedEncodingException; |
| 4 | import java.io.IOException; | 4 | import java.io.IOException; |
| 5 | import java.net.URLDecoder; | 5 | import java.net.URLDecoder; |
| 6 | -import java.util.ArrayList; | ||
| 7 | -import java.util.Arrays; | ||
| 8 | -import java.util.List; | ||
| 9 | -import java.util.Map; | 6 | +import java.util.*; |
| 10 | import java.util.stream.Collectors; | 7 | import java.util.stream.Collectors; |
| 11 | 8 | ||
| 12 | import javax.servlet.http.HttpServletRequest; | 9 | import javax.servlet.http.HttpServletRequest; |
| 13 | import javax.servlet.http.HttpServletResponse; | 10 | import javax.servlet.http.HttpServletResponse; |
| 14 | 11 | ||
| 12 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 15 | import cn.hutool.core.util.StrUtil; | 13 | import cn.hutool.core.util.StrUtil; |
| 14 | +import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; | ||
| 16 | import org.jeecg.modules.erp.trade.entity.TblTradeTenderInfo; | 15 | import org.jeecg.modules.erp.trade.entity.TblTradeTenderInfo; |
| 16 | +import org.jeecg.modules.erp.trade.service.ITblTradeInventoryInService; | ||
| 17 | import org.jeecg.modules.erp.trade.service.ITblTradeTenderInfoService; | 17 | import org.jeecg.modules.erp.trade.service.ITblTradeTenderInfoService; |
| 18 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 18 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| 19 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 19 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| @@ -62,6 +62,8 @@ public class TblTradeBidSubController { | @@ -62,6 +62,8 @@ public class TblTradeBidSubController { | ||
| 62 | private ITblTradeInquiryInfoService tblTradeInquiryInfoService; | 62 | private ITblTradeInquiryInfoService tblTradeInquiryInfoService; |
| 63 | @Autowired | 63 | @Autowired |
| 64 | private ITblTradeTenderInfoService tblTradeTenderInfoService; | 64 | private ITblTradeTenderInfoService tblTradeTenderInfoService; |
| 65 | + @Autowired | ||
| 66 | + private ITblTradeInventoryInService tblTradeInventoryInService; | ||
| 65 | 67 | ||
| 66 | /** | 68 | /** |
| 67 | * 分页列表查询 | 69 | * 分页列表查询 |
| @@ -337,6 +339,42 @@ public class TblTradeBidSubController { | @@ -337,6 +339,42 @@ public class TblTradeBidSubController { | ||
| 337 | return Result.OK(tblTradeInquiryInfoList); | 339 | return Result.OK(tblTradeInquiryInfoList); |
| 338 | } | 340 | } |
| 339 | 341 | ||
| 342 | + /** | ||
| 343 | + * 通过合同号和物料编码查询 | ||
| 344 | + * | ||
| 345 | + * @param tblTradeBidSub | ||
| 346 | + * @return | ||
| 347 | + */ | ||
| 348 | + @ApiOperation(value="通过合同号和物料编码查询", notes="投标表根据合同号和物料编码进行查询订单信息") | ||
| 349 | + @GetMapping(value = "/queryHtInfoByHthAndWlbm") | ||
| 350 | + public Result<TblTradeBidSub> queryHtInfoByHthAndWlbm( TblTradeBidSub tblTradeBidSub) { | ||
| 351 | + QueryWrapper<TblTradeBidSub> queryWrapper = new QueryWrapper<>(); | ||
| 352 | + queryWrapper.eq("hth",tblTradeBidSub.getHth()); | ||
| 353 | + queryWrapper.eq("wlbm",tblTradeBidSub.getWlbm()); | ||
| 354 | + List<TblTradeBidSub> list = tblTradeBidSubService.list(queryWrapper); | ||
| 355 | + | ||
| 356 | + //查询历史入库记录,确认历史入库数量 | ||
| 357 | + | ||
| 358 | + QueryWrapper<TblTradeInventoryIn> wrapper = new QueryWrapper<>(); | ||
| 359 | + wrapper.eq("material_code", tblTradeBidSub.getWlbm()); | ||
| 360 | + wrapper.eq("delivery_contract_number", tblTradeBidSub.getHth()); | ||
| 361 | + //该物料的入库记录 | ||
| 362 | + List<TblTradeInventoryIn> rklog = tblTradeInventoryInService.list(wrapper); | ||
| 363 | + //已入库数量 | ||
| 364 | + Integer yrksl = rklog.stream().map(TblTradeInventoryIn::getInventoryQuantity).reduce(Integer::sum).orElse(0); | ||
| 365 | + | ||
| 366 | + | ||
| 367 | + | ||
| 368 | + if(CollectionUtil.isEmpty(list)) { | ||
| 369 | + return Result.OK(new TblTradeBidSub()); | ||
| 370 | + } | ||
| 371 | + TblTradeBidSub sub = list.get(0); | ||
| 372 | + String sl = sub.getSl(); | ||
| 373 | + int isl = Integer.parseInt(sl); | ||
| 374 | + sub.setSl(String.valueOf(isl-yrksl)); | ||
| 375 | + return Result.OK(list.get(0)); | ||
| 376 | + } | ||
| 377 | + | ||
| 340 | /** | 378 | /** |
| 341 | * 导出excel | 379 | * 导出excel |
| 342 | * | 380 | * |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/trade/controller/TblTradeInventoryController.java
| @@ -5,6 +5,7 @@ import java.util.Arrays; | @@ -5,6 +5,7 @@ import java.util.Arrays; | ||
| 5 | import java.util.Date; | 5 | import java.util.Date; |
| 6 | import java.util.List; | 6 | import java.util.List; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | +import java.util.concurrent.TimeUnit; | ||
| 8 | import java.util.stream.Collectors; | 9 | import java.util.stream.Collectors; |
| 9 | import java.io.IOException; | 10 | import java.io.IOException; |
| 10 | import java.io.UnsupportedEncodingException; | 11 | import java.io.UnsupportedEncodingException; |
| @@ -12,26 +13,27 @@ import java.net.URLDecoder; | @@ -12,26 +13,27 @@ import java.net.URLDecoder; | ||
| 12 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
| 13 | import javax.servlet.http.HttpServletResponse; | 14 | import javax.servlet.http.HttpServletResponse; |
| 14 | 15 | ||
| 16 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 17 | +import cn.hutool.core.date.DatePattern; | ||
| 15 | import cn.hutool.core.date.DateUtil; | 18 | import cn.hutool.core.date.DateUtil; |
| 16 | import org.jeecg.common.api.vo.Result; | 19 | import org.jeecg.common.api.vo.Result; |
| 17 | import org.jeecg.common.system.query.QueryGenerator; | 20 | import org.jeecg.common.system.query.QueryGenerator; |
| 18 | import org.jeecg.common.util.oConvertUtils; | 21 | import org.jeecg.common.util.oConvertUtils; |
| 19 | -import org.jeecg.modules.erp.trade.entity.TblTradeInventory; | ||
| 20 | -import org.jeecg.modules.erp.trade.entity.TblTradeMeterial; | ||
| 21 | -import org.jeecg.modules.erp.trade.service.ITblTradeInventoryService; | 22 | +import org.jeecg.modules.erp.trade.entity.*; |
| 23 | +import org.jeecg.modules.erp.trade.service.*; | ||
| 22 | 24 | ||
| 23 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 25 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 24 | import com.baomidou.mybatisplus.core.metadata.IPage; | 26 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 25 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 27 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 26 | import lombok.extern.slf4j.Slf4j; | 28 | import lombok.extern.slf4j.Slf4j; |
| 27 | 29 | ||
| 28 | -import org.jeecg.modules.erp.trade.service.ITblTradeMeterialService; | ||
| 29 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 30 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| 30 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 31 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| 31 | import org.jeecgframework.poi.excel.entity.ExportParams; | 32 | import org.jeecgframework.poi.excel.entity.ExportParams; |
| 32 | import org.jeecgframework.poi.excel.entity.ImportParams; | 33 | import org.jeecgframework.poi.excel.entity.ImportParams; |
| 33 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 34 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| 34 | import org.jeecg.common.system.base.controller.JeecgController; | 35 | import org.jeecg.common.system.base.controller.JeecgController; |
| 36 | +import org.jetbrains.annotations.Nullable; | ||
| 35 | import org.springframework.beans.factory.annotation.Autowired; | 37 | import org.springframework.beans.factory.annotation.Autowired; |
| 36 | import org.springframework.web.bind.annotation.*; | 38 | import org.springframework.web.bind.annotation.*; |
| 37 | import org.springframework.web.multipart.MultipartFile; | 39 | import org.springframework.web.multipart.MultipartFile; |
| @@ -42,163 +44,338 @@ import io.swagger.annotations.Api; | @@ -42,163 +44,338 @@ import io.swagger.annotations.Api; | ||
| 42 | import io.swagger.annotations.ApiOperation; | 44 | import io.swagger.annotations.ApiOperation; |
| 43 | import org.jeecg.common.aspect.annotation.AutoLog; | 45 | import org.jeecg.common.aspect.annotation.AutoLog; |
| 44 | 46 | ||
| 45 | - /** | 47 | +/** |
| 46 | * @Description: 贸易库存表 | 48 | * @Description: 贸易库存表 |
| 47 | * @Author: jeecg-boot | 49 | * @Author: jeecg-boot |
| 48 | - * @Date: 2024-12-24 | 50 | + * @Date: 2024-12-24 |
| 49 | * @Version: V1.0 | 51 | * @Version: V1.0 |
| 50 | */ | 52 | */ |
| 51 | -@Api(tags="贸易库存表") | 53 | +@Api(tags = "贸易库存表") |
| 52 | @RestController | 54 | @RestController |
| 53 | @RequestMapping("/trade/tblTradeInventory") | 55 | @RequestMapping("/trade/tblTradeInventory") |
| 54 | @Slf4j | 56 | @Slf4j |
| 55 | public class TblTradeInventoryController extends JeecgController<TblTradeInventory, ITblTradeInventoryService> { | 57 | public class TblTradeInventoryController extends JeecgController<TblTradeInventory, ITblTradeInventoryService> { |
| 56 | - @Autowired | ||
| 57 | - private ITblTradeInventoryService tblTradeInventoryService; | ||
| 58 | - @Autowired | ||
| 59 | - private ITblTradeMeterialService tblTradeMeterialService; | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | - * 分页列表查询 | ||
| 63 | - * | ||
| 64 | - * @param tblTradeInventory | ||
| 65 | - * @param pageNo | ||
| 66 | - * @param pageSize | ||
| 67 | - * @param req | ||
| 68 | - * @return | ||
| 69 | - */ | ||
| 70 | - //@AutoLog(value = "贸易库存表-分页列表查询") | ||
| 71 | - @ApiOperation(value="贸易库存表-分页列表查询", notes="贸易库存表-分页列表查询") | ||
| 72 | - @GetMapping(value = "/list") | ||
| 73 | - public Result<IPage<TblTradeInventory>> queryPageList(TblTradeInventory tblTradeInventory, | ||
| 74 | - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
| 75 | - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
| 76 | - HttpServletRequest req) { | ||
| 77 | - QueryWrapper<TblTradeInventory> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeInventory, req.getParameterMap()); | ||
| 78 | - Page<TblTradeInventory> page = new Page<TblTradeInventory>(pageNo, pageSize); | ||
| 79 | - IPage<TblTradeInventory> pageList = tblTradeInventoryService.page(page, queryWrapper); | ||
| 80 | - pageList.getRecords().forEach(e->{ | ||
| 81 | - // 在库天数 | ||
| 82 | - e.setDaysInStock(DateUtil.betweenDay(e.getFirstStorageTime(),new Date(),true)); | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - }); | ||
| 86 | - | ||
| 87 | -// System.out.println(tblTradeInventory.getMaterialDescription()); | ||
| 88 | -// IPage<TblTradeInventory> pageList = new Page<>(); | ||
| 89 | -// TblTradeMeterial tblTradeMeterial = new TblTradeMeterial(); | ||
| 90 | -// tblTradeMeterial.setMeterialReview(tblTradeInventory.getMaterialDescription()); | ||
| 91 | -// QueryWrapper<TblTradeMeterial> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeMeterial, req.getParameterMap()); | ||
| 92 | -// Page<TblTradeMeterial> page = new Page<TblTradeMeterial>(pageNo, pageSize); | ||
| 93 | -// IPage<TblTradeMeterial> pageList1 = tblTradeMeterialService.page(page, queryWrapper); | ||
| 94 | -// | ||
| 95 | -// pageList.setCurrent(pageList1.getCurrent()); | ||
| 96 | -// pageList.setPages(pageList1.getPages()); | ||
| 97 | -// pageList.setSize(pageList1.getSize()); | ||
| 98 | -// pageList.setTotal(pageList1.getTotal()); | ||
| 99 | -// | ||
| 100 | -// List<TblTradeInventory> records = new ArrayList<>(); | ||
| 101 | -// pageList1.getRecords().forEach(e->{ | ||
| 102 | -// TblTradeInventory record = new TblTradeInventory(e); | ||
| 103 | -// records.add(record); | ||
| 104 | -// }); | ||
| 105 | -// | ||
| 106 | -// pageList.setRecords(records); | ||
| 107 | - | ||
| 108 | - return Result.OK(pageList); | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * 添加 | ||
| 113 | - * | ||
| 114 | - * @param tblTradeInventory | ||
| 115 | - * @return | ||
| 116 | - */ | ||
| 117 | - @AutoLog(value = "贸易库存表-添加") | ||
| 118 | - @ApiOperation(value="贸易库存表-添加", notes="贸易库存表-添加") | ||
| 119 | - @PostMapping(value = "/add") | ||
| 120 | - public Result<String> add(@RequestBody TblTradeInventory tblTradeInventory) { | ||
| 121 | - tblTradeInventoryService.save(tblTradeInventory); | ||
| 122 | - return Result.OK("添加成功!"); | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - /** | ||
| 126 | - * 编辑 | ||
| 127 | - * | ||
| 128 | - * @param tblTradeInventory | ||
| 129 | - * @return | ||
| 130 | - */ | ||
| 131 | - @AutoLog(value = "贸易库存表-编辑") | ||
| 132 | - @ApiOperation(value="贸易库存表-编辑", notes="贸易库存表-编辑") | ||
| 133 | - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
| 134 | - public Result<String> edit(@RequestBody TblTradeInventory tblTradeInventory) { | ||
| 135 | - tblTradeInventoryService.updateById(tblTradeInventory); | ||
| 136 | - return Result.OK("编辑成功!"); | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * 通过id删除 | ||
| 141 | - * | ||
| 142 | - * @param id | ||
| 143 | - * @return | ||
| 144 | - */ | ||
| 145 | - @AutoLog(value = "贸易库存表-通过id删除") | ||
| 146 | - @ApiOperation(value="贸易库存表-通过id删除", notes="贸易库存表-通过id删除") | ||
| 147 | - @DeleteMapping(value = "/delete") | ||
| 148 | - public Result<String> delete(@RequestParam(name="id",required=true) String id) { | ||
| 149 | - tblTradeInventoryService.removeById(id); | ||
| 150 | - return Result.OK("删除成功!"); | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - /** | ||
| 154 | - * 批量删除 | ||
| 155 | - * | ||
| 156 | - * @param ids | ||
| 157 | - * @return | ||
| 158 | - */ | ||
| 159 | - @AutoLog(value = "贸易库存表-批量删除") | ||
| 160 | - @ApiOperation(value="贸易库存表-批量删除", notes="贸易库存表-批量删除") | ||
| 161 | - @DeleteMapping(value = "/deleteBatch") | ||
| 162 | - public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
| 163 | - this.tblTradeInventoryService.removeByIds(Arrays.asList(ids.split(","))); | ||
| 164 | - return Result.OK("批量删除成功!"); | ||
| 165 | - } | ||
| 166 | - | ||
| 167 | - /** | ||
| 168 | - * 通过id查询 | ||
| 169 | - * | ||
| 170 | - * @param id | ||
| 171 | - * @return | ||
| 172 | - */ | ||
| 173 | - //@AutoLog(value = "贸易库存表-通过id查询") | ||
| 174 | - @ApiOperation(value="贸易库存表-通过id查询", notes="贸易库存表-通过id查询") | ||
| 175 | - @GetMapping(value = "/queryById") | ||
| 176 | - public Result<TblTradeInventory> queryById(@RequestParam(name="id",required=true) String id) { | ||
| 177 | - TblTradeInventory tblTradeInventory = tblTradeInventoryService.getById(id); | ||
| 178 | - if(tblTradeInventory==null) { | ||
| 179 | - return Result.error("未找到对应数据"); | ||
| 180 | - } | ||
| 181 | - return Result.OK(tblTradeInventory); | ||
| 182 | - } | 58 | + @Autowired |
| 59 | + private ITblTradeInventoryService tblTradeInventoryService; | ||
| 60 | + @Autowired | ||
| 61 | + private ITblTradeMeterialService tblTradeMeterialService; | ||
| 62 | + @Autowired | ||
| 63 | + private ITblTradeInventoryInService tblTradeInventoryInService; | ||
| 64 | + @Autowired | ||
| 65 | + private ITblTradeInventoryOutService tblTradeInventoryOutService; | ||
| 66 | + @Autowired | ||
| 67 | + private ITblTradeBidSubService tblTradeBidSubService; | ||
| 183 | 68 | ||
| 184 | /** | 69 | /** |
| 185 | - * 导出excel | ||
| 186 | - * | ||
| 187 | - * @param request | ||
| 188 | - * @param tblTradeInventory | ||
| 189 | - */ | 70 | + * 分页列表查询 |
| 71 | + * | ||
| 72 | + * @param tblTradeInventory | ||
| 73 | + * @param pageNo | ||
| 74 | + * @param pageSize | ||
| 75 | + * @param req | ||
| 76 | + * @return | ||
| 77 | + */ | ||
| 78 | + //@AutoLog(value = "贸易库存表-分页列表查询") | ||
| 79 | + @ApiOperation(value = "贸易库存表-分页列表查询", notes = "贸易库存表-分页列表查询") | ||
| 80 | + @GetMapping(value = "/list") | ||
| 81 | + public Result<IPage<TblTradeMeterial>> queryPageList(TblTradeInventory tblTradeInventory, | ||
| 82 | + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | ||
| 83 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, | ||
| 84 | + HttpServletRequest req) { | ||
| 85 | + TblTradeMeterial tblTradeMeterial = new TblTradeMeterial(); | ||
| 86 | + tblTradeMeterial.setMeterialReview(tblTradeInventory.getMaterialDescription()); | ||
| 87 | + QueryWrapper<TblTradeMeterial> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeMeterial, req.getParameterMap()); | ||
| 88 | + Page<TblTradeMeterial> page = new Page<TblTradeMeterial>(pageNo, pageSize); | ||
| 89 | + IPage<TblTradeMeterial> pageList = tblTradeMeterialService.page(page, queryWrapper); | ||
| 90 | + List<TblTradeMeterial> records = pageList.getRecords(); | ||
| 91 | + //meterialCode 物料编码list | ||
| 92 | + List<String> collect = records.stream().map(TblTradeMeterial::getMeterialCode).collect(Collectors.toList()); | ||
| 93 | + | ||
| 94 | + //根据物料编码查询库存 | ||
| 95 | + QueryWrapper<TblTradeInventory> tblTradeInventoryQueryWrapper = new QueryWrapper<>(); | ||
| 96 | + if (!CollectionUtil.isEmpty(collect)) { | ||
| 97 | + tblTradeInventoryQueryWrapper.in("material_code", collect); | ||
| 98 | + List<TblTradeInventory> list = tblTradeInventoryService.list(tblTradeInventoryQueryWrapper); | ||
| 99 | + Map<String, TblTradeInventory> inventoryMap = list.stream().collect(Collectors.toMap(TblTradeInventory::getMaterialCode, e -> e)); | ||
| 100 | + | ||
| 101 | + for (TblTradeMeterial record : records) { | ||
| 102 | + record.setActualInventory(inventoryMap.get(record.getMeterialCode()) == null ? 0 : inventoryMap.get(record.getMeterialCode()).getActualInventory() == null ? 0 : inventoryMap.get(record.getMeterialCode()).getActualInventory()); | ||
| 103 | + record.setQuantityInTransit(inventoryMap.get(record.getMeterialCode()) == null ? 0 : inventoryMap.get(record.getMeterialCode()).getQuantityInTransit() == null ? 0 : inventoryMap.get(record.getMeterialCode()).getQuantityInTransit()); | ||
| 104 | + record.setTotalQuantity(inventoryMap.get(record.getMeterialCode()) == null ? 0 : inventoryMap.get(record.getMeterialCode()).getTotalQuantity() == null ? 0 : inventoryMap.get(record.getMeterialCode()).getTotalQuantity()); | ||
| 105 | + record.setFirstStorageTime(inventoryMap.get(record.getMeterialCode()) == null ? null : inventoryMap.get(record.getMeterialCode()).getFirstStorageTime()); | ||
| 106 | + record.setLastOutboundTime(inventoryMap.get(record.getMeterialCode()) == null ? null : inventoryMap.get(record.getMeterialCode()).getLastOutboundTime()); | ||
| 107 | + if (record.getLastOutboundTime() != null) { | ||
| 108 | + long daysDifference = calculateDaysDifference(new Date(), record.getFirstStorageTime()); | ||
| 109 | + record.setDaysInStock((int) daysDifference); | ||
| 110 | + } | ||
| 111 | + if (inventoryMap.get(record.getMeterialCode()) != null) { | ||
| 112 | + TblTradeInventory inventory = inventoryMap.get(record.getMeterialCode()); | ||
| 113 | + Integer actualInventory = inventory.getActualInventory(); | ||
| 114 | + Integer quantityInTransit = inventory.getQuantityInTransit(); | ||
| 115 | + if (actualInventory == null) { | ||
| 116 | + actualInventory = 0; | ||
| 117 | + } | ||
| 118 | + if (quantityInTransit == null) { | ||
| 119 | + quantityInTransit = 0; | ||
| 120 | + } | ||
| 121 | + record.setTotalQuantity(actualInventory + quantityInTransit); | ||
| 122 | + | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + | ||
| 129 | + return Result.OK(pageList); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public static long calculateDaysDifference(Date startDate, Date endDate) { | ||
| 133 | + long diffInMillies = Math.abs(endDate.getTime() - startDate.getTime()); | ||
| 134 | + return TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + | ||
| 138 | + /** | ||
| 139 | + * 添加 | ||
| 140 | + * | ||
| 141 | + * @param tblTradeInventory | ||
| 142 | + * @return | ||
| 143 | + */ | ||
| 144 | + @AutoLog(value = "贸易库存表-添加") | ||
| 145 | + @ApiOperation(value = "贸易库存表-添加", notes = "贸易库存表-添加") | ||
| 146 | + @PostMapping(value = "/add") | ||
| 147 | + public Result<String> add(@RequestBody TblTradeInventory tblTradeInventory) { | ||
| 148 | + //订单验证 | ||
| 149 | + Result<String> error = orderVerification(tblTradeInventory); | ||
| 150 | + if (error != null) return error; | ||
| 151 | + | ||
| 152 | + TblTradeInventoryIn tblTradeInventoryIn = new TblTradeInventoryIn(); | ||
| 153 | + //入库单号 | ||
| 154 | + tblTradeInventoryIn.setWaybillNum("BZSIN" + DatePattern.PURE_DATETIME_FORMAT.format(new Date())); | ||
| 155 | + tblTradeInventoryIn.setMaterialCode(tblTradeInventory.getMaterialCode()); | ||
| 156 | + tblTradeInventoryIn.setMaterialDescription(tblTradeInventory.getMaterialDescription()); | ||
| 157 | + tblTradeInventoryIn.setMeasurementUnit(tblTradeInventory.getMeasurementUnit()); | ||
| 158 | + tblTradeInventoryIn.setBrand(tblTradeInventory.getBrand()); | ||
| 159 | + tblTradeInventoryIn.setInventoryQuantity(tblTradeInventory.getRksl()); | ||
| 160 | + tblTradeInventoryIn.setOperator(tblTradeInventory.getOperator()); | ||
| 161 | + tblTradeInventoryIn.setCreateTime(new Date()); | ||
| 162 | + tblTradeInventoryIn.setUpdateTime(new Date()); | ||
| 163 | + tblTradeInventoryIn.setDeliveryContractNumber(tblTradeInventory.getHth()); | ||
| 164 | + tblTradeInventoryIn.setExpressDeliveryNumber(tblTradeInventory.getWldh()); | ||
| 165 | + tblTradeInventoryIn.setSupplierName(tblTradeInventory.getCs()); | ||
| 166 | + tblTradeInventoryIn.setWarehouse(tblTradeInventory.getWarehouse()); | ||
| 167 | + tblTradeInventoryIn.setType("入库"); | ||
| 168 | + //根据 物流编码 查询库存信息 如存在库存信息则进行修改库存信息,不存在则新增库存信息 | ||
| 169 | + String hth = tblTradeInventory.getHth(); | ||
| 170 | + String materialCode = tblTradeInventory.getMaterialCode(); | ||
| 171 | + QueryWrapper<TblTradeInventory> queryWrapper = new QueryWrapper<>(); | ||
| 172 | + queryWrapper.eq("material_code", materialCode); | ||
| 173 | + //库存信息 | ||
| 174 | + TblTradeInventory tradeInventory = tblTradeInventoryService.getOne(queryWrapper); | ||
| 175 | + Integer kcl = 0; | ||
| 176 | + if (tradeInventory == null) { | ||
| 177 | + kcl = tblTradeInventory.getRksl(); | ||
| 178 | + //新增库存信息 | ||
| 179 | + tblTradeInventory.setCreateTime(new Date()); | ||
| 180 | + tblTradeInventory.setUpdateTime(new Date()); | ||
| 181 | + tblTradeInventory.setFirstStorageTime(new Date()); | ||
| 182 | + tblTradeInventory.setActualInventory(tblTradeInventory.getRksl()); | ||
| 183 | + tblTradeInventoryService.save(tblTradeInventory); | ||
| 184 | + | ||
| 185 | + } else { | ||
| 186 | + //修改库存信息 | ||
| 187 | + tblTradeInventory.setId(tradeInventory.getId()); | ||
| 188 | + tblTradeInventory.setUpdateTime(new Date()); | ||
| 189 | + //当前库存 | ||
| 190 | + Integer actualInventory = tradeInventory.getActualInventory(); | ||
| 191 | + | ||
| 192 | + kcl = tblTradeInventory.getRksl() + actualInventory; | ||
| 193 | + | ||
| 194 | + tblTradeInventory.setActualInventory(kcl); | ||
| 195 | + tblTradeInventoryService.updateById(tblTradeInventory); | ||
| 196 | + | ||
| 197 | + } | ||
| 198 | + //当前库存量 | ||
| 199 | + tblTradeInventoryIn.setActualInventory(kcl); | ||
| 200 | + | ||
| 201 | + //新增入库记录 | ||
| 202 | + tblTradeInventoryInService.save(tblTradeInventoryIn); | ||
| 203 | + | ||
| 204 | + | ||
| 205 | + return Result.OK("添加成功!"); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + @Nullable | ||
| 209 | + private Result<String> orderVerification(TblTradeInventory tblTradeInventory) { | ||
| 210 | + QueryWrapper<TblTradeBidSub> queryWrapper = new QueryWrapper<>(); | ||
| 211 | + queryWrapper.eq("hth",tblTradeInventory.getHth()); | ||
| 212 | + queryWrapper.eq("wlbm",tblTradeInventory.getMaterialCode()); | ||
| 213 | + List<TblTradeBidSub> list = tblTradeBidSubService.list(queryWrapper); | ||
| 214 | + if (CollectionUtil.isEmpty(list)) { | ||
| 215 | + return Result.error("该订单不存在!"); | ||
| 216 | + } | ||
| 217 | + if (list.size() > 1) { | ||
| 218 | + return Result.error("存在多个相同订单!"); | ||
| 219 | + } | ||
| 220 | + //订单信息 | ||
| 221 | + TblTradeBidSub tblTradeBidSub = list.get(0); | ||
| 222 | + //订单数量 | ||
| 223 | + String sl = tblTradeBidSub.getSl(); | ||
| 224 | + //本次入库数量 | ||
| 225 | + Integer rksl = tblTradeInventory.getRksl(); | ||
| 226 | + if (rksl > Integer.parseInt(sl)){ | ||
| 227 | + return Result.error("添加失败,入库数量大于订单数量!"); | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + //获取历史入库记录 | ||
| 231 | + | ||
| 232 | + String code = tblTradeInventory.getMaterialCode(); | ||
| 233 | + QueryWrapper<TblTradeInventoryIn> wrapper = new QueryWrapper<>(); | ||
| 234 | + wrapper.eq("material_code", code); | ||
| 235 | + wrapper.eq("delivery_contract_number", tblTradeInventory.getHth()); | ||
| 236 | + //该物料的入库记录 | ||
| 237 | + List<TblTradeInventoryIn> rklog = tblTradeInventoryInService.list(wrapper); | ||
| 238 | + //已入库数量 | ||
| 239 | + Integer yrksl = rklog.stream().map(TblTradeInventoryIn::getInventoryQuantity).reduce(Integer::sum).orElse(0); | ||
| 240 | + | ||
| 241 | + //预计本次入库数量 | ||
| 242 | + int yjsl = yrksl + rksl; | ||
| 243 | + if (yjsl > Integer.parseInt(sl)) { | ||
| 244 | + return Result.error("添加失败,入库数量大于订单数量!"); | ||
| 245 | + } | ||
| 246 | + return null; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + | ||
| 250 | + /** | ||
| 251 | + * 出库 | ||
| 252 | + * | ||
| 253 | + * @param tblTradeInventory | ||
| 254 | + * @return | ||
| 255 | + */ | ||
| 256 | + @AutoLog(value = "出库") | ||
| 257 | + @ApiOperation(value = "出库", notes = "出库") | ||
| 258 | + @PostMapping(value = "/out") | ||
| 259 | + public Result<String> out(@RequestBody TblTradeInventory tblTradeInventory) { | ||
| 260 | + //根据物料编码获取库存信息 | ||
| 261 | + String materialCode = tblTradeInventory.getMaterialCode(); | ||
| 262 | + QueryWrapper<TblTradeInventory> queryWrapper = new QueryWrapper<>(); | ||
| 263 | + queryWrapper.eq("material_code", materialCode); | ||
| 264 | + //库存信息 | ||
| 265 | + TblTradeInventory tradeInventory = tblTradeInventoryService.getOne(queryWrapper); | ||
| 266 | + if (tradeInventory == null) { | ||
| 267 | + return Result.error("出库失败,该物料库存信息不存在!"); | ||
| 268 | + } | ||
| 269 | + //比对库存剩余数量和出库数量,做校验 | ||
| 270 | + Integer outboundQuantity = tblTradeInventory.getOutboundQuantity(); | ||
| 271 | + if (outboundQuantity > tradeInventory.getActualInventory()) { | ||
| 272 | + return Result.error("出库失败,出库数量大于库存数量!"); | ||
| 273 | + } | ||
| 274 | + //出库 | ||
| 275 | + tradeInventory.setActualInventory(tradeInventory.getActualInventory() - outboundQuantity); | ||
| 276 | + tradeInventory.setLastOutboundTime(new Date()); | ||
| 277 | + tblTradeInventoryService.updateById(tradeInventory); | ||
| 278 | + | ||
| 279 | + | ||
| 280 | + //记录出库记录 | ||
| 281 | + TblTradeInventoryOut tblTradeInventoryOut = new TblTradeInventoryOut(); | ||
| 282 | + tblTradeInventoryOut.setWaybillNumOut("BZSIN" + DatePattern.PURE_DATETIME_FORMAT.format(new Date())); | ||
| 283 | + tblTradeInventoryOut.setMaterialCode(tblTradeInventory.getMaterialCode()); | ||
| 284 | + tblTradeInventoryOut.setMaterialDescription(tblTradeInventory.getMaterialDescription()); | ||
| 285 | + tblTradeInventoryOut.setMeasurementUnit(tblTradeInventory.getMeasurementUnit()); | ||
| 286 | + tblTradeInventoryOut.setBrand(tblTradeInventory.getBrand()); | ||
| 287 | + tblTradeInventoryOut.setSalesman(tblTradeInventory.getSalesman()); | ||
| 288 | + tblTradeInventoryOut.setCreateTime(new Date()); | ||
| 289 | + tblTradeInventoryOut.setUpdateTime(new Date()); | ||
| 290 | + tblTradeInventoryOut.setExpressDeliveryNumber(tblTradeInventory.getExpressDeliveryNumber()); | ||
| 291 | + tblTradeInventoryOut.setDeliveryContractNumber(tblTradeInventory.getDeliveryContractNumber()); | ||
| 292 | + tblTradeInventoryOut.setWarehouse(tblTradeInventory.getWarehouse()); | ||
| 293 | + tblTradeInventoryOut.setOutboundQuantity(outboundQuantity); | ||
| 294 | + tblTradeInventoryOut.setDemandUnit(tblTradeInventory.getDemandUnit()); | ||
| 295 | + tblTradeInventoryOut.setActualInventory(tradeInventory.getActualInventory()); | ||
| 296 | + tblTradeInventoryOutService.save(tblTradeInventoryOut); | ||
| 297 | + | ||
| 298 | + return Result.OK("出库成功!"); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + | ||
| 302 | + /** | ||
| 303 | + * 编辑 | ||
| 304 | + * | ||
| 305 | + * @param tblTradeInventory | ||
| 306 | + * @return | ||
| 307 | + */ | ||
| 308 | + @AutoLog(value = "贸易库存表-编辑") | ||
| 309 | + @ApiOperation(value = "贸易库存表-编辑", notes = "贸易库存表-编辑") | ||
| 310 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) | ||
| 311 | + public Result<String> edit(@RequestBody TblTradeInventory tblTradeInventory) { | ||
| 312 | + tblTradeInventoryService.updateById(tblTradeInventory); | ||
| 313 | + return Result.OK("编辑成功!"); | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + /** | ||
| 317 | + * 通过id删除 | ||
| 318 | + * | ||
| 319 | + * @param id | ||
| 320 | + * @return | ||
| 321 | + */ | ||
| 322 | + @AutoLog(value = "贸易库存表-通过id删除") | ||
| 323 | + @ApiOperation(value = "贸易库存表-通过id删除", notes = "贸易库存表-通过id删除") | ||
| 324 | + @DeleteMapping(value = "/delete") | ||
| 325 | + public Result<String> delete(@RequestParam(name = "id", required = true) String id) { | ||
| 326 | + tblTradeInventoryService.removeById(id); | ||
| 327 | + return Result.OK("删除成功!"); | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + /** | ||
| 331 | + * 批量删除 | ||
| 332 | + * | ||
| 333 | + * @param ids | ||
| 334 | + * @return | ||
| 335 | + */ | ||
| 336 | + @AutoLog(value = "贸易库存表-批量删除") | ||
| 337 | + @ApiOperation(value = "贸易库存表-批量删除", notes = "贸易库存表-批量删除") | ||
| 338 | + @DeleteMapping(value = "/deleteBatch") | ||
| 339 | + public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { | ||
| 340 | + this.tblTradeInventoryService.removeByIds(Arrays.asList(ids.split(","))); | ||
| 341 | + return Result.OK("批量删除成功!"); | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + /** | ||
| 345 | + * 通过id查询 | ||
| 346 | + * | ||
| 347 | + * @param id | ||
| 348 | + * @return | ||
| 349 | + */ | ||
| 350 | + //@AutoLog(value = "贸易库存表-通过id查询") | ||
| 351 | + @ApiOperation(value = "贸易库存表-通过id查询", notes = "贸易库存表-通过id查询") | ||
| 352 | + @GetMapping(value = "/queryById") | ||
| 353 | + public Result<TblTradeInventory> queryById(@RequestParam(name = "id", required = true) String id) { | ||
| 354 | + TblTradeInventory tblTradeInventory = tblTradeInventoryService.getById(id); | ||
| 355 | + if (tblTradeInventory == null) { | ||
| 356 | + return Result.error("未找到对应数据"); | ||
| 357 | + } | ||
| 358 | + return Result.OK(tblTradeInventory); | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + /** | ||
| 362 | + * 导出excel | ||
| 363 | + * | ||
| 364 | + * @param request | ||
| 365 | + * @param tblTradeInventory | ||
| 366 | + */ | ||
| 190 | @RequestMapping(value = "/exportXls") | 367 | @RequestMapping(value = "/exportXls") |
| 191 | public ModelAndView exportXls(HttpServletRequest request, TblTradeInventory tblTradeInventory) { | 368 | public ModelAndView exportXls(HttpServletRequest request, TblTradeInventory tblTradeInventory) { |
| 192 | return super.exportXls(request, tblTradeInventory, TblTradeInventory.class, "贸易库存表"); | 369 | return super.exportXls(request, tblTradeInventory, TblTradeInventory.class, "贸易库存表"); |
| 193 | } | 370 | } |
| 194 | 371 | ||
| 195 | /** | 372 | /** |
| 196 | - * 通过excel导入数据 | ||
| 197 | - * | ||
| 198 | - * @param request | ||
| 199 | - * @param response | ||
| 200 | - * @return | ||
| 201 | - */ | 373 | + * 通过excel导入数据 |
| 374 | + * | ||
| 375 | + * @param request | ||
| 376 | + * @param response | ||
| 377 | + * @return | ||
| 378 | + */ | ||
| 202 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | 379 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| 203 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | 380 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| 204 | return super.importExcel(request, response, TblTradeInventory.class); | 381 | return super.importExcel(request, response, TblTradeInventory.class); |
| 1 | package org.jeecg.modules.erp.trade.controller; | 1 | package org.jeecg.modules.erp.trade.controller; |
| 2 | 2 | ||
| 3 | import java.util.Arrays; | 3 | import java.util.Arrays; |
| 4 | +import java.util.Date; | ||
| 4 | import java.util.List; | 5 | import java.util.List; |
| 5 | import java.util.Map; | 6 | import java.util.Map; |
| 6 | import java.util.stream.Collectors; | 7 | import java.util.stream.Collectors; |
| @@ -9,6 +10,8 @@ import java.io.UnsupportedEncodingException; | @@ -9,6 +10,8 @@ import java.io.UnsupportedEncodingException; | ||
| 9 | import java.net.URLDecoder; | 10 | import java.net.URLDecoder; |
| 10 | import javax.servlet.http.HttpServletRequest; | 11 | import javax.servlet.http.HttpServletRequest; |
| 11 | import javax.servlet.http.HttpServletResponse; | 12 | import javax.servlet.http.HttpServletResponse; |
| 13 | + | ||
| 14 | +import cn.hutool.core.date.DatePattern; | ||
| 12 | import org.jeecg.common.api.vo.Result; | 15 | import org.jeecg.common.api.vo.Result; |
| 13 | import org.jeecg.common.system.query.QueryGenerator; | 16 | import org.jeecg.common.system.query.QueryGenerator; |
| 14 | import org.jeecg.common.util.oConvertUtils; | 17 | import org.jeecg.common.util.oConvertUtils; |
| @@ -82,6 +85,7 @@ public class TblTradeInventoryDefectiveProductController extends JeecgController | @@ -82,6 +85,7 @@ public class TblTradeInventoryDefectiveProductController extends JeecgController | ||
| 82 | @ApiOperation(value="不良品库-添加", notes="不良品库-添加") | 85 | @ApiOperation(value="不良品库-添加", notes="不良品库-添加") |
| 83 | @PostMapping(value = "/add") | 86 | @PostMapping(value = "/add") |
| 84 | public Result<String> add(@RequestBody TblTradeInventoryDefectiveProduct tblTradeInventoryDefectiveProduct) { | 87 | public Result<String> add(@RequestBody TblTradeInventoryDefectiveProduct tblTradeInventoryDefectiveProduct) { |
| 88 | + tblTradeInventoryDefectiveProduct.setWaybillNum("BZSOUT"+ DatePattern.PURE_DATETIME_FORMAT.format(new Date())); | ||
| 85 | tblTradeInventoryDefectiveProductService.save(tblTradeInventoryDefectiveProduct); | 89 | tblTradeInventoryDefectiveProductService.save(tblTradeInventoryDefectiveProduct); |
| 86 | return Result.OK("添加成功!"); | 90 | return Result.OK("添加成功!"); |
| 87 | } | 91 | } |
| 1 | package org.jeecg.modules.erp.trade.controller; | 1 | package org.jeecg.modules.erp.trade.controller; |
| 2 | 2 | ||
| 3 | -import java.util.Arrays; | ||
| 4 | -import java.util.List; | ||
| 5 | -import java.util.Map; | 3 | +import java.util.*; |
| 6 | import java.util.stream.Collectors; | 4 | import java.util.stream.Collectors; |
| 7 | import java.io.IOException; | 5 | import java.io.IOException; |
| 8 | import java.io.UnsupportedEncodingException; | 6 | import java.io.UnsupportedEncodingException; |
| 9 | import java.net.URLDecoder; | 7 | import java.net.URLDecoder; |
| 10 | import javax.servlet.http.HttpServletRequest; | 8 | import javax.servlet.http.HttpServletRequest; |
| 11 | import javax.servlet.http.HttpServletResponse; | 9 | import javax.servlet.http.HttpServletResponse; |
| 10 | + | ||
| 11 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 12 | +import org.apache.commons.lang3.StringUtils; | ||
| 12 | import org.jeecg.common.api.vo.Result; | 13 | import org.jeecg.common.api.vo.Result; |
| 13 | import org.jeecg.common.system.query.QueryGenerator; | 14 | import org.jeecg.common.system.query.QueryGenerator; |
| 14 | import org.jeecg.common.util.oConvertUtils; | 15 | import org.jeecg.common.util.oConvertUtils; |
| 15 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; | 16 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; |
| 17 | +import org.jeecg.modules.erp.trade.entity.TblTradeInventoryOut; | ||
| 16 | import org.jeecg.modules.erp.trade.service.ITblTradeInventoryInService; | 18 | import org.jeecg.modules.erp.trade.service.ITblTradeInventoryInService; |
| 17 | 19 | ||
| 18 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 20 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| @@ -20,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | @@ -20,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 20 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 22 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 21 | import lombok.extern.slf4j.Slf4j; | 23 | import lombok.extern.slf4j.Slf4j; |
| 22 | 24 | ||
| 25 | +import org.jeecg.modules.erp.trade.service.ITblTradeInventoryOutService; | ||
| 23 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 26 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| 24 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 27 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| 25 | import org.jeecgframework.poi.excel.entity.ExportParams; | 28 | import org.jeecgframework.poi.excel.entity.ExportParams; |
| @@ -49,6 +52,8 @@ import org.jeecg.common.aspect.annotation.AutoLog; | @@ -49,6 +52,8 @@ import org.jeecg.common.aspect.annotation.AutoLog; | ||
| 49 | public class TblTradeInventoryInController extends JeecgController<TblTradeInventoryIn, ITblTradeInventoryInService> { | 52 | public class TblTradeInventoryInController extends JeecgController<TblTradeInventoryIn, ITblTradeInventoryInService> { |
| 50 | @Autowired | 53 | @Autowired |
| 51 | private ITblTradeInventoryInService tblTradeInventoryInService; | 54 | private ITblTradeInventoryInService tblTradeInventoryInService; |
| 55 | + @Autowired | ||
| 56 | + private ITblTradeInventoryOutService tblTradeInventoryOutService; | ||
| 52 | 57 | ||
| 53 | /** | 58 | /** |
| 54 | * 分页列表查询 | 59 | * 分页列表查询 |
| @@ -66,9 +71,18 @@ public class TblTradeInventoryInController extends JeecgController<TblTradeInven | @@ -66,9 +71,18 @@ public class TblTradeInventoryInController extends JeecgController<TblTradeInven | ||
| 66 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 71 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| 67 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 72 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| 68 | HttpServletRequest req) { | 73 | HttpServletRequest req) { |
| 69 | - QueryWrapper<TblTradeInventoryIn> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeInventoryIn, req.getParameterMap()); | 74 | + IPage<TblTradeInventoryIn> pageList = null; |
| 70 | Page<TblTradeInventoryIn> page = new Page<TblTradeInventoryIn>(pageNo, pageSize); | 75 | Page<TblTradeInventoryIn> page = new Page<TblTradeInventoryIn>(pageNo, pageSize); |
| 71 | - IPage<TblTradeInventoryIn> pageList = tblTradeInventoryInService.page(page, queryWrapper); | 76 | + if (StringUtils.isNotBlank(tblTradeInventoryIn.getType()) && "出库".equals(tblTradeInventoryIn.getType())) { |
| 77 | + pageList = tblTradeInventoryInService.ckPageList(page, tblTradeInventoryIn); | ||
| 78 | + } else if (StringUtils.isNotBlank(tblTradeInventoryIn.getType()) && "入库".equals(tblTradeInventoryIn.getType())) { | ||
| 79 | + pageList = tblTradeInventoryInService.rkPageList(page, tblTradeInventoryIn); | ||
| 80 | + } else { | ||
| 81 | + pageList = tblTradeInventoryInService.pageList(page, tblTradeInventoryIn); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + | ||
| 72 | return Result.OK(pageList); | 86 | return Result.OK(pageList); |
| 73 | } | 87 | } |
| 74 | 88 |
| @@ -11,6 +11,7 @@ import java.net.URLDecoder; | @@ -11,6 +11,7 @@ import java.net.URLDecoder; | ||
| 11 | import javax.servlet.http.HttpServletRequest; | 11 | import javax.servlet.http.HttpServletRequest; |
| 12 | import javax.servlet.http.HttpServletResponse; | 12 | import javax.servlet.http.HttpServletResponse; |
| 13 | 13 | ||
| 14 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 14 | import cn.hutool.core.util.StrUtil; | 15 | import cn.hutool.core.util.StrUtil; |
| 15 | import org.jeecg.common.api.vo.Result; | 16 | import org.jeecg.common.api.vo.Result; |
| 16 | import org.jeecg.common.system.query.QueryGenerator; | 17 | import org.jeecg.common.system.query.QueryGenerator; |
| @@ -56,6 +57,23 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial | @@ -56,6 +57,23 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial | ||
| 56 | private ITblTradeMeterialService tblTradeMeterialService; | 57 | private ITblTradeMeterialService tblTradeMeterialService; |
| 57 | @Autowired | 58 | @Autowired |
| 58 | private ITblTradeInventoryService tblTradeInventoryService; | 59 | private ITblTradeInventoryService tblTradeInventoryService; |
| 60 | + | ||
| 61 | + | ||
| 62 | + @ApiOperation(value = "根据物料编号查询物料基础信息", notes = "根据物料编号查询物料基础信息") | ||
| 63 | + @GetMapping(value = "/queryByMaterialCode") | ||
| 64 | + public Result<TblTradeMeterial> queryByMaterialCode(TblTradeMeterial tblTradeMeterial){ | ||
| 65 | + String meterialCode = tblTradeMeterial.getMeterialCode(); | ||
| 66 | + QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>(); | ||
| 67 | + queryWrapper.eq("meterial_code", meterialCode); | ||
| 68 | + List<TblTradeMeterial> list = tblTradeMeterialService.list(queryWrapper); | ||
| 69 | + if (CollectionUtil.isEmpty(list)) { | ||
| 70 | + return Result.error("未找到对应物料信息"); | ||
| 71 | + } | ||
| 72 | + if (list.size() > 1) { | ||
| 73 | + return Result.error("物料编码重复,请联系管理员"); | ||
| 74 | + } | ||
| 75 | + return Result.OK(list.get(0)); | ||
| 76 | + } | ||
| 59 | 77 | ||
| 60 | /** | 78 | /** |
| 61 | * 分页列表查询 | 79 | * 分页列表查询 |
| @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; | @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; | ||
| 5 | import java.util.Date; | 5 | import java.util.Date; |
| 6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
| 7 | import com.baomidou.mybatisplus.annotation.IdType; | 7 | import com.baomidou.mybatisplus.annotation.IdType; |
| 8 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 8 | import com.baomidou.mybatisplus.annotation.TableId; | 9 | import com.baomidou.mybatisplus.annotation.TableId; |
| 9 | import com.baomidou.mybatisplus.annotation.TableName; | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
| 10 | import lombok.Data; | 11 | import lombok.Data; |
| @@ -76,14 +77,14 @@ public class TblTradeInventory implements Serializable { | @@ -76,14 +77,14 @@ public class TblTradeInventory implements Serializable { | ||
| 76 | @ApiModelProperty(value = "总价(不含税,元)") | 77 | @ApiModelProperty(value = "总价(不含税,元)") |
| 77 | private java.math.BigDecimal totalPrice; | 78 | private java.math.BigDecimal totalPrice; |
| 78 | /**首次入库时间*/ | 79 | /**首次入库时间*/ |
| 79 | - @Excel(name = "首次入库时间", width = 15, format = "yyyy-MM-dd") | ||
| 80 | - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | 80 | + @Excel(name = "首次入库时间", width = 15, format = "yyyy-MM-dd HH:mm:ss") |
| 81 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 81 | @DateTimeFormat(pattern="yyyy-MM-dd") | 82 | @DateTimeFormat(pattern="yyyy-MM-dd") |
| 82 | @ApiModelProperty(value = "首次入库时间") | 83 | @ApiModelProperty(value = "首次入库时间") |
| 83 | private java.util.Date firstStorageTime; | 84 | private java.util.Date firstStorageTime; |
| 84 | /**最后一次出库时间*/ | 85 | /**最后一次出库时间*/ |
| 85 | - @Excel(name = "最后一次出库时间", width = 15, format = "yyyy-MM-dd") | ||
| 86 | - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | 86 | + @Excel(name = "最后一次出库时间", width = 15, format = "yyyy-MM-dd HH:mm:ss") |
| 87 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 87 | @DateTimeFormat(pattern="yyyy-MM-dd") | 88 | @DateTimeFormat(pattern="yyyy-MM-dd") |
| 88 | @ApiModelProperty(value = "最后一次出库时间") | 89 | @ApiModelProperty(value = "最后一次出库时间") |
| 89 | private java.util.Date lastOutboundTime; | 90 | private java.util.Date lastOutboundTime; |
| @@ -95,19 +96,58 @@ public class TblTradeInventory implements Serializable { | @@ -95,19 +96,58 @@ public class TblTradeInventory implements Serializable { | ||
| 95 | @ApiModelProperty(value = "创建人") | 96 | @ApiModelProperty(value = "创建人") |
| 96 | private java.lang.String createBy; | 97 | private java.lang.String createBy; |
| 97 | /**创建日期*/ | 98 | /**创建日期*/ |
| 98 | - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 99 | - @DateTimeFormat(pattern="yyyy-MM-dd") | 99 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| 100 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 100 | @ApiModelProperty(value = "创建日期") | 101 | @ApiModelProperty(value = "创建日期") |
| 101 | private java.util.Date createTime; | 102 | private java.util.Date createTime; |
| 102 | /**更新人*/ | 103 | /**更新人*/ |
| 103 | @ApiModelProperty(value = "更新人") | 104 | @ApiModelProperty(value = "更新人") |
| 104 | private java.lang.String updateBy; | 105 | private java.lang.String updateBy; |
| 105 | /**更新日期*/ | 106 | /**更新日期*/ |
| 106 | - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 107 | - @DateTimeFormat(pattern="yyyy-MM-dd") | 107 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| 108 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 108 | @ApiModelProperty(value = "更新日期") | 109 | @ApiModelProperty(value = "更新日期") |
| 109 | private java.util.Date updateTime; | 110 | private java.util.Date updateTime; |
| 110 | 111 | ||
| 112 | + @ApiModelProperty(value = "合同/订单号") | ||
| 113 | + private String hth; | ||
| 114 | + @ApiModelProperty(value = "物流单号") | ||
| 115 | + private String wldh; | ||
| 116 | + @ApiModelProperty(value = "供货商名称") | ||
| 117 | + private String cs; | ||
| 118 | + @ApiModelProperty(value = "仓库") | ||
| 119 | + private String warehouse; | ||
| 120 | + @ApiModelProperty(value = "采购员") | ||
| 121 | + private String operator; | ||
| 122 | + @TableField(exist = false) | ||
| 123 | + @ApiModelProperty(value = "采购员") | ||
| 124 | + private String salesman; | ||
| 125 | + @TableField(exist = false) | ||
| 126 | + @ApiModelProperty(value = "入库数量") | ||
| 127 | + private Integer rksl; | ||
| 128 | + @TableField(exist = false) | ||
| 129 | + @ApiModelProperty(value = "不良品数量") | ||
| 130 | + private String blpsl; | ||
| 131 | + @TableField(exist = false) | ||
| 132 | + @ApiModelProperty(value = "异常原因") | ||
| 133 | + private String ycyy; | ||
| 134 | + | ||
| 135 | + @TableField(exist = false) | ||
| 136 | + @ApiModelProperty(value = "出库数量") | ||
| 137 | + private Integer outboundQuantity; | ||
| 138 | + | ||
| 139 | + @TableField(exist = false) | ||
| 140 | + @ApiModelProperty(value = "供应商合同号") | ||
| 141 | + private String expressDeliveryNumber; | ||
| 142 | + | ||
| 143 | + @TableField(exist = false) | ||
| 144 | + @ApiModelProperty(value = "需求单位") | ||
| 145 | + private String demandUnit; | ||
| 146 | + | ||
| 147 | + @TableField(exist = false) | ||
| 148 | + @ApiModelProperty(value = "中标合同编号") | ||
| 149 | + private String deliveryContractNumber; | ||
| 150 | + | ||
| 111 | 151 | ||
| 112 | public TblTradeInventory(){} | 152 | public TblTradeInventory(){} |
| 113 | 153 |
| @@ -111,4 +111,20 @@ public class TblTradeInventoryDefectiveProduct implements Serializable { | @@ -111,4 +111,20 @@ public class TblTradeInventoryDefectiveProduct implements Serializable { | ||
| 111 | @DateTimeFormat(pattern="yyyy-MM-dd") | 111 | @DateTimeFormat(pattern="yyyy-MM-dd") |
| 112 | @ApiModelProperty(value = "更新日期") | 112 | @ApiModelProperty(value = "更新日期") |
| 113 | private java.util.Date updateTime; | 113 | private java.util.Date updateTime; |
| 114 | + /**不良品数量*/ | ||
| 115 | + @Excel(name = "不良品数量", width = 15) | ||
| 116 | + @ApiModelProperty(value = "不良品数量") | ||
| 117 | + private Integer blpsl; | ||
| 118 | + /**异常原因*/ | ||
| 119 | + @Excel(name = "异常原因", width = 15) | ||
| 120 | + @ApiModelProperty(value = "异常原因") | ||
| 121 | + private Integer ycyy; | ||
| 122 | + /**退换货标志 1:退货 2:换货*/ | ||
| 123 | + @Excel(name = "退换货标志", width = 15) | ||
| 124 | + @ApiModelProperty(value = "退换货标志") | ||
| 125 | + private Integer thFlag; | ||
| 126 | + /**退换货单号*/ | ||
| 127 | + @Excel(name = "退换货单号", width = 15) | ||
| 128 | + @ApiModelProperty(value = "退换货单号") | ||
| 129 | + private String thNum; | ||
| 114 | } | 130 | } |
| @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; | @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; | ||
| 5 | import java.util.Date; | 5 | import java.util.Date; |
| 6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
| 7 | import com.baomidou.mybatisplus.annotation.IdType; | 7 | import com.baomidou.mybatisplus.annotation.IdType; |
| 8 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 8 | import com.baomidou.mybatisplus.annotation.TableId; | 9 | import com.baomidou.mybatisplus.annotation.TableId; |
| 9 | import com.baomidou.mybatisplus.annotation.TableName; | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
| 10 | import lombok.Data; | 11 | import lombok.Data; |
| @@ -58,11 +59,11 @@ public class TblTradeInventoryIn implements Serializable { | @@ -58,11 +59,11 @@ public class TblTradeInventoryIn implements Serializable { | ||
| 58 | /**库存量*/ | 59 | /**库存量*/ |
| 59 | @Excel(name = "库存量", width = 15) | 60 | @Excel(name = "库存量", width = 15) |
| 60 | @ApiModelProperty(value = "库存量") | 61 | @ApiModelProperty(value = "库存量") |
| 61 | - private java.lang.String actualInventory; | 62 | + private Integer actualInventory; |
| 62 | /**出/入库数量*/ | 63 | /**出/入库数量*/ |
| 63 | @Excel(name = "出/入库数量", width = 15) | 64 | @Excel(name = "出/入库数量", width = 15) |
| 64 | @ApiModelProperty(value = "出/入库数量") | 65 | @ApiModelProperty(value = "出/入库数量") |
| 65 | - private java.lang.String inventoryQuantity; | 66 | + private Integer inventoryQuantity; |
| 66 | /**采购/销售*/ | 67 | /**采购/销售*/ |
| 67 | @Excel(name = "采购/销售", width = 15) | 68 | @Excel(name = "采购/销售", width = 15) |
| 68 | @ApiModelProperty(value = "采购/销售") | 69 | @ApiModelProperty(value = "采购/销售") |
| @@ -98,17 +99,21 @@ public class TblTradeInventoryIn implements Serializable { | @@ -98,17 +99,21 @@ public class TblTradeInventoryIn implements Serializable { | ||
| 98 | /**创建人*/ | 99 | /**创建人*/ |
| 99 | @ApiModelProperty(value = "创建人") | 100 | @ApiModelProperty(value = "创建人") |
| 100 | private java.lang.String createBy; | 101 | private java.lang.String createBy; |
| 102 | + /**创建人*/ | ||
| 103 | + @ApiModelProperty(value = "销售员") | ||
| 104 | + @TableField(exist = false) | ||
| 105 | + private java.lang.String salesman; | ||
| 101 | /**创建日期*/ | 106 | /**创建日期*/ |
| 102 | - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 103 | - @DateTimeFormat(pattern="yyyy-MM-dd") | 107 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| 108 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 104 | @ApiModelProperty(value = "创建日期") | 109 | @ApiModelProperty(value = "创建日期") |
| 105 | private java.util.Date createTime; | 110 | private java.util.Date createTime; |
| 106 | /**更新人*/ | 111 | /**更新人*/ |
| 107 | @ApiModelProperty(value = "更新人") | 112 | @ApiModelProperty(value = "更新人") |
| 108 | private java.lang.String updateBy; | 113 | private java.lang.String updateBy; |
| 109 | /**更新日期*/ | 114 | /**更新日期*/ |
| 110 | - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 111 | - @DateTimeFormat(pattern="yyyy-MM-dd") | 115 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| 116 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 112 | @ApiModelProperty(value = "更新日期") | 117 | @ApiModelProperty(value = "更新日期") |
| 113 | private java.util.Date updateTime; | 118 | private java.util.Date updateTime; |
| 114 | } | 119 | } |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/trade/entity/TblTradeInventoryOut.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.trade.entity; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | +import java.io.UnsupportedEncodingException; | ||
| 5 | +import java.util.Date; | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 9 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 10 | +import lombok.Data; | ||
| 11 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 12 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 13 | +import org.jeecgframework.poi.excel.annotation.Excel; | ||
| 14 | +import org.jeecg.common.aspect.annotation.Dict; | ||
| 15 | +import io.swagger.annotations.ApiModel; | ||
| 16 | +import io.swagger.annotations.ApiModelProperty; | ||
| 17 | +import lombok.EqualsAndHashCode; | ||
| 18 | +import lombok.experimental.Accessors; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * @Description: tbl_trade_inventory_out | ||
| 22 | + * @Author: jeecg-boot | ||
| 23 | + * @Date: 2025-03-12 | ||
| 24 | + * @Version: V1.0 | ||
| 25 | + */ | ||
| 26 | +@Data | ||
| 27 | +@TableName("tbl_trade_inventory_out") | ||
| 28 | +@Accessors(chain = true) | ||
| 29 | +@EqualsAndHashCode(callSuper = false) | ||
| 30 | +@ApiModel(value="tbl_trade_inventory_out对象", description="tbl_trade_inventory_out") | ||
| 31 | +public class TblTradeInventoryOut implements Serializable { | ||
| 32 | + private static final long serialVersionUID = 1L; | ||
| 33 | + | ||
| 34 | + /**id*/ | ||
| 35 | + @TableId(type = IdType.ASSIGN_ID) | ||
| 36 | + @ApiModelProperty(value = "id") | ||
| 37 | + private String id; | ||
| 38 | + /**出库单号*/ | ||
| 39 | + @Excel(name = "出库单号", width = 15) | ||
| 40 | + @ApiModelProperty(value = "出库单号") | ||
| 41 | + private String waybillNumOut; | ||
| 42 | + /**物料编码*/ | ||
| 43 | + @Excel(name = "物料编码", width = 15) | ||
| 44 | + @ApiModelProperty(value = "物料编码") | ||
| 45 | + private String materialCode; | ||
| 46 | + /**物料描述*/ | ||
| 47 | + @Excel(name = "物料描述", width = 15) | ||
| 48 | + @ApiModelProperty(value = "物料描述") | ||
| 49 | + private String materialDescription; | ||
| 50 | + /**计量单位*/ | ||
| 51 | + @Excel(name = "计量单位", width = 15) | ||
| 52 | + @ApiModelProperty(value = "计量单位") | ||
| 53 | + private String measurementUnit; | ||
| 54 | + /**品牌*/ | ||
| 55 | + @Excel(name = "品牌", width = 15) | ||
| 56 | + @ApiModelProperty(value = "品牌") | ||
| 57 | + private String brand; | ||
| 58 | + /**实际库存量*/ | ||
| 59 | + @Excel(name = "实际库存量", width = 15) | ||
| 60 | + @ApiModelProperty(value = "实际库存量") | ||
| 61 | + private Integer actualInventory; | ||
| 62 | + /**出库数量*/ | ||
| 63 | + @Excel(name = "出库数量", width = 15) | ||
| 64 | + @ApiModelProperty(value = "出库数量") | ||
| 65 | + private Integer outboundQuantity; | ||
| 66 | + /**总数量*/ | ||
| 67 | + @Excel(name = "总数量", width = 15) | ||
| 68 | + @ApiModelProperty(value = "总数量") | ||
| 69 | + private String totalQuantity; | ||
| 70 | + /**操作人*/ | ||
| 71 | + @Excel(name = "操作人", width = 15) | ||
| 72 | + @ApiModelProperty(value = "操作人") | ||
| 73 | + private String operator; | ||
| 74 | + /**合同单号/快递单号*/ | ||
| 75 | + @Excel(name = "合同单号/快递单号", width = 15) | ||
| 76 | + @ApiModelProperty(value = "合同单号/快递单号") | ||
| 77 | + private String expressDeliveryNumber; | ||
| 78 | + /**交货合同编号*/ | ||
| 79 | + @Excel(name = "交货合同编号", width = 15) | ||
| 80 | + @ApiModelProperty(value = "交货合同编号") | ||
| 81 | + private String deliveryContractNumber; | ||
| 82 | + /**需求单位*/ | ||
| 83 | + @Excel(name = "需求单位", width = 15) | ||
| 84 | + @ApiModelProperty(value = "需求单位") | ||
| 85 | + private String demandUnit; | ||
| 86 | + /**仓库*/ | ||
| 87 | + @Excel(name = "仓库", width = 15) | ||
| 88 | + @ApiModelProperty(value = "仓库") | ||
| 89 | + private String warehouse; | ||
| 90 | + /**销售人员*/ | ||
| 91 | + @Excel(name = "销售人员", width = 15) | ||
| 92 | + @ApiModelProperty(value = "销售人员") | ||
| 93 | + private String salesman; | ||
| 94 | + /**审核人*/ | ||
| 95 | + @Excel(name = "审核人", width = 15) | ||
| 96 | + @ApiModelProperty(value = "审核人") | ||
| 97 | + private String reviewer; | ||
| 98 | + /**创建人*/ | ||
| 99 | + @ApiModelProperty(value = "创建人") | ||
| 100 | + private String createBy; | ||
| 101 | + /**创建日期*/ | ||
| 102 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 103 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 104 | + @ApiModelProperty(value = "创建日期") | ||
| 105 | + private Date createTime; | ||
| 106 | + /**更新人*/ | ||
| 107 | + @ApiModelProperty(value = "更新人") | ||
| 108 | + private String updateBy; | ||
| 109 | + /**更新日期*/ | ||
| 110 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 111 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 112 | + @ApiModelProperty(value = "更新日期") | ||
| 113 | + private Date updateTime; | ||
| 114 | +} |
| @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; | @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; | ||
| 5 | import java.util.Date; | 5 | import java.util.Date; |
| 6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
| 7 | import com.baomidou.mybatisplus.annotation.IdType; | 7 | import com.baomidou.mybatisplus.annotation.IdType; |
| 8 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 8 | import com.baomidou.mybatisplus.annotation.TableId; | 9 | import com.baomidou.mybatisplus.annotation.TableId; |
| 9 | import com.baomidou.mybatisplus.annotation.TableName; | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
| 10 | import lombok.Data; | 11 | import lombok.Data; |
| @@ -100,4 +101,41 @@ public class TblTradeMeterial implements Serializable { | @@ -100,4 +101,41 @@ public class TblTradeMeterial implements Serializable { | ||
| 100 | @DateTimeFormat(pattern="yyyy-MM-dd") | 101 | @DateTimeFormat(pattern="yyyy-MM-dd") |
| 101 | @ApiModelProperty(value = "日期时间") | 102 | @ApiModelProperty(value = "日期时间") |
| 102 | private java.util.Date otherDate; | 103 | private java.util.Date otherDate; |
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 实际库存数量 | ||
| 107 | + */ | ||
| 108 | + @ApiModelProperty(value = "实际库存数量") | ||
| 109 | + @TableField(exist = false) | ||
| 110 | + private Integer actualInventory; | ||
| 111 | + /** | ||
| 112 | + * 在途数量 | ||
| 113 | + */ | ||
| 114 | + @ApiModelProperty(value = "在途数量") | ||
| 115 | + @TableField(exist = false) | ||
| 116 | + private Integer quantityInTransit; | ||
| 117 | + /** | ||
| 118 | + * 总数量 | ||
| 119 | + */ | ||
| 120 | + @ApiModelProperty(value = "总数量") | ||
| 121 | + @TableField(exist = false) | ||
| 122 | + private Integer totalQuantity; | ||
| 123 | + /** | ||
| 124 | + * 首次入库时间 | ||
| 125 | + */ | ||
| 126 | + @ApiModelProperty(value = "首次入库时间") | ||
| 127 | + @TableField(exist = false) | ||
| 128 | + private Date firstStorageTime; | ||
| 129 | + /** | ||
| 130 | + * 最后一次出库时间 | ||
| 131 | + */ | ||
| 132 | + @ApiModelProperty(value = "最后一次出库时间") | ||
| 133 | + @TableField(exist = false) | ||
| 134 | + private Date lastOutboundTime; | ||
| 135 | + /** | ||
| 136 | + * 在库天数 | ||
| 137 | + */ | ||
| 138 | + @ApiModelProperty(value = "在库天数") | ||
| 139 | + @TableField(exist = false) | ||
| 140 | + private Integer daysInStock; | ||
| 103 | } | 141 | } |
| @@ -2,6 +2,8 @@ package org.jeecg.modules.erp.trade.mapper; | @@ -2,6 +2,8 @@ package org.jeecg.modules.erp.trade.mapper; | ||
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | 4 | ||
| 5 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
| 5 | import org.apache.ibatis.annotations.Param; | 7 | import org.apache.ibatis.annotations.Param; |
| 6 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; | 8 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; |
| 7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 9 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| @@ -14,4 +16,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | @@ -14,4 +16,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 14 | */ | 16 | */ |
| 15 | public interface TblTradeInventoryInMapper extends BaseMapper<TblTradeInventoryIn> { | 17 | public interface TblTradeInventoryInMapper extends BaseMapper<TblTradeInventoryIn> { |
| 16 | 18 | ||
| 19 | + IPage<TblTradeInventoryIn> pageList(Page<TblTradeInventoryIn> page, @Param("param")TblTradeInventoryIn tblTradeInventoryIn); | ||
| 20 | + | ||
| 21 | + IPage<TblTradeInventoryIn> ckPageList(Page<TblTradeInventoryIn> page, @Param("param")TblTradeInventoryIn tblTradeInventoryIn); | ||
| 22 | + | ||
| 23 | + IPage<TblTradeInventoryIn> rkPageList(Page<TblTradeInventoryIn> page, @Param("param")TblTradeInventoryIn tblTradeInventoryIn); | ||
| 17 | } | 24 | } |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/trade/mapper/TblTradeInventoryOutMapper.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.trade.mapper; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | +import org.jeecg.modules.erp.trade.entity.TblTradeInventoryOut; | ||
| 7 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Description: tbl_trade_inventory_out | ||
| 11 | + * @Author: jeecg-boot | ||
| 12 | + * @Date: 2025-03-12 | ||
| 13 | + * @Version: V1.0 | ||
| 14 | + */ | ||
| 15 | +public interface TblTradeInventoryOutMapper extends BaseMapper<TblTradeInventoryOut> { | ||
| 16 | + | ||
| 17 | +} |
| @@ -2,4 +2,104 @@ | @@ -2,4 +2,104 @@ | ||
| 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | <mapper namespace="org.jeecg.modules.erp.trade.mapper.TblTradeInventoryInMapper"> | 3 | <mapper namespace="org.jeecg.modules.erp.trade.mapper.TblTradeInventoryInMapper"> |
| 4 | 4 | ||
| 5 | + <select id="pageList" resultType="org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn"> | ||
| 6 | + SELECT * FROM ( | ||
| 7 | + | ||
| 8 | + SELECT | ||
| 9 | + waybill_num AS waybillNum, | ||
| 10 | + material_code AS materialCode, | ||
| 11 | + material_description AS materialDescription, | ||
| 12 | + measurement_unit AS measurementUnit, | ||
| 13 | + brand, | ||
| 14 | + actual_inventory AS actualInventory, | ||
| 15 | + inventory_quantity AS inventoryQuantity, | ||
| 16 | + create_time AS createTime, | ||
| 17 | + create_by AS createBy, | ||
| 18 | + type | ||
| 19 | + FROM tbl_trade_inventory_in where 1=1 | ||
| 20 | + <if test="param.materialCode != null and param.materialCode != ''"> | ||
| 21 | + AND tbl_trade_inventory_in.material_code = #{param.materialCode} | ||
| 22 | + </if> | ||
| 23 | + <if test="param.materialDescription != null and param.materialDescription != ''"> | ||
| 24 | + AND tbl_trade_inventory_in.material_description like concat('%',#{param.materialDescription},'%') | ||
| 25 | + </if> | ||
| 26 | + UNION ALL | ||
| 27 | + SELECT | ||
| 28 | + waybill_num_out AS waybillNum, | ||
| 29 | + material_code AS materialCode, | ||
| 30 | + material_description AS materialDescription, | ||
| 31 | + measurement_unit AS measurementUnit, | ||
| 32 | + brand, | ||
| 33 | + actual_inventory AS actualInventory, | ||
| 34 | + outbound_quantity AS inventoryQuantity, | ||
| 35 | + create_time AS createTime, | ||
| 36 | + create_by AS createBy, | ||
| 37 | + '出库' AS type | ||
| 38 | + FROM tbl_trade_inventory_out where 1=1 | ||
| 39 | + <if test="param.materialCode != null and param.materialCode != ''"> | ||
| 40 | + AND tbl_trade_inventory_out.material_code = #{param.materialCode} | ||
| 41 | + </if> | ||
| 42 | + <if test="param.materialDescription != null and param.materialDescription != ''"> | ||
| 43 | + AND tbl_trade_inventory_out.material_description like concat('%',#{param.materialDescription},'%') | ||
| 44 | + </if> | ||
| 45 | + ) | ||
| 46 | + AS combined_results | ||
| 47 | + ORDER BY createTime DESC; | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + </select> | ||
| 51 | + <select id="ckPageList" resultType="org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn"> | ||
| 52 | + SELECT | ||
| 53 | + waybill_num_out AS waybillNum, | ||
| 54 | + material_code AS materialCode, | ||
| 55 | + material_description AS materialDescription, | ||
| 56 | + measurement_unit AS measurementUnit, | ||
| 57 | + brand, | ||
| 58 | + actual_inventory AS actualInventory, | ||
| 59 | + outbound_quantity AS inventoryQuantity, | ||
| 60 | + create_time AS createTime, | ||
| 61 | + create_by AS createBy, | ||
| 62 | + warehouse AS warehouse, | ||
| 63 | + express_delivery_number AS expressDeliveryNumber, | ||
| 64 | + delivery_contract_number AS deliveryContractNumber, | ||
| 65 | + demand_unit AS demandUnit, | ||
| 66 | + salesman AS salesman, | ||
| 67 | + demand_unit AS createBy, | ||
| 68 | + '出库' AS type | ||
| 69 | + FROM tbl_trade_inventory_out where 1=1 | ||
| 70 | + <if test="param.materialCode != null and param.materialCode != ''"> | ||
| 71 | + AND tbl_trade_inventory_out.material_code = #{param.materialCode} | ||
| 72 | + </if> | ||
| 73 | + | ||
| 74 | + <if test="param.materialDescription != null and param.materialDescription != ''"> | ||
| 75 | + AND tbl_trade_inventory_out.material_description like concat('%',#{param.materialDescription},'%') | ||
| 76 | + </if> | ||
| 77 | + ORDER BY createTime DESC; | ||
| 78 | + </select> | ||
| 79 | + <select id="rkPageList" resultType="org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn"> | ||
| 80 | + SELECT | ||
| 81 | + waybill_num AS waybillNum, | ||
| 82 | + material_code AS materialCode, | ||
| 83 | + material_description AS materialDescription, | ||
| 84 | + measurement_unit AS measurementUnit, | ||
| 85 | + brand, | ||
| 86 | + actual_inventory AS actualInventory, | ||
| 87 | + inventory_quantity AS inventoryQuantity, | ||
| 88 | + create_time AS createTime, | ||
| 89 | + create_by AS createBy, | ||
| 90 | + delivery_contract_number AS deliveryContractNumber, | ||
| 91 | + express_delivery_number AS expressDeliveryNumber, | ||
| 92 | + supplier_name AS supplierName, | ||
| 93 | + operator AS operator, | ||
| 94 | + warehouse AS warehouse, | ||
| 95 | + type | ||
| 96 | + FROM tbl_trade_inventory_in where 1=1 | ||
| 97 | + <if test="param.materialCode != null and param.materialCode != ''"> | ||
| 98 | + AND tbl_trade_inventory_in.material_code = #{param.materialCode} | ||
| 99 | + </if> | ||
| 100 | + <if test="param.materialDescription != null and param.materialDescription != ''"> | ||
| 101 | + AND tbl_trade_inventory_in.material_description like concat('%',#{param.materialDescription},'%') | ||
| 102 | + </if> | ||
| 103 | + ORDER BY createTime DESC; | ||
| 104 | + </select> | ||
| 5 | </mapper> | 105 | </mapper> |
| 1 | package org.jeecg.modules.erp.trade.service; | 1 | package org.jeecg.modules.erp.trade.service; |
| 2 | 2 | ||
| 3 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 4 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
| 3 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; | 5 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; |
| 4 | import com.baomidou.mybatisplus.extension.service.IService; | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
| 5 | 7 | ||
| @@ -11,4 +13,9 @@ import com.baomidou.mybatisplus.extension.service.IService; | @@ -11,4 +13,9 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||
| 11 | */ | 13 | */ |
| 12 | public interface ITblTradeInventoryInService extends IService<TblTradeInventoryIn> { | 14 | public interface ITblTradeInventoryInService extends IService<TblTradeInventoryIn> { |
| 13 | 15 | ||
| 16 | + IPage<TblTradeInventoryIn> pageList(Page<TblTradeInventoryIn> page, TblTradeInventoryIn tblTradeInventoryIn); | ||
| 17 | + | ||
| 18 | + IPage<TblTradeInventoryIn> ckPageList(Page<TblTradeInventoryIn> page, TblTradeInventoryIn tblTradeInventoryIn); | ||
| 19 | + | ||
| 20 | + IPage<TblTradeInventoryIn> rkPageList(Page<TblTradeInventoryIn> page, TblTradeInventoryIn tblTradeInventoryIn); | ||
| 14 | } | 21 | } |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/trade/service/ITblTradeInventoryOutService.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.trade.service; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
| 4 | +import org.jeecg.modules.erp.trade.entity.TblTradeInventoryOut; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Description: tbl_trade_inventory_out | ||
| 8 | + * @Author: jeecg-boot | ||
| 9 | + * @Date: 2025-03-12 | ||
| 10 | + * @Version: V1.0 | ||
| 11 | + */ | ||
| 12 | +public interface ITblTradeInventoryOutService extends IService<TblTradeInventoryOut> { | ||
| 13 | + | ||
| 14 | +} |
| 1 | package org.jeecg.modules.erp.trade.service.impl; | 1 | package org.jeecg.modules.erp.trade.service.impl; |
| 2 | 2 | ||
| 3 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 4 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
| 3 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; | 5 | import org.jeecg.modules.erp.trade.entity.TblTradeInventoryIn; |
| 4 | import org.jeecg.modules.erp.trade.mapper.TblTradeInventoryInMapper; | 6 | import org.jeecg.modules.erp.trade.mapper.TblTradeInventoryInMapper; |
| 5 | import org.jeecg.modules.erp.trade.service.ITblTradeInventoryInService; | 7 | import org.jeecg.modules.erp.trade.service.ITblTradeInventoryInService; |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 7 | 10 | ||
| 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| @@ -16,4 +19,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | @@ -16,4 +19,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
| 16 | @Service | 19 | @Service |
| 17 | public class TblTradeInventoryInServiceImpl extends ServiceImpl<TblTradeInventoryInMapper, TblTradeInventoryIn> implements ITblTradeInventoryInService { | 20 | public class TblTradeInventoryInServiceImpl extends ServiceImpl<TblTradeInventoryInMapper, TblTradeInventoryIn> implements ITblTradeInventoryInService { |
| 18 | 21 | ||
| 22 | + @Autowired | ||
| 23 | + private TblTradeInventoryInMapper tblTradeInventoryInMapper; | ||
| 24 | + @Override | ||
| 25 | + public IPage<TblTradeInventoryIn> pageList(Page<TblTradeInventoryIn> page, TblTradeInventoryIn tblTradeInventoryIn) { | ||
| 26 | + return tblTradeInventoryInMapper.pageList(page, tblTradeInventoryIn); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public IPage<TblTradeInventoryIn> ckPageList(Page<TblTradeInventoryIn> page, TblTradeInventoryIn tblTradeInventoryIn) { | ||
| 31 | + return tblTradeInventoryInMapper.ckPageList(page, tblTradeInventoryIn); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public IPage<TblTradeInventoryIn> rkPageList(Page<TblTradeInventoryIn> page, TblTradeInventoryIn tblTradeInventoryIn) { | ||
| 36 | + return tblTradeInventoryInMapper.rkPageList(page, tblTradeInventoryIn); | ||
| 37 | + } | ||
| 19 | } | 38 | } |
| 1 | +package org.jeecg.modules.erp.trade.service.impl; | ||
| 2 | + | ||
| 3 | +import org.jeecg.modules.erp.trade.entity.TblTradeInventoryOut; | ||
| 4 | +import org.jeecg.modules.erp.trade.mapper.TblTradeInventoryOutMapper; | ||
| 5 | +import org.jeecg.modules.erp.trade.service.ITblTradeInventoryOutService; | ||
| 6 | +import org.springframework.stereotype.Service; | ||
| 7 | + | ||
| 8 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Description: tbl_trade_inventory_out | ||
| 12 | + * @Author: jeecg-boot | ||
| 13 | + * @Date: 2025-03-12 | ||
| 14 | + * @Version: V1.0 | ||
| 15 | + */ | ||
| 16 | +@Service | ||
| 17 | +public class TblTradeInventoryOutServiceImpl extends ServiceImpl<TblTradeInventoryOutMapper, TblTradeInventoryOut> implements ITblTradeInventoryOutService { | ||
| 18 | + | ||
| 19 | +} |
-
请 注册 或 登录 后发表评论