二级库模块前后端修改

This commit is contained in:
76164 2024-07-24 18:50:46 +08:00
parent 1e37e8aea8
commit 805f69de95
12 changed files with 267 additions and 130 deletions

View File

@ -86,5 +86,7 @@ public class MaPartType extends BaseEntity {
// @Excel(name = "年份")
private String year;
private String firstLevel;
}

View File

@ -0,0 +1,11 @@
package com.bonus.sgzb.base.service;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
public interface ExcelService {
Map<String, Map<String, List<String>>> readExcelFile(String filePath);
}

View File

@ -54,9 +54,10 @@ public class SecondaryWarehouseController extends BaseController {
*/
@ApiOperation(value = "出库/退库操作")
@PostMapping("/operate")
@Log(title = "二级库管理--出库退库操作", businessType = BusinessType.MATERIAL)
public AjaxResult operate(TeamLeaseInfo bean){
return toAjax(service.addOperate(bean));
@Log(title = "二级库管理--出库退库操作")
public AjaxResult operate(@RequestBody TeamLeaseInfo bean){
int i = service.addNewOperate(bean);
return toAjax(i);
}
/**

View File

@ -11,7 +11,7 @@ import lombok.Data;
@Data
public class SecondaryWarehouse {
/**
*
*
*/
private Long id;
/**
@ -100,6 +100,7 @@ public class SecondaryWarehouse {
*/
@Excel(name = "计量单位")
private String nuitName;
private String keyword;
/**
@ -111,6 +112,14 @@ public class SecondaryWarehouse {
/**
* 领用数量
*/
@Excel(name = "领用数量")
private Integer Num;
/**
* 领用数量
*/
private Integer receiveNum;
/**
* 库存数量
*/
private Integer stockNum;
}

View File

@ -1,8 +1,12 @@
package com.bonus.sgzb.material.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author c liu
@ -11,7 +15,7 @@ import lombok.Data;
@Data
public class TeamLeaseInfo {
/**
*
*
*/
private Long id;
/**
@ -27,6 +31,14 @@ public class TeamLeaseInfo {
*机具id
*/
private String maId;
/**
*领料人
*/
private String pickName;
/**
*出库人
*/
private String nickName;
/**
* 查询时间
*/
@ -108,5 +120,9 @@ public class TeamLeaseInfo {
*/
private String queryType;
private int outNum;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date outTime;
}

View File

@ -32,4 +32,12 @@ public interface SecondaryWarehouseMapper {
* @return
*/
List<TeamLeaseInfo> getRecordsFive(TeamLeaseInfo bean);
// List<TeamLeaseInfo> getNewRecordsFive(TeamLeaseInfo bean);
int addNewOperate(TeamLeaseInfo bean);
Integer selectStockNum(SecondaryWarehouse secondaryWarehouse);
List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean);
}

View File

@ -12,9 +12,13 @@ import java.util.List;
public interface SecondaryWarehouseService {
List<SecondaryWarehouse> getList(SecondaryWarehouse bean);
int addOperate(TeamLeaseInfo bean);
// int addOperate(TeamLeaseInfo bean);
List<TeamLeaseInfo> getOperateList(TeamLeaseInfo bean);
List<TeamLeaseInfo> getRecords(TeamLeaseInfo bean);
// List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean);
int addNewOperate(TeamLeaseInfo bean);
}

View File

@ -25,15 +25,24 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
@Override
public List<SecondaryWarehouse> getList(SecondaryWarehouse bean) {
return mapper.getList(bean);
List<SecondaryWarehouse> list = mapper.getList(bean);
for (SecondaryWarehouse secondaryWarehouse : list) {
Integer warehouse = mapper.selectStockNum(secondaryWarehouse);
if (warehouse == null) {
warehouse = 0;
}
secondaryWarehouse.setReceiveNum(warehouse);
secondaryWarehouse.setStockNum(secondaryWarehouse.getNum() - secondaryWarehouse.getReceiveNum());
}
return list;
}
@Override
public int addOperate(TeamLeaseInfo bean) {
Long userid = SecurityUtils.getLoginUser().getUserid();
bean.setCreateBy(String.valueOf(userid));
return mapper.addOperate(bean);
}
// @Override
// public int addOperate(TeamLeaseInfo bean) {
// Long userid = SecurityUtils.getLoginUser().getUserid();
// bean.setCreateBy(String.valueOf(userid));
// return mapper.addOperate(bean);
// }
@Override
public List<TeamLeaseInfo> getOperateList(TeamLeaseInfo bean) {
@ -42,25 +51,38 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
@Override
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("查询出错");
}
return list;
return mapper.getNewRecords(bean);
}
@Override
public int addNewOperate(TeamLeaseInfo bean) {
Long userid = SecurityUtils.getLoginUser().getUserid();
bean.setCreateBy(String.valueOf(userid));
return mapper.addNewOperate(bean);
}
// @Override
// public List<TeamLeaseInfo> getNewRecords(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.getNewRecordsFive(bean);
// } else {
// throw new ServiceException("查询出错");
// }
// return list;
// }
}

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse">
SELECT
bui.unit_id AS unitId,
lod.id as id,
tta.agreement_id AS agreementId,
bui.unit_name AS unitName,
bp.lot_name AS proName,
@ -18,12 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name AS modelName,
mt.unit_name AS nuitName,
lod.type_id AS typeId,
SUM( lod.out_num ) AS jcNum,
receive_num as receiveNmu,
-- 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
IFNULL(SUM( lod.out_num ),0) AS Num
from lease_out_details lod
left join lease_apply_info lai on lod.parent_id=lai.id
left join tm_task_agreement tta on lai.task_id=tta.task_id
@ -32,10 +29,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON lod.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 = tta.agreement_id
AND tli.type_id = lod.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 = tta.agreement_id
AND tli2.type_id = lod.type_id
WHERE 1=1
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}
@ -187,4 +180,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE(tli.create_time) = #{startTime}
</if>
</select>
</mapper>
<select id="selectStockNum" resultType="java.lang.Integer">
SELECT
(
SUM(
IF
( rd.type = 1, rd.out_num, 0 )) - SUM(
IF
( rd.type = 2, rd.out_num, 0 ))) AS receiveNum
FROM
receive_detail rd
WHERE
parent_id = #{id}
</select>
<select id="getNewRecords" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
select mt.type_name modelName,
mt2.type_name typeName,
su.nick_name nickName,
rd.out_num outNum,
rd.pick_name pickName,
rd.out_time outTime
from receive_detail rd
left join ma_type mt on rd.type_id = mt.type_id
left join ma_type mt2 on mt.parent_id = mt2.type_id
left join sys_user su on rd.out_name = su.user_id
where 1=1
<if test="typeId != null and typeId != ''">
and mt2.type_id = #{typeId}
</if>
<if test="modelId != null and modelId != ''">
and mt.type_id = #{modelId}
</if>
</select>
<insert id="addNewOperate">
insert into receive_detail (parent_id,type_id,out_num,out_time,type,out_name)
values (#{id},#{typeId},#{outNum},now(),#{type},#{createBy});
</insert>
</mapper>

View File

@ -20,11 +20,11 @@ export function getOperateList(query) {
// 出库/退库操作
export function operate(query) {
export function operate(data) {
return request({
url: '/material/secondaryWarehouse/operate',
method: 'post',
params: query
data
})
}

View File

@ -148,6 +148,7 @@
</el-table-column> -->
<el-table-column
align="center"
key="1"
label="序号"
type="index"
:index="
@ -157,12 +158,15 @@
<el-table-column
label="单位名称"
align="center"
key="2"
prop="unitName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="工程名称"
align="center"
key="3"
prop="proName"
:show-overflow-tooltip="true"
v-if="leaseType == 0"
@ -170,86 +174,76 @@
<el-table-column
label="类型名称"
align="center"
key="4"
prop="typeName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="规格型号"
align="center"
key="5"
prop="modelName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="计量单位"
align="center"
key="6"
prop="nuitName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="进场数量"
align="center"
prop="jcNum"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<span
class="clickText"
@click="openRecords(scope.row, 1)"
>{{ scope.row.jcNum }}</span
>
</template>
</el-table-column>
<el-table-column
label="退场数量"
align="center"
prop="tcNUm"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<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"
label="总量"
align="center"
key="7"
prop="num"
:show-overflow-tooltip="true"
v-if="leaseType == 1"
/>
<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>
label="库存数量"
align="center"
key="8"
prop="stockNum"
:show-overflow-tooltip="true"
v-if="leaseType == 1"
/>
<el-table-column
label="已退库数量"
label="领用数量"
align="center"
prop="zkNum"
key="9"
prop="receiveNum"
:show-overflow-tooltip="true"
v-if="leaseType == 1"
>
<template slot-scope="scope">
<span
class="clickText"
@click="openRecords(scope.row, 5)"
>{{ scope.row.zkNum }}</span
>{{ scope.row.receiveNum }}</span
>
</template>
</el-table-column>
<el-table-column
label="在用数量"
align="center"
key="10"
prop="receiveNum"
:show-overflow-tooltip="true"
v-if="leaseType == 0"
/>
<el-table-column
label="操作"
align="center"
key="11"
width="150"
v-if="leaseType == 1"
>
@ -258,7 +252,7 @@
size="mini"
type="primary"
@click="handleOut(scope.row)"
v-if="parseInt(scope.row.kcNum) > 0"
v-if="parseInt(scope.row.stockNum) > 0"
>
出库
</el-button>
@ -267,9 +261,9 @@
type="warning"
@click="handleIn(scope.row)"
v-if="
parseInt(scope.row.ckNum) > 0 &&
parseInt(scope.row.zkNum) <
parseInt(scope.row.ckNum)
parseInt(scope.row.receiveNum) > 0 &&
parseInt(scope.row.stockNum) <
parseInt(scope.row.num)
"
>
退库
@ -322,8 +316,8 @@
/>
</el-form-item>
<el-form-item label="出库数量" prop="num">
<el-input v-model="form.num" placeholder="请输入出库数量" maxlength="20" />
<el-form-item label="出库数量" prop="outNum">
<el-input v-model="form.outNum" placeholder="请输入出库数量" maxlength="20" />
</el-form-item>
<el-form-item label="班组名称" prop="teamName">
<el-input
@ -384,13 +378,13 @@
disabled
/>
</el-form-item>
<el-form-item label="已出库数量" prop="ckNum">
<!-- <el-form-item label="已出库数量" prop="ckNum">
<el-input v-model="nform.ckNum" disabled />
</el-form-item>
</el-form-item>-->
<el-form-item label="退库数量" prop="num">
<el-form-item label="退库数量" prop="outNum">
<el-input
v-model="nform.num"
v-model="nform.outNum"
placeholder="请输入退库数量"
maxlength="50"
/>
@ -440,7 +434,7 @@
:inline="true"
label-width="80px"
>
<el-form-item label="记录时间" prop="startTime">
<!-- <el-form-item label="记录时间" prop="startTime">
<el-date-picker
v-model="dialogQuery.startTime"
style="width: 240px"
@ -448,7 +442,7 @@
type="date"
placeholder="记录时间"
></el-date-picker>
</el-form-item>
</el-form-item>-->
<el-form-item label="类型名称" prop="typeName">
<el-input v-model="dialogQuery.typeName" disabled />
</el-form-item>
@ -500,23 +494,29 @@
:show-overflow-tooltip="true"
/>
<el-table-column
label="数量"
label="出库数量"
align="center"
prop="num"
prop="outNum"
:show-overflow-tooltip="true"
/>
<el-table-column
label="记录时间"
label="领料人员"
align="center"
prop="startTime"
prop="pickName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作类型"
label="出库人员"
align="center"
prop=""
prop="outName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="出库时间"
align="center"
prop="outTime"
:show-overflow-tooltip="true"
/>
</el-table>
<pagination
@ -589,7 +589,7 @@ export default {
form: {},
//
rules: {
num: [
outNum: [
{
required: true,
message: '出库数量不能为空',
@ -617,7 +617,7 @@ export default {
// 退
nform: {},
nrules: {
num: [
outNum: [
{
required: true,
message: '退库数量不能为空',
@ -769,15 +769,16 @@ export default {
//1
this.reset()
// this.form = row;
// console.log(row)
console.log(row)
this.$set(this.form, 'id', row.id)
this.$set(this.form, 'agreementId', row.agreementId)
this.$set(this.form, 'unitId', row.unitId)
this.$set(this.form, 'typeId', row.typeId)
this.$set(this.form, 'unitName', row.unitName)
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)
this.$set(this.form, 'zkNum', row.stockNum)
this.$set(this.form, 'kcNum', row.num)
// console.log(this.form)
this.openOut = true
this.title = '出库'
@ -785,7 +786,9 @@ export default {
handleIn(row) {
//2
this.reset()
console.log(row)
// this.nform = row;
this.$set(this.nform, 'id', row.id)
this.$set(this.nform, 'agreementId', row.agreementId)
this.$set(this.nform, 'unitId', row.unitId)
this.$set(this.nform, 'typeId', row.typeId)
@ -811,6 +814,7 @@ export default {
let param = {}
param = this.form
param.type = 1
console.log(param)
operate(param).then((response) => {
this.$modal.msgSuccess('操作成功')
this.openOut = false
@ -846,19 +850,19 @@ export default {
openRecords(row, type) {
this.title = undefined
this.openRecord = true
this.queryType = type
/*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
this.dialogQuery.typeId = row.typeId*/
this.getDialogList()
},
/** 查询列表 */
getDialogList() {
this.dialogQuery.queryType = this.queryType
getRecords(this.dialogQuery).then((response) => {
getRecords().then((response) => {
this.dialogList = response.rows
this.dialogTotal = response.total
})

View File

@ -260,10 +260,11 @@
>
<el-upload
ref="excelUpload"
:http-request="(file) => excelUpload(file)"
action="#"
:http-request="(file) => uploadExcel(file)"
accept=".xlsx, .xls"
:limit="1"
:file-list="excelList"
:file-list="fileList"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
@ -284,8 +285,14 @@
align-items: center;
margin-top: 20px
">
<el-button type="primary" style="margin-right: 15px;">确定</el-button>
<el-button>取消</el-button>
<el-button
type="primary"
style="margin-right: 6px;"
@click="confirmUpload"
>确定</el-button>
<el-button
@click="closeExcelDialog"
>取消</el-button>
</div>
</el-dialog>
@ -376,16 +383,34 @@ export default {
},
isEdit: false,
// excel
excelList: []
fileList: [],
excelList: {}
}
},
created() {
this.getList()
},
methods: {
/** 确认上传excel */
confirmUpload() {
console.log(this.fileList)
fileUpLoad(this.excelList).then(res => {
console.log(res)
if (res.code == 200) {
this.$modal.msgSuccess(res.msg)
this.openUpload = false
this.reset()
this.getList()
} else {
this.$modal.msgError(res.msg)
}
}).catch(err => {
console.log(err)
})
},
/** 上传excel文件 */
uploadExcel(file) {
console.log(file)
uploadExcel(obj) {
this.excelList = obj
},
/** 上传excel文件前 */
beforeExcelUpload(file) {
@ -399,6 +424,11 @@ export default {
excelError() {
console.log('上传失败')
},
/** 关闭excel弹窗 */
closeExcelDialog() {
this.excelList = {}
this.openUpload = false
},
/** 查询部门列表 */
getList() {
console.log(this.queryParams)
@ -464,7 +494,7 @@ export default {
handleUploadExcel() {
this.reset()
this.openUpload = true
},
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false