二级库功能修复

This commit is contained in:
hayu 2024-03-26 18:06:37 +08:00
parent 696380cec6
commit 85cb92670f
6 changed files with 148 additions and 82 deletions

View File

@ -40,6 +40,18 @@ public class SecondaryWarehouse {
*/
@Excel(name = "单位名称")
private String unitName;
/**
* 工程id
*/
private String proId;
/**
* 工程名称
*/
@Excel(name = "工程")
private String proName;
/**
* 工程名称
*/

View File

@ -32,15 +32,25 @@ public class TeamLeaseInfo {
*/
private String startTime;
private String endTime;
/**
*
*/
private String companyId;
/**
* 协议id
*/
private String agreementId;
/**
* 单位名称
*/
@Excel(name = "单位名称")
private String unitName;
/**
* 工程id
*/
private String proId;
/**
* 工程名称
*/
@Excel(name = "工程名称")
private String proName;
/**
* 工程名称
*/

View File

@ -25,4 +25,11 @@ public interface SecondaryWarehouseMapper {
List<TeamLeaseInfo> getRecordsThree(TeamLeaseInfo bean);
List<TeamLeaseInfo> getRecordsFour(TeamLeaseInfo bean);
/**
* 查看退库操作详情
* @param bean
* @return
*/
List<TeamLeaseInfo> getRecordsFive(TeamLeaseInfo bean);
}

View File

@ -44,13 +44,20 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
public List<TeamLeaseInfo> getRecords(TeamLeaseInfo bean) {
List<TeamLeaseInfo> list = new ArrayList<>();
if (STRING_1.equals(bean.getQueryType())){
//进场数量
list = mapper.getRecordsOne(bean);
} else if (STRING_2.equals(bean.getQueryType())) {
//退场数量
list = mapper.getRecordsTwo(bean);
} else if (STRING_3.equals(bean.getQueryType())) {
//场内库存
list = mapper.getRecordsThree(bean);
} else if (STRING_4.equals(bean.getQueryType())) {
//已出库数量
list = mapper.getRecordsFour(bean);
} else if (STRING_5.equals(bean.getQueryType())) {
//已退库数量
list = mapper.getRecordsFive(bean);
} else {
throw new ServiceException("查询出错");
}

View File

@ -4,36 +4,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.material.mapper.SecondaryWarehouseMapper">
<insert id="addOperate">
insert into team_lease_info (type_id,team_name,lease_man,phone,num,create_by,create_time,type)
values (#{typeId},#{teamName},#{leaseMan},#{phone},#{num},#{createBy},now(),#{type});
insert into team_lease_info (agreement_id,type_id,team_name,lease_man,phone,num,create_by,create_time,type)
values (#{agreementId},#{typeId},#{teamName},#{leaseMan},#{phone},#{num},#{createBy},now(),#{type});
</insert>
<select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse">
SELECT
bui.unit_id as unitId,
bui.unit_name AS unitName,
mt1.type_name AS typeName,
mt.type_name AS modelName,
mt.unit_name as nuitName,
sai.type_id as typeId,
SUM( sai.num ) AS jcNum,
SUM(CASE WHEN sai.`status` = '1' then sai.num ELSE 0 end) as tcNum,
SUM(CASE WHEN sai.`status` = '0' then sai.num ELSE 0 end) as kcNum,
SUM(CASE WHEN tli.num is null then 0 ELSE tli.num end) AS ckNum,
SUM(CASE WHEN sai.`status` = '0' THEN sai.num ELSE 0 END) - SUM(CASE WHEN tli.num IS NULL THEN 0 ELSE tli.num END) AS zkNum
bui.unit_id AS unitId,
sai.agreement_id AS agreementId,
bui.unit_name AS unitName,
bp.lot_name AS proName,
mt1.type_name AS typeName,
mt.type_name AS modelName,
mt.unit_name AS nuitName,
sai.type_id AS typeId,
SUM( sai.num ) AS jcNum,
SUM( CASE WHEN sai.`status` = '1' THEN sai.num ELSE 0 END ) AS tcNum,
SUM( CASE WHEN sai.`status` = '0' THEN sai.num ELSE 0 END ) - IFNULL( tli.num, 0 ) + IFNULL( tli2.num, 0 ) AS kcNum,
IFNULL( tli.num, 0 ) AS ckNum,
IFNULL( tli2.num, 0 ) AS zkNum
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN bm_unit_person bup ON bui.unit_id = bup.unit_id
LEFT JOIN team_lease_info tli ON bup.user_id = tli.create_by and sai.type_id = tli.type_id and tli.type = '1'
where 1=1
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ( SELECT SUM( num ) AS num, agreement_id, type_id FROM team_lease_info WHERE type = '1' GROUP BY agreement_id, type_id ) tli ON tli.agreement_id = sai.agreement_id
AND tli.type_id = sai.type_id
LEFT JOIN ( SELECT SUM( num ) AS num, agreement_id, type_id FROM team_lease_info WHERE type = '2' GROUP BY agreement_id, type_id ) tli2 ON tli2.agreement_id = sai.agreement_id
AND tli2.type_id = sai.type_id
WHERE 1=1
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}
</if>
<if test="proId != null and proId != ''">
and bp.lot_id = #{proId}
</if>
<if test="typeId != null and typeId != ''">
and mt1.type_id = #{typeId}
</if>
@ -42,32 +49,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="keyword != null and keyword != ''">
and (bui.unit_name like concat('%', #{keyword}, '%') or
bp.lot_name like concat('%', #{keyword}, '%') or
mt1.type_name like concat('%', #{keyword}, '%') or
mt.type_name like concat('%', #{keyword}, '%')
)
</if>
GROUP BY
bui.unit_id,
sai.type_id
sai.agreement_id,
sai.type_id
</select>
<select id="getOperateList" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
select bui.unit_name AS unitName,
mt1.type_name AS typeName,
mt.type_name AS modelName,
tli.num,
tli.lease_man as leaseMan,
su.nick_name as createBy,
tli.create_time as createTime
from team_lease_info tli
LEFT JOIN bm_unit_person bup ON tli.create_by = bup.user_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bup.unit_id
SELECT
bui.unit_name AS unitName,
bp.lot_name AS proName,
mt1.type_name AS typeName,
mt.type_name AS modelName,
tli.num,
tli.lease_man AS leaseMan,
su.nick_name AS createBy,
tli.create_time AS createTime
FROM
team_lease_info tli
LEFT JOIN bm_agreement_info bai ON tli.agreement_id = bai.agreement_id
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON tli.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
left join sys_user su on su.user_id = tli.create_by
LEFT JOIN sys_user su ON su.user_id = tli.create_by
where tli.type = #{type}
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}
</if>
<if test="proId != null and proId != ''">
and bp.lot_id = #{proId}
</if>
<if test="typeId != null and typeId != ''">
and mt1.type_id = #{typeId}
</if>
@ -76,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="keyword != null and keyword != ''">
and (bui.unit_name like concat('%', #{keyword}, '%') or
bp.lot_name like concat('%', #{keyword}, '%') or
mt1.type_name like concat('%', #{keyword}, '%') or
mt.type_name like concat('%', #{keyword}, '%') or
tli.lease_man like concat('%', #{keyword}, '%') or
@ -92,11 +108,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.start_time as startTime
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
where bui.unit_id = #{unitId} and mt.type_id = #{typeId}
where mt.type_id = #{typeId} and sai.agreement_id=#{agreementId}
<if test="startTime != null and startTime != ''">
and DATE(sai.start_time) = #{startTime}
</if>
@ -111,11 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.end_time as startTime
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
where bui.unit_id = #{unitId} and mt.type_id = #{typeId} and sai.status = '1'
where sai.agreement_id=#{agreementId} and mt.type_id = #{typeId} and sai.status = '1'
<if test="startTime != null and startTime != ''">
and DATE(sai.end_time) = #{startTime}
</if>
@ -130,11 +142,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.start_time as startTime
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
where bui.unit_id = #{unitId} and mt.type_id = #{typeId} and sai.status = '0'
where sai.agreement_id=#{agreementId} and mt.type_id = #{typeId} and sai.status = '0'
<if test="startTime != null and startTime != ''">
and DATE(sai.start_time) = #{startTime}
</if>
@ -148,12 +158,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.nick_name as createBy,
tli.create_time as startTime
from team_lease_info tli
LEFT JOIN bm_unit_person bup ON tli.create_by = bup.user_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bup.unit_id
LEFT JOIN ma_type mt ON tli.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
left join sys_user su on su.user_id = tli.create_by
where bui.unit_id = #{unitId} and mt.type_id = #{typeId}
where tli.agreement_id=#{agreementId} and mt.type_id = #{typeId} and tli.type = '1'
<if test="startTime != null and startTime != ''">
and DATE(tli.create_time) = #{startTime}
</if>
</select>
<select id="getRecordsFive" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
select tli.team_name as teamName,
mt1.type_name AS typeName,
mt.type_name AS modelName,
tli.num,
su.nick_name as createBy,
tli.create_time as startTime
from team_lease_info tli
LEFT JOIN ma_type mt ON tli.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
left join sys_user su on su.user_id = tli.create_by
where tli.agreement_id=#{agreementId} and mt.type_id = #{typeId} and tli.type = '2'
<if test="startTime != null and startTime != ''">
and DATE(tli.create_time) = #{startTime}
</if>

View File

@ -91,17 +91,21 @@
<span class="clickText" @click="openRecords(scope.row,2)">{{scope.row.tcNUm}}</span>
</template>
</el-table-column>
<el-table-column label="场内库存量" align="center" prop="kcNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span class="clickText" @click="openRecords(scope.row,3)">{{scope.row.kcNum}}</span>
</template>
</el-table-column>
<el-table-column label="场内库存量" align="center" prop="kcNum" :show-overflow-tooltip="true"/>
<!-- <template slot-scope="scope">-->
<!-- <span class="clickText" @click="openRecords(scope.row,3)">{{scope.row.kcNum}}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="已出库数量" align="center" prop="ckNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span class="clickText" @click="openRecords(scope.row,4)">{{scope.row.ckNum}}</span>
</template>
</el-table-column>
<el-table-column label="在库数量" align="center" prop="zkNum" :show-overflow-tooltip="true" />
<el-table-column label="已退库数量" align="center" prop="zkNum" :show-overflow-tooltip="true" >
<template slot-scope="scope">
<span class="clickText" @click="openRecords(scope.row,5)">{{scope.row.zkNum}}</span>
</template>
</el-table-column>
<el-table-column label="计量单位" align="center" prop="nuitName" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
@ -136,8 +140,8 @@
<el-form-item label="规格型号" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入规格型号" disabled/>
</el-form-item>
<el-form-item label="在库数量" prop="zkNum">
<el-input v-model="form.zkNum" placeholder="请输入在库数量" disabled/>
<el-form-item label="在库数量" prop="kcNum">
<el-input v-model="form.kcNum" placeholder="请输入在库数量" disabled/>
</el-form-item>
<el-form-item label="出库数量" prop="num">
@ -442,6 +446,7 @@ export default {
this.$set(this.form,'typeName',row.typeName)
this.$set(this.form,'modelName',row.modelName)
this.$set(this.form,'zkNum',row.zkNum)
this.$set(this.form,'kcNum',row.kcNum)
// console.log(this.form)
this.openOut = true;
this.title = "出库";
@ -449,7 +454,7 @@ export default {
handleIn(row) {//2
this.reset();
// this.nform = row;
this.$set(this.form,'agreementId',row.agreementId)
this.$set(this.nform,'agreementId',row.agreementId)
this.$set(this.nform,'unitId',row.unitId)
this.$set(this.nform,'typeId',row.typeId)
this.$set(this.nform,'unitName',row.unitName)
@ -495,6 +500,7 @@ export default {
this.openRecord = true;
this.queryType = type
this.dialogQuery.typeName = row.typeName;
this.dialogQuery.agreementId = row.agreementId;
this.dialogQuery.modelName = row.modelName;
this.dialogQuery.unitId = row.unitId;
this.dialogQuery.typeId = row.typeId;