优化首页、物料展示、出库移库备注展示
This commit is contained in:
parent
5979cfd37f
commit
88261c4367
|
|
@ -49,6 +49,13 @@ public class InventoryController extends BaseController {
|
|||
return ResponseEntity.ok(service.queryPage(query, page));
|
||||
}
|
||||
|
||||
@ApiOperation("查询预警列表")
|
||||
@PreAuthorize("@ss.hasPermi('wms:inventory:list')")
|
||||
@PostMapping("/warnList")
|
||||
public ResponseEntity<Page<InventoryVO>> list(Pageable page) {
|
||||
return ResponseEntity.ok(service.queryWarning(page));
|
||||
}
|
||||
|
||||
@ApiOperation("导出库存列表")
|
||||
@PreAuthorize("@ss.hasPermi('wms:inventory:export')")
|
||||
@Log(title = "库存", businessType = BusinessType.EXPORT)
|
||||
|
|
|
|||
|
|
@ -102,4 +102,13 @@ public class ItemController extends BaseController {
|
|||
public ResponseEntity<Integer> remove(@PathVariable Long[] ids) {
|
||||
return ResponseEntity.ok(service.deleteByIds(ids));
|
||||
}
|
||||
|
||||
@ApiOperation("查询过期物料")
|
||||
@PreAuthorize("@ss.hasPermi('wms:item:list')")
|
||||
@PostMapping("/expiryList")
|
||||
public ResponseEntity<Page<ItemVO>> list(Pageable page){
|
||||
List<Item> items = service.queryExpiry(page);
|
||||
List<ItemVO> list = service.toVos(items);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)items).getTotal()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.cyl.wms.domain;
|
|||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
|
@ -71,4 +72,10 @@ public class Item extends BaseAudit {
|
|||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
public long getItemTypeLong() {
|
||||
return Long.parseLong(itemType);
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private String itemTypeName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import com.ruoyi.common.core.domain.BaseAudit;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 入库单对象 wms_receipt_order
|
||||
*
|
||||
|
|
@ -36,6 +39,10 @@ public class ReceiptOrder extends BaseAudit {
|
|||
@Excel(name = "订单号")
|
||||
private String orderNo;
|
||||
|
||||
@ApiModelProperty("应付款合计")
|
||||
@Excel(name = "应付款合计")
|
||||
private BigDecimal payableAmount;
|
||||
|
||||
@ApiModelProperty("入库状态")
|
||||
@Excel(name = "入库状态")
|
||||
private Integer receiptOrderStatus;
|
||||
|
|
|
|||
|
|
@ -36,4 +36,6 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
|
|||
List<Inventory> selectAllByRackAndItemId(@Param("list") Collection<InventoryHistory> list);
|
||||
|
||||
int batchInsert(@Param("list") Collection<Inventory> list);
|
||||
|
||||
List<Inventory> selectWarning();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,6 @@ public interface ItemMapper extends BaseMapper<Item> {
|
|||
* @return
|
||||
*/
|
||||
int updateDelFlagByIds(@Param("ids") Long[] ids);
|
||||
|
||||
List<Item> selectExpiry();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,4 +41,5 @@ public class InventoryVO extends BaseAudit implements AreaAndItemInfo {
|
|||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
private BigDecimal saftyQuantity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ public class ItemVO extends BaseAudit {
|
|||
/** 分类 */
|
||||
@Excel(name = "分类")
|
||||
private String itemType;
|
||||
/**
|
||||
* 所属类别
|
||||
*/
|
||||
@Excel(name = "所属类别")
|
||||
private String itemTypeName;
|
||||
/** 单位类别 */
|
||||
@Excel(name = "单位类别")
|
||||
private String unit;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import com.ruoyi.common.annotation.Excel;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseAudit;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 入库单 数据视图对象
|
||||
*
|
||||
|
|
@ -25,6 +28,8 @@ public class ReceiptOrderVO extends BaseAudit {
|
|||
/** 订单号 */
|
||||
@Excel(name = "订单号")
|
||||
private String orderNo;
|
||||
@Excel(name = "应付款合计")
|
||||
private BigDecimal payableAmount;
|
||||
/** 入库状态 */
|
||||
@Excel(name = "入库状态")
|
||||
private Integer receiptOrderStatus;
|
||||
|
|
|
|||
|
|
@ -310,4 +310,28 @@ public class InventoryService {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Page<InventoryVO> queryWarning(Pageable page) {
|
||||
if (page != null){
|
||||
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize(), SortUtil.sort2string(page.getSort()));
|
||||
}
|
||||
List<Inventory> inventories = inventoryMapper.selectWarning();
|
||||
List<InventoryVO> res = inventoryConvert.dos2vos(inventories);
|
||||
injectAreaAndItemInfo(res);
|
||||
List<Item> allItems = itemService.getAllSaftyItems();
|
||||
Map<Long, BigDecimal> saftyItems = allItems.stream().collect(Collectors.toMap(Item::getId, item -> item.getQuantity()));
|
||||
res.forEach(item -> {
|
||||
BigDecimal saftyQuantify = saftyItems.get(item.getItemId());
|
||||
item.setSaftyQuantity(saftyQuantify);
|
||||
});
|
||||
return new PageImpl<>(res, page, ((com.github.pagehelper.Page) inventories).getTotal());
|
||||
}
|
||||
|
||||
public List<InventoryVO> queryAll() {
|
||||
InventoryQuery query = new InventoryQuery();
|
||||
List<Inventory> list = selectList(query,null);
|
||||
List<InventoryVO> res = inventoryConvert.dos2vos(list);
|
||||
injectAreaAndItemInfo(res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cyl.wms.convert.ItemConvert;
|
||||
import com.cyl.wms.domain.Item;
|
||||
import com.cyl.wms.domain.ItemType;
|
||||
import com.cyl.wms.domain.Rack;
|
||||
import com.cyl.wms.mapper.ItemMapper;
|
||||
import com.cyl.wms.pojo.query.ItemQuery;
|
||||
import com.cyl.wms.pojo.vo.ItemVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SortUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 物料Service业务层处理
|
||||
|
|
@ -32,6 +35,9 @@ public class ItemService {
|
|||
@Autowired
|
||||
private ItemConvert convert;
|
||||
|
||||
@Autowired
|
||||
private ItemTypeService itemTypeService;
|
||||
|
||||
public List<ItemVO> toVos(List<Item> items) {
|
||||
List<ItemVO> list = convert.dos2vos(items);
|
||||
list.forEach(itemVO -> {
|
||||
|
|
@ -143,7 +149,7 @@ public class ItemService {
|
|||
if (expiryDate != null) {
|
||||
qw.eq("expiry_date", expiryDate);
|
||||
}
|
||||
return itemMapper.selectList(qw);
|
||||
return getItemList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -194,4 +200,48 @@ public class ItemService {
|
|||
qw.in("id", ids);
|
||||
return itemMapper.selectList(qw);
|
||||
}
|
||||
|
||||
public List<Item> getAllSaftyItems(){
|
||||
QueryWrapper<Item> qw = new QueryWrapper<>();
|
||||
qw.eq("del_flag", 0);
|
||||
qw.isNotNull("quantity");
|
||||
return this.getItemList(qw);
|
||||
}
|
||||
private List<Item> getItemList(QueryWrapper<Item> qw) {
|
||||
List<Item> items = itemMapper.selectList(qw);
|
||||
injectTypeName(items);
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入物料类别名称
|
||||
*
|
||||
* @param res 物料
|
||||
*/
|
||||
public void injectTypeName(List<Item> res) {
|
||||
if (CollUtil.isEmpty(res)) {
|
||||
return;
|
||||
}
|
||||
Set<Long> types = res.stream().map(Item::getItemTypeLong).collect(Collectors.toSet());
|
||||
Map<Long, ItemType> itemTypes = itemTypeService.selectByIdIn(types).stream().collect(Collectors.toMap(ItemType::getItemTypeId, it -> it));
|
||||
res.forEach(it -> {
|
||||
if (it.getItemName() != null && itemTypes.containsKey(it.getItemTypeLong())) {
|
||||
it.setItemTypeName(itemTypes.get(it.getItemTypeLong()).getTypeName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询过期物料
|
||||
* @param page 分页条件
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Item> queryExpiry(Pageable page) {
|
||||
if (page != null){
|
||||
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize(), SortUtil.sort2string(page.getSort()));
|
||||
}
|
||||
List<Item> items = itemMapper.selectExpiry();
|
||||
injectTypeName(items);
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.cyl.wms.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -29,6 +26,21 @@ public class ItemTypeService {
|
|||
@Autowired
|
||||
private ItemTypeMapper itemTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询物料类型表
|
||||
*
|
||||
* @param ids 物料类型表主键
|
||||
* @return 物料类型表
|
||||
*/
|
||||
public List<ItemType> selectByIdIn(Collection<Long> ids) {
|
||||
if (ids.isEmpty()){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
QueryWrapper<ItemType> qw = new QueryWrapper<>();
|
||||
qw.in("item_type_id",ids);
|
||||
return itemTypeMapper.selectList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物料类型表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -90,6 +90,14 @@
|
|||
</foreach>
|
||||
and area_id is null and rack_id is null
|
||||
</select>
|
||||
<select id="selectWarning" resultType="com.cyl.wms.domain.Inventory">
|
||||
select a.*,b.* from wms_inventory a
|
||||
left join wms_item b on a.item_id=b.id
|
||||
where a.del_flag=0 and b.del_flag=0 and
|
||||
<![CDATA[
|
||||
a.quantity<b.quantity
|
||||
]]>
|
||||
</select>
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
insert into wms_inventory
|
||||
(item_id, rack_id, quantity, remark, del_flag, create_by, create_time, update_by, update_time, warehouse_id,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="expiryDate != null "> and expiry_date = #{expiryDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectExpiry" resultType="com.cyl.wms.domain.Item">
|
||||
<include refid="selectItemVo"/>
|
||||
<where>
|
||||
del_flag=0 and
|
||||
<![CDATA[
|
||||
expiry_date<now()
|
||||
]]>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateDelFlagByIds">
|
||||
update wms_item set del_flag=1
|
||||
|
|
|
|||
Loading…
Reference in New Issue