增加 出库出库单、出库备注、结算备注

This commit is contained in:
liang.chao 2024-11-07 16:55:40 +08:00
parent 27882f8aa5
commit 889168e79d
11 changed files with 282 additions and 134 deletions

View File

@ -210,6 +210,7 @@ public class SltAgreementInfo {
* 委外维修费用
*/
private String outSourceCosts;
private String remark;
private String beginTime;
private String offTime;
private String partModelName;

View File

@ -13,6 +13,7 @@ import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.common.security.annotation.PreventRepeatSubmit;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -112,6 +113,7 @@ public class LeaseOutDetailsController extends BaseController {
public TableDataInfo getMaMachineByRfidCode(@RequestParam(value = "rfidCode") String rfidCode) {
return getDataTable(leaseOutDetailsService.getMaMachineByRfidCode(rfidCode));
}
/**
* 编码出库列表(web)
*
@ -146,13 +148,26 @@ public class LeaseOutDetailsController extends BaseController {
@PreventRepeatSubmit
@PostMapping("/submitOutRfid")
public AjaxResult submitOutRfid(@RequestBody List<LeaseOutDetails> recordList) {
if (CollUtil.isEmpty(recordList)){
if (CollUtil.isEmpty(recordList)) {
return AjaxResult.error("请选择要出库的机具");
}else {
} else {
return leaseOutDetailsService.submitOutRfid(recordList);
}
}
/**
* @param parentId
* @return
*/
@Log(title = "领料出库(出库单)")
@GetMapping("/getLeaseOutOrder")
public AjaxResult getLeaseOutOrder(String parentId, String typeId) {
if (StringUtils.isBlank(parentId) || StringUtils.isBlank(typeId)) {
return AjaxResult.error("参数错误");
} else {
return AjaxResult.success(leaseOutDetailsService.getLeaseOutOrder(parentId, typeId));
}
}
/**
* 综合查询--领用记录查询

View File

@ -26,5 +26,17 @@ public class LeaseOutDetailRecord {
@Excel(name = "出库人")
private String userName;
//工程名
private String lotName;
//单位名
private String unitName;
//领料单号
private String code;
//备注
private String remark;
// 出库时间
private String updateTime;
// 出库方式
private String manageTypeName;
}

View File

@ -161,6 +161,7 @@ public class TmTask implements Serializable {
*/
@ApiModelProperty(value = "领料任务详情集合")
private List<LeaseApplyDetails> leaseApplyDetails;
private List<LeaseOutDetailRecord> leaseOutDetailRecord;
@ApiModelProperty(value = "协议id")
private Integer agreementId;

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
import com.bonus.sgzb.app.domain.LeaseOutDetailRecord;
import com.bonus.sgzb.app.domain.TmTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -49,4 +50,8 @@ public interface LeaseApplyDetailsMapper {
List<LeaseApplyDetails> getByParentId(Integer parentId);
List<TmTask> getDetailsByApplyId(TmTask typeId);
TmTask getOrderHead(String parentId);
List<LeaseOutDetailRecord> getOrderBody(@Param("parentId") String parentId,@Param("typeId") String typeId);
}

View File

@ -77,4 +77,6 @@ public interface LeaseOutDetailsService {
AjaxResult submitOutRfid(List<LeaseOutDetails> recordList);
List<TmTask> getDetailsByApplyId(TmTask id);
TmTask getLeaseOutOrder(String parentId,String typeId);
}

View File

@ -3,6 +3,7 @@ package com.bonus.sgzb.app.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson2.JSONObject;
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
import com.bonus.sgzb.app.domain.LeaseOutDetailRecord;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper;
import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper;
@ -141,6 +142,14 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
return leaseApplyDetailsMapper.getDetailsByApplyId(typeId);
}
@Override
public TmTask getLeaseOutOrder(String parentId,String typeId) {
TmTask orderHead = leaseApplyDetailsMapper.getOrderHead(parentId);
List<LeaseOutDetailRecord> list = leaseApplyDetailsMapper.getOrderBody(parentId,typeId);
orderHead.setLeaseOutDetailRecord(list);
return orderHead;
}
/**
* 领料出库处理
*

View File

@ -206,6 +206,11 @@ public class StorageStatus {
*/
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
/**
* 设备所属类型
*/
@ApiModelProperty(value = "待出库数量")
private Integer preOutNum;
/**

View File

@ -60,6 +60,50 @@
AND mm.ma_code like concat('%', #{maCode}, '%')
</if>
</select>
<select id="getOrderHead" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
bpl.lot_name proName,
bui.unit_name,
tt.`code`,
tt.update_time
FROM
lease_apply_info lai
LEFT JOIN tm_task tt ON tt.task_id = lai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = lai.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
WHERE
lai.id = #{parentId}
</select>
<select id="getOrderBody" resultType="com.bonus.sgzb.app.domain.LeaseOutDetailRecord">
SELECT
bpl.lot_name,
bui.unit_name,
lod.create_time,
tt.`code`,
tt.update_time,
mt.type_name typeModelName,
mt.unit_name,
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
mt2.type_name typeName,
lod.out_num,
lod.remark,
mm.ma_code maCode
FROM
lease_out_details lod
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
LEFT JOIN tm_task tt on tt.task_id = lai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = lai.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_lot bpl ON bpl.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 mt2 on mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm on lod.ma_id = mm.ma_id
WHERE
lod.parent_id = #{parentId} and lod.type_id = #{typeId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from lease_apply_details

View File

@ -333,6 +333,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.unit_name as nuitName,
sai.lease_price as leasePrice,
sai.num as num,
lai.remark,
sai.is_slt as isSlt,
sai.trim_day as trimDay,
DATE(sai.start_time) as startTime,
@ -361,6 +362,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.trim_day as trimDay,
sai.lease_price as leasePrice,
sai.num as num,
lai.remark,
sai.is_slt as isSlt,
DATE(sai.start_time) as startTime,
DATE(sai.end_time) as endTime,

View File

@ -5,139 +5,191 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.sgzb.material.mapper.StorageStatusMapper">
<select id="getStorageStatusList" resultType="com.bonus.sgzb.material.domain.StorageStatus">
SELECT mt2.type_name as typeName,
mt.type_name as typeModelName,
mt.unit_name as unit,
CASE mt.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(mt.num, 0)
END as num,
IFNULL(subquery1.usNum, 0) as usNum,
IFNULL(subquery2.repairNum, 0) as repairNum,
IFNULL(subquery3.repairInputNum, 0) as repairInputNum,
IFNULL(subquery4.inputNum, 0) as inputNum,
IFNULL( subquery5.scrapNum, 0 ) AS scrapNum,
IFNULL( subquery6.scrapNum, 0 ) AS preScrapNum,
CASE mt.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
ELSE
IFNULL(mt.num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
END as allNum,
CASE mt.manage_type
WHEN 0 THEN
'否'
ELSE
'是'
END manageType
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.unit_name AS unit,
CASE
mt.manage_type
WHEN 0 THEN
IFNULL( subquery0.num, 0 ) ELSE IFNULL( mt.num, 0 )
END AS num,
IFNULL( subquery1.usNum, 0 ) AS usNum,
IFNULL( subquery2.repairNum, 0 ) AS repairNum,
IFNULL( subquery3.repairInputNum, 0 ) AS repairInputNum,
IFNULL( subquery4.inputNum, 0 ) AS inputNum,
IFNULL( subquery5.scrapNum, 0 ) AS scrapNum,
IFNULL( subquery6.scrapNum, 0 ) AS preScrapNum,
IFNULL( subquery7.preOutNum, 0 ) AS preOutNum,
CASE
mt.manage_type
WHEN 0 THEN
IFNULL( subquery0.num, 0 )+ IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 ) ELSE IFNULL( mt.num, 0 )+ IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 )
END AS allNum,
CASE
mt.manage_type
WHEN 0 THEN
'否' ELSE '是'
END manageType
FROM
ma_type mt
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count( mm.ma_id ) num
FROM
ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
mm.ma_code IS NOT NULL
AND mm.ma_status IN ( 15 )
GROUP BY
mt.type_id
) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN (
SELECT
subquery1.type_id,
subquery1.typeName,
subquery1.typeModelName,
IFNULL( subquery1.outNum, 0 ) AS outNum,
IFNULL( subquery2.backNum, 0 ) AS backNum,
CASE
FROM ma_type mt
LEFT JOIN (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (15)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN (SELECT subquery1.type_id,
subquery1.typeName,
subquery1.typeModelName,
IFNULL(subquery1.outNum, 0) AS outNum,
IFNULL(subquery2.backNum, 0) AS backNum,
CASE
WHEN IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) > 0 THEN
IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0)
ELSE 0
END AS usNum
FROM (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(IFNULL(lod.out_num, 0)) AS outNum
FROM lease_out_details lod
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
GROUP BY mt.type_id) AS subquery1
LEFT JOIN (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(IFNULL(bcd.back_num, 0)) backNum
FROM back_check_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
GROUP BY mt.type_id) AS subquery2
ON subquery1.type_id = subquery2.type_id) AS subquery1
ON mt.type_id = subquery1.type_id
LEFT JOIN (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) -
IFNULL(rad.scrap_num, 0)) AS repairNum
FROM repair_apply_details rad
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) - IFNULL(rad.scrap_num, 0) > 0
GROUP BY mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
LEFT JOIN (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0)) AS repairInputNum
FROM repair_input_details rid
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) > 0
GROUP BY mt.type_id) AS subquery3 ON subquery3.type_id = mt.type_id
LEFT JOIN (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL(pcd.check_num, 0) - IFNULL(pcd.input_num, 0)) AS inputNum
FROM purchase_check_details pcd
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE IFNULL(pcd.check_num, 0) - IFNULL(pcd.input_num, 0) > 0
GROUP BY mt.type_id) AS subquery4 ON subquery4.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
sum(IFNULL(sad.scrap_num,0)) AS scrapNum
FROM
scrap_apply_details sad
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
sad.status = 1
GROUP BY
mt.type_id
) AS subquery5 ON subquery5.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
sum(IFNULL(sad.scrap_num,0)) AS scrapNum
FROM
scrap_apply_details sad
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
sad.status = 0
GROUP BY
mt.type_id
) AS subquery6 ON subquery6.type_id = mt.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
WHERE mt.`level` = 4
and mt.del_flag = '0'
WHEN IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) > 0 THEN
IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) ELSE 0
END AS usNum
FROM
(
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( lod.out_num, 0 )) AS outNum
FROM
lease_out_details lod
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
GROUP BY
mt.type_id
) AS subquery1
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( bcd.back_num, 0 )) backNum
FROM
back_check_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
GROUP BY
mt.type_id
) AS subquery2 ON subquery1.type_id = subquery2.type_id
) AS subquery1 ON mt.type_id = subquery1.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 )) AS repairNum
FROM
repair_apply_details rad
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) > 0
GROUP BY
mt.type_id
) AS subquery2 ON subquery2.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 )) AS repairInputNum
FROM
repair_input_details rid
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 ) > 0
GROUP BY
mt.type_id
) AS subquery3 ON subquery3.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 )) AS inputNum
FROM
purchase_check_details pcd
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) > 0
GROUP BY
mt.type_id
) AS subquery4 ON subquery4.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
sum(
IFNULL( sad.scrap_num, 0 )) AS scrapNum
FROM
scrap_apply_details sad
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
sad.STATUS = 1
GROUP BY
mt.type_id
) AS subquery5 ON subquery5.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
sum(
IFNULL( sad.scrap_num, 0 )) AS scrapNum
FROM
scrap_apply_details sad
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
sad.STATUS = 0
GROUP BY
mt.type_id
) AS subquery6 ON subquery6.type_id = mt.type_id
LEFT JOIN (
SELECT
sum(
IFNULL( lad.pre_num, 0 ) - IFNULL( lad.al_num, 0 )) AS preOutNum,
lad.type_id
FROM
lease_apply_details lad
LEFT JOIN lease_apply_info lai ON lad.parennt_id = lai.id
LEFT JOIN tm_task tt ON tt.task_id = lai.task_id
WHERE
tt.task_status IN ( 30, 31, 32, 33, 34, 117 )
GROUP BY
lad.type_id
) AS subquery7 ON subquery7.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
mt.`level` = 4
AND mt.del_flag = '0'
<if test="typeName != null and typeName != ''">
and mt2.type_name like concat('%',#{typeName},'%')
</if>