退料审核代码提交
This commit is contained in:
parent
5490fd2e8f
commit
82e8a6db4a
|
|
@ -278,7 +278,7 @@ public class BackReceiveController extends BaseController {
|
||||||
@PostMapping("backReceiveRecordWeb")
|
@PostMapping("backReceiveRecordWeb")
|
||||||
public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) {
|
public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) {
|
||||||
try {
|
try {
|
||||||
List<BackApplyInfo> list = backReceiveService.backReceiveRecord(record);
|
List<BackApplyInfo> list = backReceiveService.backReceiveRecordWeb(record);
|
||||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
||||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ public class BackApplyInfo {
|
||||||
*/
|
*/
|
||||||
private String userName;
|
private String userName;
|
||||||
private String badId;
|
private String badId;
|
||||||
|
private String[] typeIds;
|
||||||
|
|
||||||
@Excel(name = "退料状态",sort = 9)
|
@Excel(name = "退料状态",sort = 9)
|
||||||
private String taskName;
|
private String taskName;
|
||||||
|
|
|
||||||
|
|
@ -198,4 +198,6 @@ public interface BackReceiveMapper {
|
||||||
int selectNumByTypeId(@Param("parentId")Integer parentId,@Param("typeId") String typeId);
|
int selectNumByTypeId(@Param("parentId")Integer parentId,@Param("typeId") String typeId);
|
||||||
|
|
||||||
int selectTaskStatus(int taskId);
|
int selectTaskStatus(int taskId);
|
||||||
|
|
||||||
|
BackApplyInfo backReceiveRecordWeb(BackApplyInfo record);
|
||||||
}
|
}
|
||||||
|
|
@ -99,4 +99,6 @@ public interface LeaseOutDetailsMapper {
|
||||||
MachinePart getMachineParts(TmTask typeId);
|
MachinePart getMachineParts(TmTask typeId);
|
||||||
|
|
||||||
int updateMaTypeStockNumCt(TmTask record);
|
int updateMaTypeStockNumCt(TmTask record);
|
||||||
|
|
||||||
|
int getmaChineByCt(LeaseOutDetails record);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,4 +95,6 @@ public interface BackReceiveService {
|
||||||
List<TmTask> getRecord(TmTask task);
|
List<TmTask> getRecord(TmTask task);
|
||||||
|
|
||||||
int revoke(BackApplyInfo record);
|
int revoke(BackApplyInfo record);
|
||||||
|
|
||||||
|
List<BackApplyInfo> backReceiveRecordWeb(BackApplyInfo record);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,10 +83,6 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("插入back_check_details异常");
|
throw new RuntimeException("插入back_check_details异常");
|
||||||
}
|
}
|
||||||
/* int insSltInfoNum = insSltInfo(lTask.getAgreementId().toString(), leaseOutDetail);
|
|
||||||
if (insSltInfoNum < 1) {
|
|
||||||
return res;
|
|
||||||
}*/
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e.getMessage());
|
throw new RuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -325,6 +321,21 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BackApplyInfo> backReceiveRecordWeb(BackApplyInfo record) {
|
||||||
|
String typeId = record.getTypeId();
|
||||||
|
String[] split = typeId.split(",");
|
||||||
|
List<BackApplyInfo> backApplyInfoList = new ArrayList<>();
|
||||||
|
for (String s : split) {
|
||||||
|
record.setTypeId(s);
|
||||||
|
BackApplyInfo backApplyInfo = backReceiveMapper.backReceiveRecordWeb(record);
|
||||||
|
if (backApplyInfo != null) {
|
||||||
|
backApplyInfoList.add(backApplyInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return backApplyInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
private int insertRad(int taskId, List<BackApplyInfo> wxList) {
|
private int insertRad(int taskId, List<BackApplyInfo> wxList) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (wxList != null) {
|
if (wxList != null) {
|
||||||
|
|
@ -452,8 +463,17 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
||||||
//机具状态变为在用
|
//机具状态变为在用
|
||||||
backReceiveMapper.updateMaStatus(s, "16");
|
backReceiveMapper.updateMaStatus(s, "16");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
res = backReceiveMapper.deleteCheckDetails(record);
|
res = backReceiveMapper.deleteCheckDetails(record);
|
||||||
|
} else if ("2".equals(manageType)) {
|
||||||
|
String[] split = record.getTypeIds();
|
||||||
|
for (String s : split) {
|
||||||
|
record.setTypeId(s);
|
||||||
|
res = backReceiveMapper.deleteCheckDetails(record);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res = backReceiveMapper.deleteCheckDetails(record);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
||||||
if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) {
|
if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) {
|
||||||
record.setOutNum(record.getInputNum().doubleValue());
|
record.setOutNum(record.getInputNum().doubleValue());
|
||||||
}
|
}
|
||||||
//2、判断库存是否足够
|
//2、判断成套机具出库库存是否足够
|
||||||
if (record.getManageType() == 2) {
|
if (record.getManageType() == 2) {
|
||||||
res = checkStorageNumCt(record);
|
res = checkStorageNumCt(record);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
|
|
@ -208,6 +208,8 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
if (record.getManageType() == 2) {
|
if (record.getManageType() == 2) {
|
||||||
// 成套机具减少 (ma_type 设备规格表)的库存数量
|
// 成套机具减少 (ma_type 设备规格表)的库存数量
|
||||||
|
res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
||||||
|
// 成套机具减少 (ma_type 设备规格表)配件的库存数量
|
||||||
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
||||||
typeIds.removeIf(item -> item == null);
|
typeIds.removeIf(item -> item == null);
|
||||||
for (TmTask typeId : typeIds) {
|
for (TmTask typeId : typeIds) {
|
||||||
|
|
@ -268,14 +270,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int checkStorageNumCt(LeaseOutDetails record) {
|
private int checkStorageNumCt(LeaseOutDetails record) {
|
||||||
|
int res = 0;
|
||||||
double outNum = 0.1;
|
double outNum = 0.1;
|
||||||
if (StringUtils.isNull(record)) {
|
if (StringUtils.isNull(record)) {
|
||||||
return 0;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record.getOutNum() == null || record.getOutNum() < outNum) {
|
if (record.getOutNum() == null || record.getOutNum() < outNum) {
|
||||||
record.setOutNum(0.00);
|
record.setOutNum(0.00);
|
||||||
}
|
}
|
||||||
|
//先判断成套机具的库存是否足够
|
||||||
|
int num = leaseOutDetailsMapper.getmaChineByCt(record);
|
||||||
|
if (num < record.getOutNum()) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
//判断(ma_type 设备规格表)中的库存够不够出库的
|
//判断(ma_type 设备规格表)中的库存够不够出库的
|
||||||
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
||||||
typeIds.removeIf(item -> item == null);
|
typeIds.removeIf(item -> item == null);
|
||||||
|
|
@ -283,7 +291,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
||||||
MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
|
MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
|
||||||
machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum()));
|
machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum()));
|
||||||
if (machinePart.getNum() < machinePart.getPartNum()) {
|
if (machinePart.getNum() < machinePart.getPartNum()) {
|
||||||
return 0;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -959,4 +959,30 @@
|
||||||
) res
|
) res
|
||||||
HAVING backNum > -1
|
HAVING backNum > -1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="backReceiveRecordWeb" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||||||
|
SELECT
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt1.type_name AS typeCode,
|
||||||
|
ifnull(sum( bcd.back_num ), 0) AS backNum,
|
||||||
|
mm.ma_code as maCode,
|
||||||
|
bcd.create_time AS backTime,
|
||||||
|
bcd.type_id as modelId,
|
||||||
|
bcd.back_status AS backStatus
|
||||||
|
FROM
|
||||||
|
back_check_details bcd
|
||||||
|
LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
||||||
|
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
|
||||||
|
WHERE
|
||||||
|
bcd.parent_id = #{parentId}
|
||||||
|
AND bcd.type_id = #{typeId}
|
||||||
|
<if test="maCode != null and maCode != ''">
|
||||||
|
and mm.ma_code like concat('%', #{maCode}, '%')
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
bcd.type_id
|
||||||
|
ORDER BY
|
||||||
|
bcd.create_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -303,7 +303,7 @@
|
||||||
UPDATE
|
UPDATE
|
||||||
ma_type
|
ma_type
|
||||||
SET
|
SET
|
||||||
num = num - #{num} ,update_time = NOW()
|
num = #{num} ,update_time = NOW()
|
||||||
WHERE
|
WHERE
|
||||||
type_id = #{typeId}
|
type_id = #{typeId}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -412,7 +412,7 @@
|
||||||
SELECT
|
SELECT
|
||||||
mt.type_name AS typeModelName,
|
mt.type_name AS typeModelName,
|
||||||
mt.unit_name as unitName,
|
mt.unit_name as unitName,
|
||||||
mt.num as num,
|
ifnull(mt.num , 0) as num,
|
||||||
m2.type_name As typeName
|
m2.type_name As typeName
|
||||||
FROM
|
FROM
|
||||||
ma_type mt
|
ma_type mt
|
||||||
|
|
@ -420,4 +420,7 @@
|
||||||
WHERE
|
WHERE
|
||||||
mt.type_id = #{typeId}
|
mt.type_id = #{typeId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getmaChineByCt" resultType="java.lang.Integer">
|
||||||
|
select num from ma_type WHERE type_id = #{typeId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -330,8 +330,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt.type_id = #{typeId}
|
mt.type_id = #{typeId}
|
||||||
) aa ON aa.type_id = mt2.type_id
|
) aa ON aa.type_id = mt2.type_id
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
WHERE mt2.type_name like concat('%', #{keyWord}, '%')
|
WHERE (mt2.type_name like concat('%', #{keyWord}, '%')
|
||||||
|
or mt3.type_name like concat('%', #{keyWord}, '%'))
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue