安全工器具台账及修改
This commit is contained in:
parent
a4593182d3
commit
c1b2458d2e
|
|
@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.bonus.aqgqj.business.backstage.entity.ProjectMaterialLedger;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.InventoryCountVo;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.ProjectMaterialLedgers;
|
||||
import com.bonus.aqgqj.business.backstage.service.inventory.InventoryCountService;
|
||||
import com.bonus.aqgqj.manager.annotation.DecryptAndVerify;
|
||||
import com.bonus.aqgqj.manager.core.entity.EncryptedReq;
|
||||
|
|
@ -56,10 +57,12 @@ public class InventoryCountController {
|
|||
* @return PageInfo<ProjectMaterialLedger>
|
||||
*/
|
||||
@GetMapping("getSafetyToolsLedger")
|
||||
@DecryptAndVerify(decryptedClass = ProjectMaterialLedger.class)
|
||||
public PageInfo<ProjectMaterialLedger> getSafetyToolsLedger(EncryptedReq<ProjectMaterialLedger> dto) {
|
||||
List<ProjectMaterialLedger> projectMaterialLedgers = service.getSafetyToolsLedger(dto.getData());
|
||||
return new PageInfo<>(projectMaterialLedgers);
|
||||
@DecryptAndVerify(decryptedClass = ProjectMaterialLedgers.class)
|
||||
public PageInfo<ProjectMaterialLedgers> getSafetyToolsLedger(EncryptedReq<ProjectMaterialLedgers> dto) {
|
||||
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
|
||||
List<ProjectMaterialLedgers> projectMaterialLedgers = service.getSafetyToolsLedger(dto.getData());
|
||||
PageInfo<ProjectMaterialLedgers> pageInfo = new PageInfo<>(projectMaterialLedgers);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -147,4 +150,31 @@ public class InventoryCountController {
|
|||
log.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 台账导出
|
||||
*/
|
||||
@GetMapping("exportLedgerList")
|
||||
@DecryptAndVerify(decryptedClass = ProjectMaterialLedgers.class)
|
||||
public void exportLedgerList(HttpServletResponse response, EncryptedReq<ProjectMaterialLedgers> dto) {
|
||||
try {
|
||||
List<ProjectMaterialLedgers> list = service.getSafetyToolsLedger(dto.getData());
|
||||
final int[] num = {1};
|
||||
list.forEach(vo -> {
|
||||
vo.setId(num[0]);
|
||||
num[0]++;
|
||||
});
|
||||
ExportParams exportParams = new ExportParams("安全用品发放台账", "安全用品发放台账", ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ProjectMaterialLedgers.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,9 @@ public class ProjectMaterialLedger {
|
|||
* 库存数量
|
||||
*/
|
||||
private String storageNum;
|
||||
|
||||
/**
|
||||
* 计划数量
|
||||
*/
|
||||
private String applyNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,152 @@
|
|||
package com.bonus.aqgqj.business.backstage.entity.inventory;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProjectMaterialLedgers {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Integer proId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称", width = 70)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 领用单位
|
||||
*/
|
||||
private String leaseUnit;
|
||||
|
||||
/**
|
||||
* 物资类型、名称、规格型号
|
||||
*/
|
||||
private String type;
|
||||
|
||||
@Excel(name = "物资名称", width = 18)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "规格型号", width = 18)
|
||||
private String model;
|
||||
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 计划编号
|
||||
*/
|
||||
@Excel(name = "计划编号", width = 18)
|
||||
private String planApplyCode;
|
||||
|
||||
/**
|
||||
* 需用数量
|
||||
*/
|
||||
@Excel(name = "总需用量", width = 18)
|
||||
private Double needNum = 0.00;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@Excel(name = "单价", width = 18)
|
||||
private String price;
|
||||
|
||||
@Excel(name = "总价", width = 18)
|
||||
private String totalPrice;
|
||||
|
||||
/**
|
||||
* 发货时间及数量
|
||||
*/
|
||||
@Excel(name = "发货时间", width = 18)
|
||||
private String outInfo;
|
||||
|
||||
@Excel(name = "发货地址", width = 18)
|
||||
private String outAddress;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
@Excel(name = "供应商", width = 18)
|
||||
private String supName;
|
||||
|
||||
/**
|
||||
* 退还数量
|
||||
*/
|
||||
@Excel(name = "退还数量", width = 18)
|
||||
private String backNum;
|
||||
|
||||
/**
|
||||
* 退库时间
|
||||
*/
|
||||
@Excel(name = "退还时间", width = 18)
|
||||
private String backTime;
|
||||
|
||||
@Excel(name = "差缺", width = 18)
|
||||
private String shortage;
|
||||
|
||||
@Excel(name = "差缺总价", width = 18)
|
||||
private String shortageTotalPrice;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注", width = 18)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 物资规格型号id
|
||||
*/
|
||||
private Integer modelId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 采购量--出库
|
||||
*/
|
||||
private Double totalCg = 0.00;
|
||||
|
||||
/**
|
||||
* 利库量--出库
|
||||
*/
|
||||
private Double totalLk = 0.00;
|
||||
|
||||
/**
|
||||
* 出库量--出库
|
||||
*/
|
||||
private Double totalCk = 0.00;
|
||||
|
||||
/**
|
||||
* 退货量--退库
|
||||
*/
|
||||
private Double totalBack = 0.00;
|
||||
|
||||
/**
|
||||
* 差缺量
|
||||
*/
|
||||
private Double totalDiff = 0.00;
|
||||
|
||||
/**
|
||||
* 差缺状态 1-缺货 2-不缺货
|
||||
*/
|
||||
private Integer isShortage;
|
||||
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private String storageNum;
|
||||
|
||||
/**
|
||||
* 计划数量
|
||||
*/
|
||||
private String applyNum;
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.aqgqj.business.backstage.mapper.inventory;
|
|||
|
||||
import com.bonus.aqgqj.business.backstage.entity.ProjectMaterialLedger;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.InventoryCountVo;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.ProjectMaterialLedgers;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -46,7 +47,7 @@ public interface InventoryCountMapper {
|
|||
/**
|
||||
* 安全工具台账
|
||||
* @param data
|
||||
* @return List<ProjectMaterialLedger>
|
||||
* @return List<ProjectMaterialLedgers>
|
||||
*/
|
||||
List<ProjectMaterialLedger> getSafetyToolsLedger(ProjectMaterialLedger data);
|
||||
List<ProjectMaterialLedgers> getSafetyToolsLedger(ProjectMaterialLedgers data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -689,6 +689,11 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
List<OutPlanVoSupInfo> supInfoList = details.getSupList();
|
||||
//出入库
|
||||
for (OutPlanVoSupInfo outSup : supInfoList) {
|
||||
if (outSup.getCgNum() <= 0) {
|
||||
outSup.setContractId("10086");
|
||||
outSup.setSupId("10086");
|
||||
outSup.setSupName("库存发出");
|
||||
}
|
||||
// 是空的就需要新增
|
||||
if (StringHelper.isEmpty(outSup.getId()) || "undefined".equals(outSup.getId())) {
|
||||
List<OutPlanVoSupInfo> addList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.aqgqj.business.backstage.service.inventory;
|
|||
import com.bonus.aqgqj.business.backstage.entity.ProjectMaterialLedger;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.InventoryApplyVo;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.InventoryCountVo;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.ProjectMaterialLedgers;
|
||||
import com.bonus.aqgqj.manager.webResult.ServerResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -44,5 +45,5 @@ public interface InventoryCountService {
|
|||
* @param data
|
||||
* @return List<ProjectMaterialLedger>
|
||||
*/
|
||||
List<ProjectMaterialLedger> getSafetyToolsLedger(ProjectMaterialLedger data);
|
||||
List<ProjectMaterialLedgers> getSafetyToolsLedger(ProjectMaterialLedgers data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.aqgqj.business.backstage.service.inventory;
|
|||
|
||||
import com.bonus.aqgqj.business.backstage.entity.ProjectMaterialLedger;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.InventoryCountVo;
|
||||
import com.bonus.aqgqj.business.backstage.entity.inventory.ProjectMaterialLedgers;
|
||||
import com.bonus.aqgqj.business.backstage.mapper.inventory.InventoryCountMapper;
|
||||
import com.bonus.aqgqj.manager.webResult.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -86,7 +87,7 @@ public class InventoryCountServiceImpl implements InventoryCountService{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectMaterialLedger> getSafetyToolsLedger(ProjectMaterialLedger data) {
|
||||
public List<ProjectMaterialLedgers> getSafetyToolsLedger(ProjectMaterialLedgers data) {
|
||||
try {
|
||||
return mapper.getSafetyToolsLedger(data);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -107,46 +107,104 @@
|
|||
SELECT IFNULL(COUNT(*),0) AS num FROM st_ma_type where `level`= '3' AND is_active= '0' AND storage_num = 0
|
||||
</select>
|
||||
<select id="getSafetyToolsLedger"
|
||||
resultType="com.bonus.aqgqj.business.backstage.entity.ProjectMaterialLedger">
|
||||
SELECT
|
||||
smt.id as modelId,
|
||||
smt3.`name` as type,
|
||||
smt2.`name` as `name`,
|
||||
smt.`name` as model,
|
||||
IFNULL(smt.storage_num,0) as storageNum,
|
||||
spod.cg_num+spod.lk_num as totalCk,
|
||||
sbd.back_num as totalBack
|
||||
FROM
|
||||
st_ma_type smt
|
||||
LEFT JOIN st_ma_type smt2 on smt2.id=smt.parent_id
|
||||
LEFT JOIN st_ma_type smt3 on smt3.id=smt2.parent_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
spod.model_id,
|
||||
SUM(IFNULL(spod.cg_num,0)) as cg_num,
|
||||
SUM(IFNULL(spod.lk_num,0)) as lk_num
|
||||
FROM
|
||||
st_plan_out_details spod
|
||||
GROUP BY model_id
|
||||
) spod on spod.model_id=smt.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
sbd.model_id,
|
||||
SUM(IFNULL(sbd.num,0)) as back_num
|
||||
FROM
|
||||
st_back_apply sba
|
||||
LEFT JOIN st_back_details sbd on sbd.apply_id=sba.id
|
||||
WHERE
|
||||
sba.`status`='1'
|
||||
GROUP BY sbd.model_id
|
||||
) sbd on sbd.model_id=smt.id
|
||||
WHERE
|
||||
smt.`level`='3'
|
||||
resultType="com.bonus.aqgqj.business.backstage.entity.inventory.ProjectMaterialLedgers">
|
||||
select a.*,
|
||||
a.price * a.needNum AS totalPrice,
|
||||
a.price * a.needNum - a.backNum AS shortage,
|
||||
(a.price * a.needNum - a.backNum) * a.price AS shortageTotalPrice
|
||||
from (SELECT bp.ID AS proId,
|
||||
smt.id as modelId,
|
||||
bp.`name` AS proName,
|
||||
smt2.`name` as `name`,
|
||||
smt.`name` as model,
|
||||
smt.unit_name as unit,
|
||||
IFNULL(sct.price, 0) as price,
|
||||
SUM(IFNULL(spod.need_num, 0)) as needNum,
|
||||
COUNT(DISTINCT spo.apply_id) as applyNum,
|
||||
GROUP_CONCAT(spa.`code` SEPARATOR '、 ') AS planApplyCode,
|
||||
GROUP_CONCAT(
|
||||
CONCAT(
|
||||
DATE_FORMAT(a1.out_time, '%Y-%m-%d'),
|
||||
'(发',
|
||||
a1.outNum,
|
||||
')'
|
||||
) ORDER BY a1.out_time
|
||||
SEPARATOR ','
|
||||
) AS outInfo,
|
||||
GROUP_CONCAT(DISTINCT spo.remark) outAddress,
|
||||
GROUP_CONCAT(DISTINCT spot.sup_name) supName,
|
||||
IFNULL(a2.backNum, 0) as backNum,
|
||||
bt.backTime,
|
||||
'' as remark
|
||||
|
||||
FROM bm_project bp
|
||||
LEFT JOIN st_plan_out spo on spo.pro_id = bp.ID
|
||||
LEFT JOIN st_plan_out_details spod on spod.out_id = spo.id
|
||||
LEFT JOIN st_plan_apply spa on spa.id = spo.apply_id
|
||||
LEFT JOIN st_ma_type smt on smt.id = spod.model_id
|
||||
LEFT JOIN st_ma_type smt2 on smt2.id = smt.parent_id
|
||||
LEFT JOIN st_plan_out_sup spos on spos.details_id = spod.ID
|
||||
LEFT JOIN st_contract_type sct
|
||||
on sct.contract_id = spos.contract_id and sct.supplier_id = spos.sup_id and
|
||||
sct.model_id = spos.model_id
|
||||
LEFT JOIN (SELECT spo.id AS out_id,
|
||||
spod.model_id,
|
||||
spo.out_time,
|
||||
SUM(spod.cg_num + spod.lk_num) AS outNum
|
||||
FROM st_plan_out spo
|
||||
JOIN st_plan_out_details spod ON spod.out_id = spo.id
|
||||
GROUP BY spo.id, spod.model_id, spo.out_time) a1 ON a1.out_id = spo.id
|
||||
AND a1.model_id = spod.model_id
|
||||
LEFT JOIN st_plan_out_sup spot on spot.details_id = spod.id and spot.model_id = spod.model_id
|
||||
|
||||
LEFT JOIN (SELECT sbd.model_id,
|
||||
sba.project_id,
|
||||
SUM(sbd.num) as backNum
|
||||
FROM st_back_details sbd
|
||||
LEFT JOIN st_back_apply sba on sba.ID = sbd.apply_id
|
||||
WHERE sba.`status` = '1'
|
||||
GROUP BY sbd.model_id, sba.project_id) a2
|
||||
on a2.project_id = bp.ID and a2.model_id = spod.model_id
|
||||
LEFT JOIN (SELECT t.project_id,
|
||||
t.model_id,
|
||||
GROUP_CONCAT(
|
||||
CONCAT(
|
||||
t.back_date,
|
||||
'(退',
|
||||
t.num,
|
||||
')'
|
||||
) ORDER BY t.back_date
|
||||
SEPARATOR ','
|
||||
) AS backTime
|
||||
FROM (SELECT sba.project_id,
|
||||
sbd.model_id, LEFT (sba.back_time, 10) AS back_date, SUM(sbd.num) AS num
|
||||
FROM st_back_apply sba
|
||||
JOIN st_back_details sbd
|
||||
ON sbd.apply_id = sba.id
|
||||
WHERE sba.status = '1'
|
||||
GROUP BY
|
||||
sba.project_id,
|
||||
sbd.model_id,
|
||||
LEFT (sba.back_time, 10)) t
|
||||
GROUP BY t.project_id, t.model_id) bt ON bt.project_id = bp.ID
|
||||
AND bt.model_id = spod.model_id
|
||||
|
||||
WHERE bp.is_active = '1'
|
||||
GROUP BY bp.ID, spod.model_id
|
||||
ORDER BY applyNum DESC) a
|
||||
where 1=1
|
||||
<if test="proId != null">
|
||||
and a.proId = #{proId}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND(
|
||||
smt3.`name` LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
smt2.`name` LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
smt.`name` LIKE CONCAT('%',#{keyWord},'%')
|
||||
a.proName LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
a.name LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
a.model LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
a.planApplyCode LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
a.outAddress LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
a.supName LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
a.remark LIKE CONCAT('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@
|
|||
</select>
|
||||
<select id="getPurchaseSupDetailsList"
|
||||
resultType="com.bonus.aqgqj.business.backstage.entity.OutPlanVoSupInfo">
|
||||
select pos.cg_num*sct.price money,sct.price,pos.sup_name supName,pos.cc_day ccDay,pos.jy_day jyDay,pos.remark ,
|
||||
select pos.cg_num*sct.price money,sct.price,pos.sup_name supName,pos.cc_day ccDay,pos.jy_day jyDay,pos.remark ,pos.contract_id as contractId,
|
||||
pos.cg_num cgNum,pos.lk_num lkNum,pos.lk_num historyLkNum ,pos.id,pos.sup_id supId
|
||||
from st_plan_out_sup pos
|
||||
left join st_contract_type sct on pos.sup_id=sct.supplier_id and
|
||||
|
|
|
|||
Loading…
Reference in New Issue