SQL异常处理

This commit is contained in:
syruan 2023-12-23 13:33:03 +08:00
parent d18dc7f9c4
commit eab80f6156
8 changed files with 56 additions and 4 deletions

View File

@ -40,6 +40,10 @@ public class LeaseOutDetails implements Serializable {
@ApiModelProperty(value = "maId") @ApiModelProperty(value = "maId")
private Integer maId; private Integer maId;
/** 机具编号 */
@ApiModelProperty(value = "机具编号")
private String maCode;
/** 协议ID */ /** 协议ID */
@ApiModelProperty(value = "协议ID") @ApiModelProperty(value = "协议ID")
private String agreementId; private String agreementId;

View File

@ -31,6 +31,18 @@ public class LeaseOutDetailsController extends BaseController {
return getDataTable(leaseOutDetailsService.selectListByParentId(taskId)); return getDataTable(leaseOutDetailsService.selectListByParentId(taskId));
} }
/**
* 根据code编码查询设备信息
* @param mCode 机具编码
* @return 设备信息
*/
@Log(title = "根据code编码获取设备信息", businessType = BusinessType.QUERY)
@GetMapping("/getMaMachineByCode")
public TableDataInfo getMaMachineByCode(@RequestParam(value = "maCode") String mCode) {
return getDataTable(leaseOutDetailsService.getMaMachineByCode(mCode));
}
/** /**
* 领料出库对库存处理 * 领料出库对库存处理
* @param record 出库内容 * @param record 出库内容

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.app.service; package com.bonus.sgzb.app.service;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails; import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import java.util.List; import java.util.List;
@ -17,4 +18,6 @@ public interface LeaseOutDetailsService {
List<LeaseOutDetails> selectListByParentId(String parentId); List<LeaseOutDetails> selectListByParentId(String parentId);
AjaxResult submitOut(LeaseOutDetails record); AjaxResult submitOut(LeaseOutDetails record);
List<MaMachine> getMaMachineByCode(String maCode);
} }

View File

@ -3,6 +3,8 @@ package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper; import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper;
import com.bonus.sgzb.app.service.LeaseOutDetailsService; import com.bonus.sgzb.app.service.LeaseOutDetailsService;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails; import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.mapper.MaMachineMapper;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -24,6 +26,9 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
@Resource @Resource
private LeaseOutDetailsMapper leaseOutDetailsMapper; private LeaseOutDetailsMapper leaseOutDetailsMapper;
@Resource
private MaMachineMapper maMachineMapper;
/** /**
* 根据任务id查询出库数据 * 根据任务id查询出库数据
* @param parentId 任务id * @param parentId 任务id
@ -44,6 +49,9 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
if (StringUtils.isNull(record)) { if (StringUtils.isNull(record)) {
return AjaxResult.error("领料出库失败,请检查参数是否填写完整!"); return AjaxResult.error("领料出库失败,请检查参数是否填写完整!");
} }
if (record.getOutNum() == null || record.getOutNum() < 0.1) {
record.setOutNum(1.00);
}
// 首先更新领料任务详情表的领料数及状态 // 首先更新领料任务详情表的领料数及状态
int updateLeaseApplyDetailsOutNum = leaseOutDetailsMapper.updateLeaseApplyDetailsOutNum(record); int updateLeaseApplyDetailsOutNum = leaseOutDetailsMapper.updateLeaseApplyDetailsOutNum(record);
// 插入领料出库明细表 // 插入领料出库明细表
@ -74,7 +82,14 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
return AjaxResult.error("出库操作失败,更新领料数量及状态时出错!"); return AjaxResult.error("出库操作失败,更新领料数量及状态时出错!");
} }
/**
* @param maMachine
* @return
*/
@Override
public List<MaMachine> getMaMachineByCode(String maCode) {
return maMachineMapper.getMaMachineByCode(maCode);
}
} }

View File

@ -9,6 +9,8 @@ import java.util.List;
public interface MaMachineMapper { public interface MaMachineMapper {
public List<MaMachine> getMaMachine(MaMachine maMachine); public List<MaMachine> getMaMachine(MaMachine maMachine);
public List<MaMachine> getMaMachineByCode(String maCode);
public List<MaMachine> getMaMachineList(MaMachine maMachine); public List<MaMachine> getMaMachineList(MaMachine maMachine);
public int maMachineAdd(MaMachine maMachine); public int maMachineAdd(MaMachine maMachine);

View File

@ -19,7 +19,7 @@
UPDATE UPDATE
lease_apply_details lease_apply_details
SET SET
al_num = al_num + 1, al_num = al_num + #{record.outNum},
<if test="record.updateBy != null and record.updateBy!= '' "> <if test="record.updateBy != null and record.updateBy!= '' ">
update_by = #{record.updateBy}, update_by = #{record.updateBy},
</if> </if>

View File

@ -454,7 +454,7 @@
</update> </update>
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask"> <select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT SELECT DISTINCT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName, tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpi.pro_id as proId,bpi.pro_name as proName, bpi.pro_id as proId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName, bui.unit_id as unitId,bui.unit_name as unitName,
@ -496,7 +496,6 @@
<if test="record.keyWord != null and record.keyWord != ''"> <if test="record.keyWord != null and record.keyWord != ''">
AND bai.agreement_code like concat('%', #{record.keyWord}, '%') AND bai.agreement_code like concat('%', #{record.keyWord}, '%')
</if> </if>
GROUP BY tt.task_id
</select> </select>
<select id="getAuditListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo"> <select id="getAuditListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">

View File

@ -58,6 +58,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by m.ma_id desc order by m.ma_id desc
</select> </select>
<select id="getMaMachineByCode" parameterType="java.lang.String" resultMap="MaMachineResult">
select m.ma_id, m.type_id, m.ma_code, m.pre_code, m.ma_status, dic.name maStatusName, m.qr_code, m.buy_price, m.ma_vender, m.out_fac_time, m.out_fac_code,
m.assets_code, m.check_man, m.this_check_time, m.next_check_time, m.gps_code, m.rfid_code, m.erp_code, m.transfer_code,
m.in_out_num, m.buy_task, m.own_house ,m.company_id ,mt.type_name specificationType,mt1.type_name deviceType, mt2.type_name itemType,
mmb.label_code labelCode
from ma_machine m
left join (select id,p_id,name from sys_dic where p_id in (select id from sys_dic where value = 'ma_status')) dic on m.ma_status = dic.id
left join ma_type mt on m.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_label_bind mmb on m.ma_id = mmb.ma_id and m.type_id = mmb.type_id
<where>
m.ma_code = #{maCode}
</where>
order by m.ma_id desc
</select>
<select id="getMaMachineList" parameterType="com.bonus.sgzb.base.api.domain.MaMachine" resultMap="MaMachineResult"> <select id="getMaMachineList" parameterType="com.bonus.sgzb.base.api.domain.MaMachine" resultMap="MaMachineResult">
select ma_id, type_id, ma_code, pre_code, ma_status, qr_code, buy_price, ma_vender, out_fac_time, out_fac_code, select ma_id, type_id, ma_code, pre_code, ma_status, qr_code, buy_price, ma_vender, out_fac_time, out_fac_code,