Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -34,5 +34,11 @@ public interface StIvtStructivtDailyMapper extends BaseMapper<StIvtStructivtDail
|
|||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
List<JSONObject> getIoNum(@Param("query") Map json);
|
List<JSONObject> getIoNum(@Param("query") Map json);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收发存查询
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
List<JSONObject> getPhyIvt(@Param("query") Map json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,4 +83,42 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getPhyIvt" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
mater.material_id,
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
mater.material_spec,
|
||||||
|
MAX(unit.unit_name) AS qty_unit_name,
|
||||||
|
SUM(da.in_qty) AS in_qty,
|
||||||
|
SUM(da.out_qty) AS out_qty,
|
||||||
|
SUM(da.canuse_qty) AS canuse_qty
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt_daily da
|
||||||
|
LEFT JOIN md_me_materialbase mater ON da.material_id = mater.material_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = da.qty_unit_id
|
||||||
|
<where>
|
||||||
|
1 = 1
|
||||||
|
<if test="query.stor_id != null and query.stor_id != ''">
|
||||||
|
and da.stor_id = #{query.stor_id}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="query.begin_time != null and query.begin_time != ''">
|
||||||
|
and da.create_time >= #{query.begin_time}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="query.end_time != null and query.end_time != ''">
|
||||||
|
and #{query.end_time} >= da.create_time
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="query.material_code != null and query.material_code != ''">
|
||||||
|
and (mater.material_code LIKE '%${query.material_code}%' or
|
||||||
|
mater.material_name LIKE '%${query.material_code}%' or
|
||||||
|
mater.material_spec LIKE '%${query.material_code}%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
group by mater.material_id
|
||||||
|
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.stata_manage.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.wms.stata_manage.service.PhyivtService;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "收发存查询")
|
||||||
|
@RequestMapping("/api/phyivt")
|
||||||
|
@Slf4j
|
||||||
|
public class PhyivtController {
|
||||||
|
|
||||||
|
private final PhyivtService phyivtService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@ApiOperation("库存查询")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(phyivtService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.stata_manage.service;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务接口
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
public interface PhyivtService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.stata_manage.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.common.utils.PageUtil;
|
||||||
|
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.StIvtStructivtDaily;
|
||||||
|
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.mapper.StIvtStructivtDailyMapper;
|
||||||
|
import org.nl.wms.stata_manage.service.PhyivtService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务实现
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class PhyivtServiceImpl implements PhyivtService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StIvtStructivtDailyMapper stIvtStructivtDailyMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
|
|
||||||
|
whereJson.put("begin_time", MapUtil.getStr(whereJson, "begin_time").substring(0,10));
|
||||||
|
whereJson.put("end_time", MapUtil.getStr(whereJson, "end_time").substring(0,10));
|
||||||
|
|
||||||
|
List<JSONObject> phyIvtList = stIvtStructivtDailyMapper.getPhyIvt(whereJson);
|
||||||
|
|
||||||
|
// 计算期初数
|
||||||
|
List<StIvtStructivtDaily> beginList = stIvtStructivtDailyMapper.selectList(
|
||||||
|
new QueryWrapper<StIvtStructivtDaily>().lambda()
|
||||||
|
.eq(StIvtStructivtDaily::getCreate_time, MapUtil.getStr(whereJson, "begin_time").substring(0, 10))
|
||||||
|
);
|
||||||
|
|
||||||
|
for(JSONObject json : phyIvtList) {
|
||||||
|
|
||||||
|
List<StIvtStructivtDaily> dao = beginList.stream()
|
||||||
|
.filter(row -> row.getMaterial_id().equals(json.getString("material_id")))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
json.put("begin_qty", ObjectUtil.isNotEmpty(dao) ? dao.get(0).getCanuse_qty() : 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理分页
|
||||||
|
Map<String, Object> json = PageUtil.toPage(
|
||||||
|
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), phyIvtList),
|
||||||
|
phyIvtList.size()
|
||||||
|
);
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
<!--分页-->
|
<!--分页-->
|
||||||
<template>
|
<template>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
|
background
|
||||||
:page-size.sync="page.size"
|
:page-size.sync="page.size"
|
||||||
:total="page.total"
|
:total="page.total"
|
||||||
:current-page.sync="page.page"
|
:current-page.sync="page.page"
|
||||||
style="margin-top: 8px;"
|
style="margin-top: 12px;"
|
||||||
layout="total, prev, pager, next, sizes"
|
layout="total, prev, pager, next, sizes"
|
||||||
@size-change="crud.sizeChangeHandler($event)"
|
@size-change="crud.sizeChangeHandler($event)"
|
||||||
@current-change="crud.pageChangeHandler"
|
@current-change="crud.pageChangeHandler"
|
||||||
|
|||||||
172
mes/qd/src/views/wms/stata_manage/phyivt/index.vue
Normal file
172
mes/qd/src/views/wms/stata_manage/phyivt/index.vue
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="80px"
|
||||||
|
label-suffix=":"
|
||||||
|
size="mini"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-form-item label="仓库">
|
||||||
|
<label slot="label">仓 库:</label>
|
||||||
|
<el-select
|
||||||
|
v-model="query.stor_id"
|
||||||
|
size="mini"
|
||||||
|
placeholder="单据状态"
|
||||||
|
class="filter-item"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in storlist"
|
||||||
|
:key="item.stor_id"
|
||||||
|
:label="item.stor_name"
|
||||||
|
:value="item.stor_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="日期">
|
||||||
|
<label slot="label">日 期:</label>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="query.createTime"
|
||||||
|
type="daterange"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:clearable="false"
|
||||||
|
@input="onInput()"
|
||||||
|
@change="mytoQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="物料编码">
|
||||||
|
<el-input
|
||||||
|
v-model="query.material_code"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="请输入物料编码、名称、规格"
|
||||||
|
style="width: 230px;"
|
||||||
|
class="filter-item"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission"/>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
:data="crud.data"
|
||||||
|
size="mini"
|
||||||
|
show-summary
|
||||||
|
:max-height="590"
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="material_code" label="物料编码" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="material_name" label="物料名称" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="material_spec" label="物料规格" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="qty_unit_name" label="单位" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="begin_qty" label="期初" :formatter="crud.formatNum3" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="in_qty" label="入库" :formatter="crud.formatNum3" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="out_qty" label="出库" :formatter="crud.formatNum3" />
|
||||||
|
<el-table-column show-overflow-tooltip min-width="120" prop="canuse_qty" label="结存" :formatter="crud.formatNum3" />
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudPhyivt from '@/views/wms/stata_manage/phyivt/phyivt'
|
||||||
|
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import DateRangePicker from '@/components/DateRangePicker/index'
|
||||||
|
import Date from '@/utils/datetime'
|
||||||
|
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Phyivt',
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
|
||||||
|
mixins: [presenter(), header(), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '收发存',
|
||||||
|
url: 'api/phyivt',
|
||||||
|
idField: 'id',
|
||||||
|
sort: 'id,desc',
|
||||||
|
crudMethod: { ...crudPhyivt },
|
||||||
|
props: {
|
||||||
|
// 每页数据条数
|
||||||
|
size: 10
|
||||||
|
},
|
||||||
|
optShow: {
|
||||||
|
add: false,
|
||||||
|
edit: false,
|
||||||
|
del: false,
|
||||||
|
download: false,
|
||||||
|
reset: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
storlist: [],
|
||||||
|
query_flag: true,
|
||||||
|
permission: {
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
}}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
crudStorattr.getStor({ 'stor_type': '' }).then(res => {
|
||||||
|
this.storlist = res.content
|
||||||
|
})
|
||||||
|
this.crud.query.createTime = [new Date().daysAgo(6), new Date()]
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
if (this.query_flag) {
|
||||||
|
this.crud.query.begin_time = (new Date().daysAgo(6)).strftime('%F', 'zh')
|
||||||
|
this.crud.query.end_time = (new Date()).strftime('%F', 'zh')
|
||||||
|
this.crud.query.stor_id = '1528627995269533696'
|
||||||
|
this.query_flag = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hand(value) {
|
||||||
|
this.crud.toQuery()
|
||||||
|
},
|
||||||
|
onInput() {
|
||||||
|
this.$forceUpdate()
|
||||||
|
},
|
||||||
|
mytoQuery(array1) {
|
||||||
|
if (array1 === null) {
|
||||||
|
this.crud.query.begin_time = ''
|
||||||
|
this.crud.query.end_time = ''
|
||||||
|
} else {
|
||||||
|
this.crud.query.begin_time = array1[0]
|
||||||
|
this.crud.query.end_time = array1[1]
|
||||||
|
}
|
||||||
|
this.crud.toQuery()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
27
mes/qd/src/views/wms/stata_manage/phyivt/phyivt.js
Normal file
27
mes/qd/src/views/wms/stata_manage/phyivt/phyivt.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/phyivt',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/phyivt/',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/phyivt',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del }
|
||||||
Reference in New Issue
Block a user