This commit is contained in:
haozq 2024-11-14 19:36:44 +08:00
parent 2e0661fbd4
commit 4979ead905
18 changed files with 317 additions and 29 deletions

View File

@ -144,10 +144,6 @@ public class PartApplyController {
/**
* 出库-接口
* @return

View File

@ -1,21 +1,32 @@
package com.bonus.gzgqj.business.bases.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.bonus.gzgqj.business.app.entity.PartApplyAppVo;
import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo;
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
import com.bonus.gzgqj.business.bases.entity.PartCheckDetailsVo;
import com.bonus.gzgqj.business.bases.entity.PartCheckVo;
import com.bonus.gzgqj.business.bases.entity.UserPatypeInfo;
import com.bonus.gzgqj.business.bases.service.PartCheckService;
import com.bonus.gzgqj.business.plan.entity.PlanApplyBeanPlanExport;
import com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean;
import com.bonus.gzgqj.manager.annotation.DecryptAndVerify;
import com.bonus.gzgqj.manager.core.entity.EncryptedReq;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
/**
@ -54,8 +65,6 @@ public class PartCheckController {
return service.insertCheckData(request,files);
}
/**
* 盘点入库新增接口
* @return
@ -65,6 +74,76 @@ public class PartCheckController {
public ServerResponse getDetailsById(EncryptedReq<PartCheckVo> dto) {
return service.getDetailsById(dto.getData());
}
/**
* 盘点记录分页拆线呢
* @param dto
* @return
*/
@GetMapping("getDetailsByIdList")
@DecryptAndVerify(decryptedClass = PartCheckVo.class)
public PageInfo<PartCheckDetailsVo> getDetailsByIdList(EncryptedReq<PartCheckVo> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
List<PartCheckDetailsVo> list = service.getDetailsByIdList(dto.getData());;
PageInfo<PartCheckDetailsVo> pageInfo = new PageInfo<>(list);
return pageInfo;
}
/**
* 导出需求计划
* @param
* @param
* @param
*/
@PostMapping("export")
public void export(HttpServletRequest request, HttpServletResponse response, @RequestBody PartCheckVo dto) {
try {
List<PartCheckVo> list = service.findByPage(dto);;
final int[] num = {1};
list.forEach(vo->{
vo.setXh(num[0]);
num[0]++;
});
ExportParams exportParams = new ExportParams("盘点记录", "盘点记录", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBeanPlanExport.class, list);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("盘点记录" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
log.error(e.toString(), e);
}
}
/**
* 导出需求计划详情
* @param request
* @param response
* @param
*/
@PostMapping("exportDetail")
public void exportDetail(HttpServletRequest request, HttpServletResponse response,@RequestBody PartCheckVo dto) {
try {
List<PartCheckDetailsVo> list = service.getDetailsByIdList(dto);;
final int[] num = {1};
list.forEach(vo->{
vo.setXh(num[0]);
num[0]++;
});
ExportParams exportParams = new ExportParams("盘点明细", "盘点明细", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanDataDetailBean.class, list);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("盘点明细" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
log.error(e.toString(), e);
}
}
@ -80,7 +159,4 @@ public class PartCheckController {
}

View File

@ -1,21 +1,32 @@
package com.bonus.gzgqj.business.bases.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.bonus.gzgqj.business.bases.entity.PartCheckDetailsVo;
import com.bonus.gzgqj.business.bases.entity.PartCheckVo;
import com.bonus.gzgqj.business.bases.entity.PartScrapDetailsVo;
import com.bonus.gzgqj.business.bases.entity.PartScrapVo;
import com.bonus.gzgqj.business.bases.service.PartCheckService;
import com.bonus.gzgqj.business.bases.service.PartScrapService;
import com.bonus.gzgqj.business.plan.entity.PlanApplyBeanPlanExport;
import com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean;
import com.bonus.gzgqj.manager.annotation.DecryptAndVerify;
import com.bonus.gzgqj.manager.core.entity.EncryptedReq;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import sun.dc.pr.PRError;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
/**
@ -61,7 +72,7 @@ public class PartScrapController {
* 盘点入库新增接口
* @return
*/
@PostMapping("getDetailsById")
@GetMapping("getDetailsById")
@DecryptAndVerify(decryptedClass = PartScrapVo.class)
public ServerResponse getDetailsById(EncryptedReq<PartScrapVo> dto) {
return service.getDetailsById(dto.getData());
@ -69,5 +80,81 @@ public class PartScrapController {
/**
* 盘点记录分页拆线呢
* @param dto
* @return
*/
@GetMapping("getDetailsByIdList")
@DecryptAndVerify(decryptedClass = PartScrapVo.class)
public PageInfo<PartScrapDetailsVo> getDetailsByIdList(EncryptedReq<PartScrapVo> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
List<PartScrapDetailsVo> list = service.getDetailsByIdList(dto.getData());
PageInfo<PartScrapDetailsVo> pageInfo = new PageInfo<>(list);
return pageInfo;
}
/**
* 导出需求计划
* @param
* @param
* @param
*/
@PostMapping("export")
public void export(HttpServletRequest request, HttpServletResponse response, @RequestBody PartScrapVo dto) {
try {
List<PartScrapVo> list = service.findByPage(dto);
final int[] num = {1};
list.forEach(vo->{
vo.setXh(num[0]);
num[0]++;
});
ExportParams exportParams = new ExportParams("报废记录", "报废记录", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBeanPlanExport.class, list);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("报废记录" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
log.error(e.toString(), e);
}
}
/**
* 导出需求计划详情
* @param request
* @param response
* @param
*/
@PostMapping("exportDetail")
public void exportDetail(HttpServletRequest request, HttpServletResponse response,@RequestBody PartScrapVo dto) {
try {
List<PartScrapDetailsVo> list = service.getDetailsByIdList(dto);;
final int[] num = {1};
list.forEach(vo->{
vo.setXh(num[0]);
num[0]++;
});
ExportParams exportParams = new ExportParams("报废明细", "报废明细", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanDataDetailBean.class, list);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("报废明细" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
log.error(e.toString(), e);
}
}
}

View File

@ -91,4 +91,6 @@ public class PartBackVo {
* 文件上传 集合
*/
private List<FileUploadVo> fileList;
private String infoMsg;
}

View File

@ -1,5 +1,6 @@
package com.bonus.gzgqj.business.bases.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
@ -8,6 +9,9 @@ import lombok.Data;
@Data
public class PartCheckDetailsVo {
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
/**
* 主键
@ -25,38 +29,49 @@ public class PartCheckDetailsVo {
/**
* 配件类型
*/
@Excel(name = "配件类型", width = 10.0, orderNum = "1")
private String partType;
/**
* 配件名称
*/
@Excel(name = "配件名称", width = 10.0, orderNum = "2")
private String partName;
/**
* 配件类型
*/
@Excel(name = "规格型号", width = 10.0, orderNum = "3")
private String partModel;
/**
* 配件类型
*/
@Excel(name = "单位", width = 10.0, orderNum = "5")
private String partUnit;
private String remark;
/**
* 盘点数量
*/
@Excel(name = "本次盘点量", width = 10.0, orderNum = "5")
private int checkNum;
/**
* 盘点前-库存数量
*/
@Excel(name = "库存量", width = 10.0, orderNum = "5")
private int num;
/**
* 盘盈
*/
@Excel(name = "盘盈量", width = 10.0, orderNum = "5")
private int addNum;
/**
* 盘亏
*/
@Excel(name = "盘亏量", width = 10.0, orderNum = "5")
private int subNum;
@Excel(name = "单价", width = 10.0, orderNum = "4")
private String price;
}

View File

@ -1,5 +1,6 @@
package com.bonus.gzgqj.business.bases.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
import lombok.Data;
@ -11,6 +12,9 @@ import java.util.List;
*/
@Data
public class PartCheckVo {
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
/**
* 主键
*/
@ -18,10 +22,12 @@ public class PartCheckVo {
/**
* 编码
*/
@Excel(name = "盘点编号", width = 10.0, orderNum = "1")
private String code;
/**
* 盘点人id
*/
@Excel(name = "盘点人", width = 10.0, orderNum = "2")
private String creator;
/**
* 盘点时间
@ -30,15 +36,19 @@ public class PartCheckVo {
/**
* 开始时间
*/
@Excel(name = "盘点起止时间", width = 10.0, orderNum = "3")
private String times;
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 备注
*/
@Excel(name = "备注", width = 10.0, orderNum = "6")
private String remark;
/**
* 修改人
@ -55,10 +65,12 @@ public class PartCheckVo {
/**
* 盘盈
*/
@Excel(name = "盘盈", width = 10.0, orderNum = "4")
private int addNum;
/**
* 盘亏
*/
@Excel(name = "盘亏", width = 10.0, orderNum = "5")
private int subNum;
private String keyWord;

View File

@ -1,5 +1,6 @@
package com.bonus.gzgqj.business.bases.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
@ -9,6 +10,8 @@ import lombok.Data;
@Data
public class PartScrapDetailsVo {
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
/**
* 主键
@ -21,6 +24,7 @@ public class PartScrapDetailsVo {
/**
* 报废数量
*/
@Excel(name = "报废数量", width = 10.0, orderNum = "2")
private int scrapNum;
@ -31,24 +35,35 @@ public class PartScrapDetailsVo {
/**
* 配件类型
*/
@Excel(name = "配件类型", width = 10.0, orderNum = "2")
private String partType;
/**
* 配件名称
*/
@Excel(name = "配件名称", width = 10.0, orderNum = "3")
private String partName;
/**
* 配件类型
*/
@Excel(name = "配件型号", width = 10.0, orderNum = "4")
private String partModel;
/**
* 配件类型
*/
@Excel(name = "单位", width = 10.0, orderNum = "5")
private String partUnit;
@Excel(name = "备注", width = 10.0, orderNum = "10")
private String remark;
@Excel(name = "单价", width = 10.0, orderNum = "8")
private String price;
@Excel(name = "金额", width = 10.0, orderNum = "9")
private String money;
}

View File

@ -1,5 +1,6 @@
package com.bonus.gzgqj.business.bases.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
import lombok.Data;
@ -12,22 +13,29 @@ import java.util.List;
@Data
public class PartScrapVo {
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String id;
private String name;
@Excel(name = "报废人", width = 10.0, orderNum = "2")
private String userName;
/**
* 百纳后
*/
@Excel(name = "编号", width = 10.0, orderNum = "1")
private String code;
/**
* 报废日期
*/
@Excel(name = "报废时间", width = 10.0, orderNum = "5")
private String scrapDay;
/**
* 备注
*/
@Excel(name = "备注", width = 10.0, orderNum = "6")
private String remark;
private String creator;
@ -40,6 +48,7 @@ public class PartScrapVo {
/**
* 报废数量
*/
@Excel(name = "报废数量", width = 10.0, orderNum = "3")
private int bfNum;
private String keyWord;

View File

@ -46,6 +46,8 @@ public class UserPatypeInfo {
*/
private int ghNum;
private String remark;

View File

@ -63,4 +63,11 @@ public interface PartBackMapper {
* @return
*/
List<PartBackDetailsVo> getInfoDetailList(PartBackVo data);
/**
* 查询 数据
* @param data
* @return
*/
List<String> getInfoMsg(PartBackVo data);
}

View File

@ -65,10 +65,11 @@ public class PartBackServiceImpl implements PartBackService {
public ServerResponse getInfoDetails(PartBackVo data) {
try{
PartBackVo vo=mapper.getInfoDetails(data);
List<PartBackDetailsVo> detailList=mapper.getInfoDetailList(data);
List<String> info=mapper.getInfoMsg(data);
List<FileUploadVo> flieList=uploadService.getFileList(data.getId(),"t_part_back",null);
vo.setFileList(flieList);
vo.setDetailsVoList(detailList);
String infoMsg = String.join(",", info);
vo.setInfoMsg(infoMsg);
return ServerResponse.createSuccess(vo);
}catch (Exception e){
log.error(e.toString(),e);

View File

@ -1,5 +1,6 @@
package com.bonus.gzgqj.business.bases.service;
import com.bonus.gzgqj.business.bases.entity.PartCheckDetailsVo;
import com.bonus.gzgqj.business.bases.entity.PartCheckVo;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import org.springframework.web.multipart.MultipartFile;
@ -33,4 +34,6 @@ public interface PartCheckService {
* @return
*/
ServerResponse getDetailsById(PartCheckVo data);
List<PartCheckDetailsVo> getDetailsByIdList(PartCheckVo data);
}

View File

@ -135,8 +135,6 @@ public class PartCheckServiceImpl implements PartCheckService{
public ServerResponse getDetailsById(PartCheckVo data) {
try{
PartCheckVo vo=mapper.getCheckDetails(data);
List<PartCheckDetailsVo> list=mapper.getCheckDetailList(data);
vo.setDetailList(list);
List<FileUploadVo> flieList=uploadService.getFileList(data.getId(),"t_part_inventory",null);
vo.setFileList(flieList);
List<String> infoMsg=mapper.getInfo(data);
@ -155,6 +153,24 @@ public class PartCheckServiceImpl implements PartCheckService{
return ServerResponse.createSuccess(new PartCheckVo());
}
/**
*
* @param data
* @return
*/
@Override
public List<PartCheckDetailsVo> getDetailsByIdList(PartCheckVo data) {
try{
List<PartCheckDetailsVo> list=mapper.getCheckDetailList(data);
return list;
}catch (Exception e){
log.error(e.toString(),e);
}
return new ArrayList<>();
}
public String getCode( ) {
int num =mapper.getNum();
num++;

View File

@ -1,5 +1,6 @@
package com.bonus.gzgqj.business.bases.service;
import com.bonus.gzgqj.business.bases.entity.PartScrapDetailsVo;
import com.bonus.gzgqj.business.bases.entity.PartScrapVo;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import org.springframework.web.multipart.MultipartFile;
@ -33,4 +34,11 @@ public interface PartScrapService {
* @return
*/
ServerResponse getDetailsById(PartScrapVo data);
/**
* 查询
* @param data
* @return
*/
List<PartScrapDetailsVo> getDetailsByIdList(PartScrapVo data);
}

View File

@ -104,8 +104,6 @@ public class PartScrapServiceImpl implements PartScrapService{
public ServerResponse getDetailsById(PartScrapVo data) {
try{
PartScrapVo vo=mapper.getDetailsById(data);
List<PartScrapDetailsVo> list=mapper.getDetailListById(data);
vo.setDetailList(list);
List<FileUploadVo> flieList=uploadService.getFileList(data.getId(),"t_part_scrap",null);
vo.setFileList(flieList);
List<String> infoMsg=mapper.getInfo(data);
@ -121,6 +119,20 @@ public class PartScrapServiceImpl implements PartScrapService{
@Override
public List<PartScrapDetailsVo> getDetailsByIdList(PartScrapVo data) {
try{
List<PartScrapDetailsVo> list=mapper.getDetailListById(data);
return list;
}catch (Exception e){
log.error(e.toString(),e);
}
return new ArrayList<PartScrapDetailsVo>();
}
public String getCode( ) {
int num =mapper.getNum();
num++;

View File

@ -93,7 +93,13 @@
from t_part_back tpb
left join pm_user pu on pu.id=tpb.creator
WHERE tpb.id=#{id}
</select>
<!-- 查询 数据详情-->
<select id="getInfoMsg" resultType="java.lang.String">
select CONCAT(part_name,":",SUM(back_num)) detail
from t_part_back_details
where back_id=#{id}
GROUP BY part_name
</select>
</mapper>

View File

@ -25,7 +25,7 @@
<select id="findByPage" resultType="com.bonus.gzgqj.business.bases.entity.PartCheckVo">
select
id,code,
id,code,concat(start_time,"~",end_time) times,
creator,create_time createTime,
start_time startTime,end_time endTime,
remark,updater,update_time updateTime,
@ -55,11 +55,22 @@
where id=#{id}
</select>
<select id="getCheckDetailList" resultType="com.bonus.gzgqj.business.bases.entity.PartCheckDetailsVo">
select id, inv_id invId, part_id partId,
check_num checkNum, remark, num, part_type partType, part_name partName,
part_model partModel, part_unit partUnit, add_num addNum, sub_num subNum
from t_part_inventory_details
where inv_id=#{id}
select pid.id, pid.inv_id invId, pid.part_id partId,pt.price,
pid.check_num checkNum, pid.remark, pid.num, pid.part_type partType, pid.part_name partName,
pid.part_model partModel, pid.part_unit partUnit, pid.add_num addNum, pid.sub_num subNum
from t_part_inventory_details pid
LEFT JOIN pa_type pt on pt.id=pid.part_id
where pid.inv_id=#{id}
<if test="partType!=null and partType !=''">
and pid.part_type like concat('%',#{partType},'%')
</if>
<if test="partName!=null and partName !=''">
and pid.part_name like concat('%',#{partName},'%')
</if>
<if test="partModel!=null and partModel !=''">
and pid.part_model like concat('%',#{partModel},'%')
</if>
</select>
<!--入库数量-->
<select id="getNum" resultType="java.lang.Integer">

View File

@ -54,11 +54,21 @@
where id=#{id}
</select>
<select id="getDetailListById" resultType="com.bonus.gzgqj.business.bases.entity.PartScrapDetailsVo">
select id, scrap_id scrapId , part_id partId,
scrap_num scrapNum, remark, part_type partType, part_name partName,
part_model partModel, part_unit partUnit
from t_part_scrap_details
where scrap_id=#{id}
select psd.id, psd.scrap_id scrapId ,psd.part_id partId,( pt.price*psd.scrap_num) money,
psd.scrap_num scrapNum, psd.remark, psd.part_type partType, psd.part_name partName,
psd.part_model partModel, psd.part_unit partUnit
from t_part_scrap_details psd
LEFT JOIN pa_type pt on pt.id=psd.part_id
where psd.scrap_id=#{id}
<if test="partType!=null and partType !=''">
and psd.part_type like concat('%',#{partType},'%')
</if>
<if test="partName!=null and partName !=''">
and psd.part_name like concat('%',#{partName},'%')
</if>
<if test="partModel!=null and partModel !=''">
and psd.part_model like concat('%',#{partModel},'%')
</if>
</select>
<select id="getInfo" resultType="java.lang.String">
select CONCAT(part_name,":",SUM(scrap_num)) detail