Compare commits
2 Commits
94f31b5f0d
...
20a36ae42e
| Author | SHA1 | Date |
|---|---|---|
|
|
20a36ae42e | |
|
|
1c2baee1ec |
|
|
@ -10,6 +10,7 @@ import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||||
import com.bonus.sgzb.material.domain.*;
|
import com.bonus.sgzb.material.domain.*;
|
||||||
import com.bonus.sgzb.material.service.SecondaryWarehouseService;
|
import com.bonus.sgzb.material.service.SecondaryWarehouseService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
@ -44,10 +45,18 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
@PostMapping("/exportList")
|
@PostMapping("/exportList")
|
||||||
public void exportList(HttpServletResponse response, @RequestBody SecondaryWarehouse bean)
|
public void exportList(HttpServletResponse response, @RequestBody SecondaryWarehouse bean)
|
||||||
{
|
{
|
||||||
|
if (bean.getLeaseType().equals(0)){
|
||||||
|
SecondaryWarehouseVo bean1 = new SecondaryWarehouseVo();
|
||||||
|
BeanUtils.copyProperties(bean,bean1);
|
||||||
|
List<SecondaryWarehouseVo> list = service.getList1(bean1);
|
||||||
|
ExcelUtil<SecondaryWarehouseVo> util = new ExcelUtil<SecondaryWarehouseVo>(SecondaryWarehouseVo.class);
|
||||||
|
util.exportExcel(response, list, "二级库导出");
|
||||||
|
}else {
|
||||||
List<SecondaryWarehouse> list = service.getList(bean);
|
List<SecondaryWarehouse> list = service.getList(bean);
|
||||||
ExcelUtil<SecondaryWarehouse> util = new ExcelUtil<SecondaryWarehouse>(SecondaryWarehouse.class);
|
ExcelUtil<SecondaryWarehouse> util = new ExcelUtil<SecondaryWarehouse>(SecondaryWarehouse.class);
|
||||||
util.exportExcel(response, list, "二级库导出");
|
util.exportExcel(response, list, "二级库导出");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出库/退库操作
|
* 出库/退库操作
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.sgzb.material.mapper;
|
package com.bonus.sgzb.material.mapper;
|
||||||
|
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
||||||
|
import com.bonus.sgzb.material.domain.SecondaryWarehouseVo;
|
||||||
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
@ -41,4 +42,8 @@ public interface SecondaryWarehouseMapper {
|
||||||
Integer selectStockNum(SecondaryWarehouse secondaryWarehouse);
|
Integer selectStockNum(SecondaryWarehouse secondaryWarehouse);
|
||||||
|
|
||||||
List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean);
|
List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean);
|
||||||
|
|
||||||
|
List<SecondaryWarehouseVo> getList2(SecondaryWarehouseVo bean1);
|
||||||
|
|
||||||
|
Integer selectStockNum1(SecondaryWarehouseVo secondaryWarehouse);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.sgzb.material.service;
|
package com.bonus.sgzb.material.service;
|
||||||
|
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
||||||
|
import com.bonus.sgzb.material.domain.SecondaryWarehouseVo;
|
||||||
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -21,4 +22,6 @@ public interface SecondaryWarehouseService {
|
||||||
// List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean);
|
// List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean);
|
||||||
|
|
||||||
int addNewOperate(TeamLeaseInfo bean);
|
int addNewOperate(TeamLeaseInfo bean);
|
||||||
|
|
||||||
|
List<SecondaryWarehouseVo> getList1(SecondaryWarehouseVo bean1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.material.service.impl;
|
||||||
|
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
||||||
|
import com.bonus.sgzb.material.domain.SecondaryWarehouseVo;
|
||||||
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
||||||
import com.bonus.sgzb.material.mapper.SecondaryWarehouseMapper;
|
import com.bonus.sgzb.material.mapper.SecondaryWarehouseMapper;
|
||||||
import com.bonus.sgzb.material.service.SecondaryWarehouseService;
|
import com.bonus.sgzb.material.service.SecondaryWarehouseService;
|
||||||
|
|
@ -20,6 +21,25 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
@Autowired
|
@Autowired
|
||||||
private SecondaryWarehouseMapper mapper;
|
private SecondaryWarehouseMapper mapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SecondaryWarehouseVo> getList1(SecondaryWarehouseVo bean1) {
|
||||||
|
List<SecondaryWarehouseVo> list = new ArrayList<>();
|
||||||
|
if (bean1.getLeaseType().equals(1)){
|
||||||
|
list = mapper.getList2(bean1);
|
||||||
|
for (SecondaryWarehouseVo secondaryWarehouse : list) {
|
||||||
|
Integer warehouse = mapper.selectStockNum1(secondaryWarehouse);
|
||||||
|
if (warehouse == null) {
|
||||||
|
warehouse = 0;
|
||||||
|
}
|
||||||
|
secondaryWarehouse.setReceiveNum(warehouse);
|
||||||
|
secondaryWarehouse.setStockNum(secondaryWarehouse.getNum() - secondaryWarehouse.getReceiveNum());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
list = mapper.getList2(bean1);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public List<SecondaryWarehouse> getList(SecondaryWarehouse bean) {
|
public List<SecondaryWarehouse> getList(SecondaryWarehouse bean) {
|
||||||
List<SecondaryWarehouse> list = new ArrayList<>();
|
List<SecondaryWarehouse> list = new ArrayList<>();
|
||||||
|
|
@ -65,6 +85,8 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
return mapper.addNewOperate(bean);
|
return mapper.addNewOperate(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean) {
|
// public List<TeamLeaseInfo> getNewRecords(TeamLeaseInfo bean) {
|
||||||
// List<TeamLeaseInfo> list = new ArrayList<>();
|
// List<TeamLeaseInfo> list = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getList2" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouseVo">
|
||||||
|
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,
|
||||||
|
mt1.type_name AS typeName,
|
||||||
|
mt.type_name AS modelName,
|
||||||
|
mt.unit_name AS nuitName,
|
||||||
|
lod.type_id AS typeId,
|
||||||
|
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
|
||||||
|
LEFT JOIN bm_agreement_info bai ON tta.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 lod.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.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>
|
||||||
|
<if test="modelId != null and modelId != ''">
|
||||||
|
and mt.type_id = #{modelId}
|
||||||
|
</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
|
||||||
|
tta.agreement_id,
|
||||||
|
lod.type_id
|
||||||
|
</select>
|
||||||
<select id="getRecordsOne" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
<select id="getRecordsOne" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
||||||
SELECT
|
SELECT
|
||||||
mt1.type_name AS typeName,
|
mt1.type_name AS typeName,
|
||||||
|
|
@ -260,6 +305,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and mt.type_id = #{modelId}
|
and mt.type_id = #{modelId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectStockNum1" 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>
|
||||||
|
|
||||||
|
|
||||||
<insert id="addNewOperate">
|
<insert id="addNewOperate">
|
||||||
insert into receive_detail (parent_id,type_id,out_num,out_time,type,out_name,pick_name)
|
insert into receive_detail (parent_id,type_id,out_num,out_time,type,out_name,pick_name)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue