退料审核代码提交
This commit is contained in:
parent
5490fd2e8f
commit
82e8a6db4a
|
|
@ -278,7 +278,7 @@ public class BackReceiveController extends BaseController {
|
|||
@PostMapping("backReceiveRecordWeb")
|
||||
public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) {
|
||||
try {
|
||||
List<BackApplyInfo> list = backReceiveService.backReceiveRecord(record);
|
||||
List<BackApplyInfo> list = backReceiveService.backReceiveRecordWeb(record);
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public class BackApplyInfo {
|
|||
*/
|
||||
private String userName;
|
||||
private String badId;
|
||||
private String[] typeIds;
|
||||
|
||||
@Excel(name = "退料状态",sort = 9)
|
||||
private String taskName;
|
||||
|
|
|
|||
|
|
@ -198,4 +198,6 @@ public interface BackReceiveMapper {
|
|||
int selectNumByTypeId(@Param("parentId")Integer parentId,@Param("typeId") String typeId);
|
||||
|
||||
int selectTaskStatus(int taskId);
|
||||
|
||||
BackApplyInfo backReceiveRecordWeb(BackApplyInfo record);
|
||||
}
|
||||
|
|
@ -99,4 +99,6 @@ public interface LeaseOutDetailsMapper {
|
|||
MachinePart getMachineParts(TmTask typeId);
|
||||
|
||||
int updateMaTypeStockNumCt(TmTask record);
|
||||
|
||||
int getmaChineByCt(LeaseOutDetails record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,4 +95,6 @@ public interface BackReceiveService {
|
|||
List<TmTask> getRecord(TmTask task);
|
||||
|
||||
int revoke(BackApplyInfo record);
|
||||
|
||||
List<BackApplyInfo> backReceiveRecordWeb(BackApplyInfo record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,10 +83,6 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
if (res == 0) {
|
||||
throw new RuntimeException("插入back_check_details异常");
|
||||
}
|
||||
/* int insSltInfoNum = insSltInfo(lTask.getAgreementId().toString(), leaseOutDetail);
|
||||
if (insSltInfoNum < 1) {
|
||||
return res;
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
|
@ -115,7 +111,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
break;
|
||||
}
|
||||
//根据maId和taskId查询是否已接收
|
||||
re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId());
|
||||
re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId());
|
||||
if (re > 0) {
|
||||
res = -1;
|
||||
break;
|
||||
|
|
@ -325,6 +321,21 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
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) {
|
||||
int result = 0;
|
||||
if (wxList != null) {
|
||||
|
|
@ -452,8 +463,17 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
//机具状态变为在用
|
||||
backReceiveMapper.updateMaStatus(s, "16");
|
||||
}
|
||||
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);
|
||||
}
|
||||
res = backReceiveMapper.deleteCheckDetails(record);
|
||||
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) {
|
||||
record.setOutNum(record.getInputNum().doubleValue());
|
||||
}
|
||||
//2、判断库存是否足够
|
||||
//2、判断成套机具出库库存是否足够
|
||||
if (record.getManageType() == 2) {
|
||||
res = checkStorageNumCt(record);
|
||||
if (res == 0) {
|
||||
|
|
@ -206,8 +206,10 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
// 插入领料出库明细表(lease_out_details)
|
||||
res = leaseOutDetailsMapper.insertSelective(record);
|
||||
if (res > 0) {
|
||||
if (record.getManageType() == 2){
|
||||
if (record.getManageType() == 2) {
|
||||
// 成套机具减少 (ma_type 设备规格表)的库存数量
|
||||
res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
||||
// 成套机具减少 (ma_type 设备规格表)配件的库存数量
|
||||
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
||||
typeIds.removeIf(item -> item == null);
|
||||
for (TmTask typeId : typeIds) {
|
||||
|
|
@ -216,7 +218,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
typeId.setNum(machinePart.getNum() - machinePart.getPartNum());
|
||||
res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
// 普通机具减少 (ma_type 设备规格表)的库存数量
|
||||
res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
||||
}
|
||||
|
|
@ -268,14 +270,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
}
|
||||
|
||||
private int checkStorageNumCt(LeaseOutDetails record) {
|
||||
int res = 0;
|
||||
double outNum = 0.1;
|
||||
if (StringUtils.isNull(record)) {
|
||||
return 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (record.getOutNum() == null || record.getOutNum() < outNum) {
|
||||
record.setOutNum(0.00);
|
||||
}
|
||||
//先判断成套机具的库存是否足够
|
||||
int num = leaseOutDetailsMapper.getmaChineByCt(record);
|
||||
if (num < record.getOutNum()) {
|
||||
return res;
|
||||
}
|
||||
//判断(ma_type 设备规格表)中的库存够不够出库的
|
||||
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
||||
typeIds.removeIf(item -> item == null);
|
||||
|
|
@ -283,7 +291,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
|
||||
machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum()));
|
||||
if (machinePart.getNum() < machinePart.getPartNum()) {
|
||||
return 0;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -959,4 +959,30 @@
|
|||
) res
|
||||
HAVING backNum > -1
|
||||
</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>
|
||||
|
|
@ -303,7 +303,7 @@
|
|||
UPDATE
|
||||
ma_type
|
||||
SET
|
||||
num = num - #{num} ,update_time = NOW()
|
||||
num = #{num} ,update_time = NOW()
|
||||
WHERE
|
||||
type_id = #{typeId}
|
||||
</update>
|
||||
|
|
@ -412,7 +412,7 @@
|
|||
SELECT
|
||||
mt.type_name AS typeModelName,
|
||||
mt.unit_name as unitName,
|
||||
mt.num as num,
|
||||
ifnull(mt.num , 0) as num,
|
||||
m2.type_name As typeName
|
||||
FROM
|
||||
ma_type mt
|
||||
|
|
@ -420,4 +420,7 @@
|
|||
WHERE
|
||||
mt.type_id = #{typeId}
|
||||
</select>
|
||||
<select id="getmaChineByCt" resultType="java.lang.Integer">
|
||||
select num from ma_type WHERE type_id = #{typeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -330,8 +330,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.type_id = #{typeId}
|
||||
) aa ON aa.type_id = mt2.type_id
|
||||
<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>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue