入库查询物料问题修改
This commit is contained in:
parent
a418613ecd
commit
38a424ae9b
@ -50,7 +50,7 @@ public class StorageMaterialDO extends BaseDO {
|
||||
private String pnName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String matRest;
|
||||
private BigDecimal matRest;
|
||||
@TableField(exist = false)
|
||||
private String num;
|
||||
|
||||
|
@ -46,20 +46,17 @@ public interface StorageMaterialMapper extends BaseMapperX<StorageMaterialDO> {
|
||||
MPJLambdaWrapper<StorageMaterialDO> query = new MPJLambdaWrapper<>();
|
||||
|
||||
query.selectAll(StorageMaterialDO.class)
|
||||
.select("ifnull(sum(t.storage_ok_qty),0) mat_rest")
|
||||
.select("count(t.id) num");
|
||||
.select("ifnull(sum(t.storage_ok_qty),0) matRest")
|
||||
.select("count(t.id) num")
|
||||
|
||||
.orderByDesc(StorageMaterialDO::getId);
|
||||
|
||||
query.like(!StringUtils.isEmpty(reqVO.getMatType()),StorageMaterialDO::getMatType, reqVO.getMatType())
|
||||
.like(!StringUtils.isEmpty(reqVO.getMatSpec()),StorageMaterialDO::getMatSpec, reqVO.getMatSpec())
|
||||
.like(!StringUtils.isEmpty(reqVO.getMatName()), StorageMaterialDO::getMatName, reqVO.getMatName())
|
||||
.like(!StringUtils.isEmpty(reqVO.getMatCode()), StorageMaterialDO::getMatCode, reqVO.getMatCode())
|
||||
.like(!StringUtils.isEmpty(reqVO.getLotNo()),StorageMaterialDO::getLotNo, reqVO.getLotNo())
|
||||
.eq(reqVO.getWhId()!=null,StorageMaterialDO::getWhId,reqVO.getWhId())
|
||||
.groupBy(StorageMaterialDO::getMatCode)
|
||||
.groupBy(StorageMaterialDO::getWhId)
|
||||
.groupBy(StorageMaterialDO::getPnId)
|
||||
.groupBy(StorageMaterialDO::getRgId)
|
||||
.orderByDesc(StorageMaterialDO::getId);
|
||||
.groupBy(StorageMaterialDO::getId).orderByDesc(StorageMaterialDO::getId);
|
||||
|
||||
return selectPage(reqVO,query);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.storagelog;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.bdgzsomthing.bdgzsomthingDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
|
||||
@ -13,9 +15,12 @@ import com.chanko.yunxi.mes.module.heli.dal.mysql.storagelog.StorageLogNowMapper
|
||||
import com.chanko.yunxi.mes.module.heli.dal.mysql.storagelog.StorageMaterialMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelog.StorageLogDO;
|
||||
@ -119,7 +124,25 @@ public class StorageLogServiceImpl implements StorageLogService {
|
||||
|
||||
@Override
|
||||
public PageResult<StorageMaterialDO> getStorageNowPageGroupMaterial(StorageLogPageReqVO pageReqVO) {
|
||||
return storageMaterialMapper.selectMaterialGroupNow(pageReqVO);
|
||||
PageResult<StorageMaterialDO> pageResult = storageMaterialMapper.selectMaterialGroupNow(pageReqVO);
|
||||
if (ObjectUtil.isNotEmpty(pageReqVO.getWhId())){
|
||||
for (StorageMaterialDO storageMaterialDO : pageResult.getList()) {
|
||||
LambdaQueryWrapper<StorageLogNowDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(StorageLogNowDO::getWhId,pageReqVO.getWhId());
|
||||
wrapper.eq(StorageLogNowDO::getMatCode,storageMaterialDO.getMatCode());
|
||||
List<StorageLogNowDO> list = storageLogNowMapper.selectList(wrapper);
|
||||
if (list!=null&&list.size()>0){
|
||||
storageMaterialDO.setMatRest(list.stream()
|
||||
.map(StorageLogNowDO::getStorageOkQty)
|
||||
.filter(Objects::nonNull) // 确保过滤掉 null 值
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
}else {
|
||||
storageMaterialDO.setMatRest(BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -663,12 +663,8 @@ import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
import MaterialSelect from '@/views/heli/hlvuestyle/materialSelect.vue'
|
||||
import CompositionSelect from '@/views/heli/hlvuestyle/compositionSelect.vue'
|
||||
|
||||
import materials from '@/views/heli/storage/materials.vue'
|
||||
import MaterialDialog from '@/views/heli/purchaseorder/materialDialog.vue'
|
||||
import BoomDialog from '@/views/heli/purchaseorder/boomDialog.vue'
|
||||
import SupplierSelect from '@/views/heli/hlvuestyle/supplierSelect.vue'
|
||||
import {setFlagsFromString} from "node:v8";
|
||||
|
||||
import SupplierSelect from '@/views/heli/hlvuestyle/supplierSelect.vue'
|
||||
const reload: any = inject('reload')
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
@ -41,7 +41,8 @@
|
||||
{{scope.row.num>1&&formType=='group'? '':scope.row.pnName}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="storageOkQty" label="库存数量" min-width="120" align="center" />
|
||||
<el-table-column prop="storageOkQty" label="库存数量" min-width="120" align="center" v-if="formType=='out'"/>
|
||||
<el-table-column prop="matRest" label="库存数量" min-width="120" align="center" v-if="formType!='out'"/>
|
||||
<el-table-column prop="matUnit" label="库存单位" min-width="120" align="center" />
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
@ -125,7 +126,6 @@ const getList = async () => {
|
||||
data = await StorageLogApi.getStorageNowMaterialGroupPage(queryReqVo)
|
||||
}else if(formType.value == 'group'){
|
||||
data = await StorageLogApi.getStorageNowMaterialGroupPage(queryReqVo)
|
||||
console.log(JSON.stringify(data))
|
||||
data.list.forEach(mat =>{
|
||||
mat.storageOkQty = mat.matRest
|
||||
mat.requireAmount = mat.matRest
|
||||
|
Loading…
Reference in New Issue
Block a user