盘库和金额
This commit is contained in:
parent
8735b44898
commit
79605f1880
@ -82,8 +82,11 @@ public class StorageCheckController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
storageCheckMatService.createStorageCheckMat(item);
|
// storageCheckMatService.createStorageCheckMat(item);
|
||||||
}
|
}
|
||||||
|
//插入盘库子表
|
||||||
|
storageCheckMatService.insertBatchChechMat(createReqVO);
|
||||||
|
|
||||||
return success(1L);
|
return success(1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.chanko.yunxi.mes.module.heli.controller.admin.storagecheckmat.vo;
|
package com.chanko.yunxi.mes.module.heli.controller.admin.storagecheckmat.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -48,4 +49,25 @@ public class StorageCheckMatSaveReqVO {
|
|||||||
@Schema(description = "单价")
|
@Schema(description = "单价")
|
||||||
private String onemoney;
|
private String onemoney;
|
||||||
|
|
||||||
|
@Schema(description = "是否在库存表存在")
|
||||||
|
private Integer exist;
|
||||||
|
|
||||||
|
private String matName;
|
||||||
|
private String matCode;
|
||||||
|
/**
|
||||||
|
* 物料简称
|
||||||
|
*/
|
||||||
|
private String shortName;
|
||||||
|
/**
|
||||||
|
* 系统单位
|
||||||
|
*/
|
||||||
|
private String boomUnit;
|
||||||
|
/**
|
||||||
|
* 物料id
|
||||||
|
*/
|
||||||
|
private Long materialId;
|
||||||
|
/**
|
||||||
|
* 规格型号
|
||||||
|
*/
|
||||||
|
private String boomSpec;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.chanko.yunxi.mes.module.heli.controller.admin.storageinventory;
|
package com.chanko.yunxi.mes.module.heli.controller.admin.storageinventory;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.StorageNowAllReqVO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -11,6 +13,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.*;
|
import javax.validation.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -93,6 +96,26 @@ public class StorageInventoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/all")
|
||||||
|
@Operation(summary = "获得全部库存数据")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:storage-inventory:query')")
|
||||||
|
public CommonResult<List<StorageInventoryDO>> getStorageNowList(@Valid StorageInventoryPageReqVO queryReqVO) {
|
||||||
|
List<StorageInventoryDO> pageResult = storageInventoryService.getStorageNowList(queryReqVO);
|
||||||
|
return success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/matRest")
|
||||||
|
@Operation(summary = "获得最新库存数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:storage-log:query')")
|
||||||
|
public CommonResult<BigDecimal> getStorageNowPage(@RequestParam("matId") Long matId, @RequestParam("pnId") Long pnId) {
|
||||||
|
StorageInventoryDO pageResult = storageInventoryService.selectNowByMatPnId(matId,pnId);
|
||||||
|
BigDecimal matRest = BigDecimal.ZERO;
|
||||||
|
if (pageResult != null && pageResult.getYardAmount() != null) {
|
||||||
|
matRest = pageResult.getYardAmount();
|
||||||
|
}
|
||||||
|
return success(matRest);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/getSupplementPage")
|
@GetMapping("/getSupplementPage")
|
||||||
@Operation(summary = "获得库存分页")
|
@Operation(summary = "获得库存分页")
|
||||||
@PreAuthorize("@ss.hasPermission('heli:storage-inventory:query')")
|
@PreAuthorize("@ss.hasPermission('heli:storage-inventory:query')")
|
||||||
|
@ -85,5 +85,8 @@ public class StorageInventoryPageReqVO extends PageParam {
|
|||||||
|
|
||||||
@Schema(description = "物料类型")
|
@Schema(description = "物料类型")
|
||||||
private String matSpec;
|
private String matSpec;
|
||||||
|
@Schema(description = "是否排除库存为0的物料")
|
||||||
}
|
private Integer noZero;
|
||||||
|
@Schema(description = "是否全部数据")
|
||||||
|
private boolean isALL;
|
||||||
|
}
|
||||||
|
@ -103,10 +103,12 @@ public class StorageInventoryDO extends BaseDO {
|
|||||||
* 物料简称
|
* 物料简称
|
||||||
*/
|
*/
|
||||||
private String shortName;
|
private String shortName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料编码
|
* 物料编码
|
||||||
*/
|
*/
|
||||||
private String boomCode;
|
private String boomCode;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private BigDecimal storageOkQty;
|
private BigDecimal storageOkQty;
|
||||||
|
|
||||||
@ -115,6 +117,7 @@ public class StorageInventoryDO extends BaseDO {
|
|||||||
private String matName;
|
private String matName;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String matCode;
|
private String matCode;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String matType;
|
private String matType;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ -123,7 +126,6 @@ public class StorageInventoryDO extends BaseDO {
|
|||||||
private String matBrand;
|
private String matBrand;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String matUnit;
|
private String matUnit;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String whName;
|
private String whName;
|
||||||
|
|
||||||
@ -142,4 +144,6 @@ public class StorageInventoryDO extends BaseDO {
|
|||||||
private String matUnitId;
|
private String matUnitId;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String invSafe;
|
private String invSafe;
|
||||||
}
|
@TableField(exist = false)
|
||||||
|
private Integer exist;//是否存在,盘库使用, 0存在 1不存在
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
|||||||
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.StorageLogPageReqVO;
|
import com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.StorageLogPageReqVO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.StorageNowAllReqVO;
|
||||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
|
||||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.pn.PnDO;
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.pn.PnDO;
|
||||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.rg.RgDO;
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.rg.RgDO;
|
||||||
@ -49,6 +50,7 @@ public interface StorageInventoryMapper extends BaseMapperX<StorageInventoryDO>
|
|||||||
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatName()), MaterialDO::getName, reqVO.getMatName())
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatName()), MaterialDO::getName, reqVO.getMatName())
|
||||||
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatCode()), MaterialDO::getCode, reqVO.getMatCode())
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatCode()), MaterialDO::getCode, reqVO.getMatCode())
|
||||||
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getShortName()), MaterialDO::getShortName, reqVO.getShortName())
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getShortName()), MaterialDO::getShortName, reqVO.getShortName())
|
||||||
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatType()), MaterialDO::getMaterialType, reqVO.getMatType())
|
||||||
.eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.N.name())
|
.eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.N.name())
|
||||||
.ne(StorageInventoryDO::getYardAmount,0)
|
.ne(StorageInventoryDO::getYardAmount,0)
|
||||||
.eq(MaterialDO::getStatus,1)
|
.eq(MaterialDO::getStatus,1)
|
||||||
@ -59,6 +61,59 @@ public interface StorageInventoryMapper extends BaseMapperX<StorageInventoryDO>
|
|||||||
.eq("d1.dict_type","heli_material_unit");
|
.eq("d1.dict_type","heli_material_unit");
|
||||||
return selectPage(reqVO, query);
|
return selectPage(reqVO, query);
|
||||||
}
|
}
|
||||||
|
default StorageInventoryDO selectByWhRgPn(StorageInventoryPageReqVO reqVO) {
|
||||||
|
MPJLambdaWrapper<StorageInventoryDO> query = new MPJLambdaWrapper<>();
|
||||||
|
query.selectAll(StorageInventoryDO.class)
|
||||||
|
.leftJoin(WarehouseDO.class,"w",WarehouseDO::getId, StorageInventoryDO::getWhId)
|
||||||
|
.leftJoin(RgDO.class,"r",RgDO::getId, StorageInventoryDO::getRgId)
|
||||||
|
.leftJoin(PnDO.class,"p",PnDO::getId, StorageInventoryDO::getPnId)
|
||||||
|
.disableSubLogicDel()
|
||||||
|
.groupBy(StorageInventoryDO::getId)
|
||||||
|
.orderByDesc(StorageInventoryDO::getId);
|
||||||
|
|
||||||
|
query
|
||||||
|
.eq(reqVO.getWhId()!= null,StorageInventoryDO::getWhId, reqVO.getWhId())
|
||||||
|
.eq(reqVO.getRgId()!= null,StorageInventoryDO::getRgId, reqVO.getRgId())
|
||||||
|
.eq(reqVO.getPnId()!= null,StorageInventoryDO::getPnId, reqVO.getPnId())
|
||||||
|
.eq(reqVO.getMaterialId() != null ,StorageInventoryDO::getMaterialId,reqVO.getMaterialId());
|
||||||
|
return selectOne(query);
|
||||||
|
}
|
||||||
|
default List<StorageInventoryDO> selectNoZero(StorageInventoryPageReqVO reqVO){
|
||||||
|
MPJLambdaWrapper<StorageInventoryDO> query = new MPJLambdaWrapper<>();
|
||||||
|
query.selectAll(StorageInventoryDO.class)
|
||||||
|
.select("ifnull(sum(t.yard_amount),0) matRest")
|
||||||
|
.select("m.name as matName,m.code as matCode,d.label as matType,m.spec as matSpec,m.brand as matBrand")
|
||||||
|
.select("d1.label as matUnit")
|
||||||
|
.select("w.wh_name as whName","r.rg_name as rgName","p.pn_name as pnName")
|
||||||
|
.select("m.material_type as materialTypeId","m.unit as matUnitId")
|
||||||
|
.leftJoin(MaterialDO.class, "m", MaterialDO::getId, StorageInventoryDO::getMaterialId)
|
||||||
|
.leftJoin(DictDataDO.class,"d",DictDataDO::getValue, MaterialDO::getMaterialType)
|
||||||
|
.leftJoin(DictDataDO.class,"d1",DictDataDO::getValue, MaterialDO::getUnit)
|
||||||
|
.leftJoin(WarehouseDO.class,"w",WarehouseDO::getId, StorageInventoryDO::getWhId)
|
||||||
|
.leftJoin(RgDO.class,"r",RgDO::getId, StorageInventoryDO::getRgId)
|
||||||
|
.leftJoin(PnDO.class,"p",PnDO::getId, StorageInventoryDO::getPnId)
|
||||||
|
.disableSubLogicDel()
|
||||||
|
.groupBy(StorageInventoryDO::getId)
|
||||||
|
.orderByDesc(StorageInventoryDO::getId);
|
||||||
|
|
||||||
|
query.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatSpec()),MaterialDO::getSpec, reqVO.getMatSpec())
|
||||||
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatName()), MaterialDO::getName, reqVO.getMatName())
|
||||||
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatCode()), MaterialDO::getCode, reqVO.getMatCode())
|
||||||
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getShortName()), MaterialDO::getShortName, reqVO.getShortName())
|
||||||
|
.like(!com.alibaba.druid.util.StringUtils.isEmpty(reqVO.getMatType()), MaterialDO::getMaterialType, reqVO.getMatType())
|
||||||
|
.eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.N.name())
|
||||||
|
.ne(StorageInventoryDO::getYardAmount,0)
|
||||||
|
.eq(MaterialDO::getStatus,1)
|
||||||
|
.eq(reqVO.getWhId()!= null,StorageInventoryDO::getWhId, reqVO.getWhId())
|
||||||
|
.eq(reqVO.getRgId()!= null,StorageInventoryDO::getRgId, reqVO.getRgId())
|
||||||
|
.eq(reqVO.getPnId()!= null,StorageInventoryDO::getPnId, reqVO.getPnId())
|
||||||
|
.eq("d.dict_type","heli_material_type")
|
||||||
|
.eq("d1.dict_type","heli_material_unit");
|
||||||
|
return selectList(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<StorageInventoryDO> selectNowList(StorageInventoryPageReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
default PageResult<StorageInventoryDO> getStorageNowPageAll(StorageLogPageReqVO pageReqVO){
|
default PageResult<StorageInventoryDO> getStorageNowPageAll(StorageLogPageReqVO pageReqVO){
|
||||||
// MPJLambdaWrapper<MaterialDO> query = new MPJLambdaWrapper<>();
|
// MPJLambdaWrapper<MaterialDO> query = new MPJLambdaWrapper<>();
|
||||||
@ -161,4 +216,5 @@ public interface StorageInventoryMapper extends BaseMapperX<StorageInventoryDO>
|
|||||||
}
|
}
|
||||||
return selectPage(pageReqVO, query);
|
return selectPage(pageReqVO, query);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -21,7 +21,7 @@ public interface StorageCheckMatService {
|
|||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
Long createStorageCheckMat(@Valid StorageCheckMatSaveReqVO createReqVO);
|
Long createStorageCheckMat(@Valid StorageCheckMatSaveReqVO createReqVO);
|
||||||
|
public boolean insertBatchChechMat(List<StorageCheckMatSaveReqVO> list);
|
||||||
/**
|
/**
|
||||||
* 更新盘点物料
|
* 更新盘点物料
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package com.chanko.yunxi.mes.module.heli.service.storagecheckmat;
|
package com.chanko.yunxi.mes.module.heli.service.storagecheckmat;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.storageinventory.vo.StorageInventoryPageReqVO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storageinventory.StorageInventoryDO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.mysql.storageinventory.StorageInventoryMapper;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -29,9 +33,11 @@ public class StorageCheckMatServiceImpl implements StorageCheckMatService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StorageCheckMatMapper storageCheckMatMapper;
|
private StorageCheckMatMapper storageCheckMatMapper;
|
||||||
|
@Resource
|
||||||
|
private StorageInventoryMapper storageInventoryMapper;
|
||||||
@Override
|
@Override
|
||||||
public Long createStorageCheckMat(StorageCheckMatSaveReqVO createReqVO) {
|
public Long createStorageCheckMat(StorageCheckMatSaveReqVO createReqVO) {
|
||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
StorageCheckMatDO storageCheckMat = BeanUtils.toBean(createReqVO, StorageCheckMatDO.class);
|
StorageCheckMatDO storageCheckMat = BeanUtils.toBean(createReqVO, StorageCheckMatDO.class);
|
||||||
storageCheckMatMapper.insert(storageCheckMat);
|
storageCheckMatMapper.insert(storageCheckMat);
|
||||||
@ -39,6 +45,61 @@ public class StorageCheckMatServiceImpl implements StorageCheckMatService {
|
|||||||
return storageCheckMat.getId();
|
return storageCheckMat.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean insertBatchChechMat(List<StorageCheckMatSaveReqVO> list){
|
||||||
|
List<StorageCheckMatDO> insertList = new ArrayList<>();
|
||||||
|
List<StorageCheckMatSaveReqVO> updateStorageList = new ArrayList<>();
|
||||||
|
List<StorageCheckMatSaveReqVO> inserStorageList = new ArrayList<>();
|
||||||
|
for (StorageCheckMatSaveReqVO storageCheckMatSaveReqVO : list) {
|
||||||
|
if (storageCheckMatSaveReqVO.getExist() != null) {
|
||||||
|
if (storageCheckMatSaveReqVO.getExist() == 1){
|
||||||
|
inserStorageList.add(storageCheckMatSaveReqVO);
|
||||||
|
}else{
|
||||||
|
updateStorageList.add(storageCheckMatSaveReqVO);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
updateStorageList.add(storageCheckMatSaveReqVO);
|
||||||
|
}
|
||||||
|
StorageCheckMatDO storageCheckMat = BeanUtils.toBean(storageCheckMatSaveReqVO, StorageCheckMatDO.class);
|
||||||
|
insertList.add(storageCheckMat);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (CollUtil.isNotEmpty(updateStorageList)){
|
||||||
|
List<StorageInventoryDO> uupdateDetailList = new ArrayList<>();
|
||||||
|
StorageInventoryPageReqVO reqVO = new StorageInventoryPageReqVO();
|
||||||
|
//更新库存表数据
|
||||||
|
for (StorageCheckMatSaveReqVO savo : updateStorageList) {
|
||||||
|
reqVO.setPnId(savo.getPnId() == null ? null : savo.getPnId())
|
||||||
|
.setWhId(savo.getWhId() == null ? null : savo.getWhId())
|
||||||
|
.setRgId(savo.getRgId() == null ? null : savo.getRgId())
|
||||||
|
.setMaterialId(savo.getMaterialId() == null ? null : savo.getMaterialId());
|
||||||
|
StorageInventoryDO inventoryDO = storageInventoryMapper.selectByWhRgPn(reqVO);
|
||||||
|
inventoryDO.setYardAmount(savo.getStorageOkQty());
|
||||||
|
uupdateDetailList.add(inventoryDO);
|
||||||
|
}
|
||||||
|
storageInventoryMapper.updateBatch(uupdateDetailList);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(inserStorageList)){
|
||||||
|
//插入库存表
|
||||||
|
List<StorageInventoryDO> insertDetailList = new ArrayList<>();
|
||||||
|
for (StorageCheckMatSaveReqVO savo : inserStorageList) {
|
||||||
|
StorageInventoryDO ido = new StorageInventoryDO();
|
||||||
|
ido.setPnId(savo.getPnId() == null ? null: savo.getPnId())
|
||||||
|
.setWhId(savo.getWhId() == null ? null: savo.getWhId())
|
||||||
|
.setRgId(savo.getRgId() == null ? null: savo.getRgId())
|
||||||
|
.setBoomName(savo.getMatName() == null ? null:savo.getMatName())
|
||||||
|
.setBoomUnit(savo.getBoomUnit() == null ? null:savo.getBoomUnit())
|
||||||
|
.setMaterialId(savo.getMaterialId() == null ? null: savo.getMaterialId())
|
||||||
|
.setBoomSpec(savo.getBoomSpec() == null ? null: savo.getBoomSpec())
|
||||||
|
.setYardAmount(savo.getStorageOkQty() == null ? null: savo.getStorageOkQty())
|
||||||
|
.setShortName(savo.getShortName() == null ? null: savo.getShortName())
|
||||||
|
.setBoomCode(savo.getMatCode() == null ? null: savo.getMatCode());
|
||||||
|
insertDetailList.add(ido);
|
||||||
|
}
|
||||||
|
storageInventoryMapper.insertBatch(insertDetailList);
|
||||||
|
}
|
||||||
|
return storageCheckMatMapper.insertBatch(insertList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateStorageCheckMat(StorageCheckMatSaveReqVO updateReqVO) {
|
public void updateStorageCheckMat(StorageCheckMatSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
|
@ -6,6 +6,7 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.storageinventory.vo.*;
|
|||||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storageinventory.StorageInventoryDO;
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storageinventory.StorageInventoryDO;
|
||||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库存 Service 接口
|
* 库存 Service 接口
|
||||||
@ -53,4 +54,7 @@ public interface StorageInventoryService {
|
|||||||
PageResult<StorageInventoryDO> getStorageInventoryPage(StorageInventoryPageReqVO pageReqVO);
|
PageResult<StorageInventoryDO> getStorageInventoryPage(StorageInventoryPageReqVO pageReqVO);
|
||||||
|
|
||||||
PageResult<StorageInventoryDO> getSupplementPage(StorageInventoryPageReqVO pageReqVO);
|
PageResult<StorageInventoryDO> getSupplementPage(StorageInventoryPageReqVO pageReqVO);
|
||||||
|
List<StorageInventoryDO> getStorageNowList(StorageInventoryPageReqVO queryReqVO);
|
||||||
|
|
||||||
|
StorageInventoryDO selectNowByMatPnId(Long matId, Long pnId);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.chanko.yunxi.mes.module.heli.service.storageinventory;
|
package com.chanko.yunxi.mes.module.heli.service.storageinventory;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.StorageNowAllReqVO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -76,4 +79,26 @@ public class StorageInventoryServiceImpl implements StorageInventoryService {
|
|||||||
return storageInventoryMapper.getSupplementPage(pageReqVO);
|
return storageInventoryMapper.getSupplementPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StorageInventoryDO> getStorageNowList(StorageInventoryPageReqVO queryReqVO) {
|
||||||
|
if(queryReqVO.getNoZero().equals(1)){
|
||||||
|
// 根据仓库id排除库存为o的物料
|
||||||
|
return storageInventoryMapper.selectNoZero(queryReqVO);
|
||||||
|
}else{
|
||||||
|
// 筛选全部的实时库存数据,包含未分配仓库的物料信息和已分配仓库的物料信息
|
||||||
|
if(queryReqVO.isALL()){
|
||||||
|
return storageInventoryMapper.selectNowList(queryReqVO);
|
||||||
|
}else{
|
||||||
|
return storageInventoryMapper.selectNowList(queryReqVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public StorageInventoryDO selectNowByMatPnId(Long matId, Long pnId){
|
||||||
|
return storageInventoryMapper.selectOne(new LambdaQueryWrapperX<StorageInventoryDO>()
|
||||||
|
.eq(StorageInventoryDO::getMaterialId, matId)
|
||||||
|
.eq(StorageInventoryDO::getPnId, pnId));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,4 +9,101 @@
|
|||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
</mapper>
|
|
||||||
|
<select id="selectNowList"
|
||||||
|
parameterType="com.chanko.yunxi.mes.module.heli.controller.admin.storageinventory.vo.StorageInventoryPageReqVO"
|
||||||
|
resultType="com.chanko.yunxi.mes.module.heli.dal.dataobject.storageinventory.StorageInventoryDO">
|
||||||
|
SELECT DISTINCT *
|
||||||
|
FROM (
|
||||||
|
-- 第一部分:查询当前库存中的物料
|
||||||
|
SELECT
|
||||||
|
t.material_id as id,
|
||||||
|
t.material_id as material_id,
|
||||||
|
t.boom_spec as boom_spec,
|
||||||
|
t.boom_unit as boom_unit,
|
||||||
|
m.name AS mat_name,
|
||||||
|
m.code AS mat_code,
|
||||||
|
d.label AS mat_type,
|
||||||
|
m.spec AS mat_spec,
|
||||||
|
m.brand AS mat_band,
|
||||||
|
d1.label AS mat_unit,
|
||||||
|
t.wh_id as wh_id,
|
||||||
|
t.rg_id as rg_id,
|
||||||
|
t.pn_id as pn_id,
|
||||||
|
w.wh_name AS wh_name,
|
||||||
|
r.rg_name AS rg_name,
|
||||||
|
p.pn_name AS pn_name,
|
||||||
|
t.lot_no as lot_no,
|
||||||
|
IFNULL(t.price, 0)as price,
|
||||||
|
t.short_name as short_name,
|
||||||
|
IFNULL(SUM(t.yard_amount), 0) AS mat_rest,
|
||||||
|
0 as exist
|
||||||
|
FROM
|
||||||
|
wms_storage_inventory t
|
||||||
|
LEFT JOIN base_material m ON m.id = t.material_id AND m.tenant_id = 2
|
||||||
|
LEFT JOIN system_dict_data d ON d.value = m.material_type AND d.dict_type = 'heli_material_type'
|
||||||
|
LEFT JOIN system_dict_data d1 ON d1.value = m.unit AND d1.dict_type = 'heli_material_unit'
|
||||||
|
LEFT JOIN wms_wh w ON w.id = t.wh_id AND w.tenant_id = 2
|
||||||
|
LEFT JOIN wms_rg r ON r.id = t.rg_id AND r.tenant_id = 2
|
||||||
|
LEFT JOIN wms_pn p ON p.id = t.pn_id AND p.tenant_id = 2
|
||||||
|
WHERE
|
||||||
|
t.deleted = 0
|
||||||
|
AND t.wh_id = #{whId}
|
||||||
|
AND m.virtual_part = 'N'
|
||||||
|
AND m.status = 1
|
||||||
|
AND t.tenant_id = 2
|
||||||
|
GROUP BY
|
||||||
|
t.id
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
-- 第二部分:查询不在库存中的物料
|
||||||
|
SELECT
|
||||||
|
mat.id as id,
|
||||||
|
mat.id as material_id,
|
||||||
|
mat.spec as boom_spec,
|
||||||
|
mat.unit as boom_unit,
|
||||||
|
mat.code AS mat_code,
|
||||||
|
mat.name AS mat_name,
|
||||||
|
(SELECT label FROM system_dict_data WHERE dict_type = 'heli_material_type' AND value = mat.material_type) AS mat_type,
|
||||||
|
mat.spec AS mat_spec,
|
||||||
|
(SELECT label FROM system_dict_data WHERE dict_type = 'heli_material_unit' AND value = mat.unit) AS mat_unit,
|
||||||
|
mat.brand AS mat_brand,
|
||||||
|
'' AS wh_id,
|
||||||
|
'' AS wh_name,
|
||||||
|
'' AS rg_id,
|
||||||
|
'' AS rg_name,
|
||||||
|
'' AS pn_id,
|
||||||
|
'' AS pn_name,
|
||||||
|
'' AS lot_no,
|
||||||
|
0 AS price,
|
||||||
|
mat.short_name as short_name,
|
||||||
|
0 AS mat_rest,
|
||||||
|
1 as exist
|
||||||
|
FROM
|
||||||
|
base_material AS mat
|
||||||
|
WHERE
|
||||||
|
mat.virtual_part = 'N'
|
||||||
|
AND mat.status = 1
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM wms_storage_inventory ml
|
||||||
|
WHERE ml.wh_id = #{whId}
|
||||||
|
AND ml.material_id = mat.id
|
||||||
|
AND ml.tenant_id = 2
|
||||||
|
)
|
||||||
|
AND mat.tenant_id = 2
|
||||||
|
) gh
|
||||||
|
<where>
|
||||||
|
<if test="matCode != null and matCode != ''">
|
||||||
|
AND (gh.mat_code LIKE CONCAT('%', #{matCode}, '%') OR gh.mat_name LIKE CONCAT('%', #{matCode}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="matType != null and matType != ''">
|
||||||
|
AND gh.mat_type = #{matType}
|
||||||
|
</if>
|
||||||
|
<if test="matSpec != null and matSpec != ''">
|
||||||
|
AND gh.mat_spec LIKE CONCAT('%', #{matSpec}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY gh.mat_code
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
@ -26,7 +26,9 @@ export const updateStorageCheckStatus = async (checkid:number) => {
|
|||||||
export const getStorageNowMatRest = async (matid:number,pnid:number) => {
|
export const getStorageNowMatRest = async (matid:number,pnid:number) => {
|
||||||
return await request.get({ url: `/heli/storage-log/matRest?matId=`+matid+'&pnId='+pnid })
|
return await request.get({ url: `/heli/storage-log/matRest?matId=`+matid+'&pnId='+pnid })
|
||||||
}
|
}
|
||||||
|
export const getStorageNowMatRestNew = async (matid:number,pnid:number) => {
|
||||||
|
return await request.get({ url: `/heli/storage-inventory/matRest?matId=`+matid+'&pnId='+pnid })
|
||||||
|
}
|
||||||
// 查询入/出库盘点分页
|
// 查询入/出库盘点分页
|
||||||
export const getStorageCheckPage = async (params) => {
|
export const getStorageCheckPage = async (params) => {
|
||||||
return await request.get({ url: `/heli/storage-check/page`, params })
|
return await request.get({ url: `/heli/storage-check/page`, params })
|
||||||
|
@ -26,6 +26,9 @@ export interface StorageInventoryVO {
|
|||||||
export const getStorageInventoryPage = async (params) => {
|
export const getStorageInventoryPage = async (params) => {
|
||||||
return await request.get({ url: `/heli/storage-inventory/page`, params })
|
return await request.get({ url: `/heli/storage-inventory/page`, params })
|
||||||
}
|
}
|
||||||
|
export const getStorageNowList = async (params) => {
|
||||||
|
return await request.get({ url: `/heli/storage-inventory/all`, params })
|
||||||
|
}
|
||||||
|
|
||||||
// 查询库存详情
|
// 查询库存详情
|
||||||
export const getStorageInventory = async (id: number) => {
|
export const getStorageInventory = async (id: number) => {
|
||||||
|
@ -710,7 +710,7 @@ const handlePn = async (pnid, scope) => {
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var currentMatRest = await CheckApi.getStorageNowMatRest(scope.row.id, scope.row.pnId)
|
var currentMatRest = await CheckApi.getStorageNowMatRestNew(scope.row.id, scope.row.pnId)
|
||||||
scope.row.matRest = currentMatRest
|
scope.row.matRest = currentMatRest
|
||||||
if (scope.row.storageOkQty == undefined || scope.row.storageOkQty == '') {
|
if (scope.row.storageOkQty == undefined || scope.row.storageOkQty == '') {
|
||||||
scope.row.matSub = 0
|
scope.row.matSub = 0
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<el-table-column prop="matBrand" label="品牌" min-width="120" align="center" />
|
<el-table-column prop="matBrand" label="品牌" min-width="120" align="center" />
|
||||||
<el-table-column prop="rgName" label="库区" min-width="120" align="center" />
|
<el-table-column prop="rgName" label="库区" min-width="120" align="center" />
|
||||||
<el-table-column prop="pnName" label="库位" min-width="140" align="center" />
|
<el-table-column prop="pnName" label="库位" min-width="140" align="center" />
|
||||||
<el-table-column prop="storageOkQty" label="库存数量" min-width="120" align="center" />
|
<el-table-column prop="matRest" label="库存数量" min-width="120" align="center" />
|
||||||
<el-table-column prop="matUnit" label="库存单位" min-width="120" align="center" />
|
<el-table-column prop="matUnit" label="库存单位" min-width="120" align="center" />
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import * as StorageLogApi from '@/api/heli/storagelog'
|
import * as SotrageInventoryApi from '@/api/heli/storageinventory'
|
||||||
import { ElTable } from 'element-plus'
|
import { ElTable } from 'element-plus'
|
||||||
|
|
||||||
//:selectable="row=>row.disabled || chkboxEnable"
|
//:selectable="row=>row.disabled || chkboxEnable"
|
||||||
@ -83,7 +83,7 @@ const clickRow = (row: any) => {
|
|||||||
}
|
}
|
||||||
//指定key值,数据更新之后保留之前选中的数据
|
//指定key值,数据更新之后保留之前选中的数据
|
||||||
const getRowKeys = (row) => {
|
const getRowKeys = (row) => {
|
||||||
return `${row.whId}_${row.matCode}_${row.pnId}`
|
return row.id
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryReqVo: any = reactive({
|
const queryReqVo: any = reactive({
|
||||||
@ -114,10 +114,11 @@ const overallnum = ref()
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await StorageLogApi.getStorageNowList(queryReqVo)
|
const data = await SotrageInventoryApi.getStorageNowList(queryReqVo)
|
||||||
total.value = Math.max(1, data.length)
|
total.value = Math.max(1, data.length)
|
||||||
overallnum.value = data.length
|
overallnum.value = data.length
|
||||||
list.value = data.splice((queryReqVo.pageNo - 1) * queryReqVo.pageSize, queryReqVo.pageSize)
|
list.value = data.splice((queryReqVo.pageNo - 1) * queryReqVo.pageSize, queryReqVo.pageSize)
|
||||||
|
console.log(list.value)
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
@ -125,7 +126,7 @@ const getList = async () => {
|
|||||||
const overallList = async () => {
|
const overallList = async () => {
|
||||||
// queryReqVo.pageSize = overallnum.value
|
// queryReqVo.pageSize = overallnum.value
|
||||||
queryReqVo.isAll = true
|
queryReqVo.isAll = true
|
||||||
const data1 = await StorageLogApi.getStorageNowList(queryReqVo)
|
const data1 = await SotrageInventoryApi.getStorageNowList(queryReqVo)
|
||||||
// queryReqVo.pageSize = 10
|
// queryReqVo.pageSize = 10
|
||||||
handleSelectionChange(data1)
|
handleSelectionChange(data1)
|
||||||
}
|
}
|
||||||
@ -167,7 +168,7 @@ const submitForm = async () => {
|
|||||||
try {
|
try {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
multipleSelection.value.forEach((item) => {
|
multipleSelection.value.forEach((item) => {
|
||||||
item.matRest = item.storageOkQty
|
item.matRest;
|
||||||
item.storageOkQty = ''
|
item.storageOkQty = ''
|
||||||
})
|
})
|
||||||
// 发送操作成功的事件
|
// 发送操作成功的事件
|
||||||
|
@ -7,17 +7,20 @@
|
|||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="108px">
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="108px">
|
||||||
<el-form-item label="物料编码" prop="matCode">
|
<el-form-item label="物料编码" prop="matCode">
|
||||||
<el-input v-model="queryParams.matCode" placeholder="物料编码" clearable @keyup.enter="handleQuery"
|
<el-input
|
||||||
|
v-model="queryParams.matCode" placeholder="物料编码" clearable @keyup.enter="handleQuery"
|
||||||
class="!w-240px" />
|
class="!w-240px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="物料名称" prop="matName">
|
<el-form-item label="物料名称" prop="matName">
|
||||||
<el-input v-model="queryParams.matName" placeholder="物料名称" clearable @keyup.enter="handleQuery"
|
<el-input
|
||||||
|
v-model="queryParams.matName" placeholder="物料名称" clearable @keyup.enter="handleQuery"
|
||||||
class="!w-240px" />
|
class="!w-240px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="物料类型" prop="matType">
|
<el-form-item label="物料类型" prop="matType">
|
||||||
<el-select v-model="queryParams.matType" placeholder="下拉选择" clearable class="!w-240px">
|
<el-select v-model="queryParams.matType" placeholder="下拉选择" clearable class="!w-240px">
|
||||||
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_MATERIAL_TYPE)" :key="dict.label" :label="dict.label"
|
<el-option
|
||||||
:value="dict.label" />
|
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_MATERIAL_TYPE)" :key="dict.label" :label="dict.label"
|
||||||
|
:value="dict.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -39,14 +42,18 @@
|
|||||||
<el-table-column label="物料名称" align="center" prop="matName" fixed min-width="120"/>
|
<el-table-column label="物料名称" align="center" prop="matName" fixed min-width="120"/>
|
||||||
<el-table-column label="物料编码" align="center" prop="matCode" fixed min-width="120" />
|
<el-table-column label="物料编码" align="center" prop="matCode" fixed min-width="120" />
|
||||||
<el-table-column label="物料类型" align="center" prop="matType" min-width="120"/>
|
<el-table-column label="物料类型" align="center" prop="matType" min-width="120"/>
|
||||||
<el-table-column label="库存数量" align="center" prop="storageOkQtys" min-width="120"/>
|
<el-table-column label="库存数量" align="center" prop="yardAmount" min-width="120"/>
|
||||||
<el-table-column label="库存单位" align="center" prop="matUnit" min-width="120"/>
|
<el-table-column label="库存单位" align="center" prop="matUnit" min-width="120"/>
|
||||||
<el-table-column label="库存单价(元)" align="center" prop="price" min-width="120">
|
<el-table-column label="库存单价(元)" align="center" prop="price" min-width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input-number v-model="scope.row.price" type="number" :precision="2" />
|
<el-input-number v-model="scope.row.price" type="number" :precision="2" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="库存金额(元)" align="center" prop="sumKcMoneys" min-width="120"/>
|
<el-table-column label="库存金额(元)" align="center" prop="sumKcMoneys" min-width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ (scope.row.price != null && scope.row.price != '') ? scope.row.price * scope.row.yardAmount : ''}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -60,7 +67,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
<Pagination
|
||||||
|
:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
||||||
@pagination="getList" />
|
@pagination="getList" />
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -68,8 +76,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import * as StorageLogApi from '@/api/heli/storagelog'
|
import * as SotrageInventoryApi from '@/api/heli/storageinventory'
|
||||||
|
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
|
||||||
import * as WarehouseApi from '@/api/heli/warehouse'
|
import * as WarehouseApi from '@/api/heli/warehouse'
|
||||||
@ -105,7 +112,7 @@ const emit = defineEmits(['success'])
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await StorageLogApi.getStorageNowPricePage(queryParams)
|
const data = await SotrageInventoryApi.getStorageInventoryPage(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
} finally {
|
} finally {
|
||||||
@ -121,7 +128,7 @@ const handleQuery = () => {
|
|||||||
const updatePrice = async (row) => {
|
const updatePrice = async (row) => {
|
||||||
try {
|
try {
|
||||||
await message.confirm("是否修改当前物料"+row.matName+"库存单价?")
|
await message.confirm("是否修改当前物料"+row.matName+"库存单价?")
|
||||||
await StorageLogApi.updatePrice(row);
|
await SotrageInventoryApi.updateStorageInventory(row);
|
||||||
message.success(t('修改成功'))
|
message.success(t('修改成功'))
|
||||||
await getList()
|
await getList()
|
||||||
}catch {}
|
}catch {}
|
||||||
|
Loading…
Reference in New Issue
Block a user