修试后入库扫描二维码入库开发
This commit is contained in:
parent
b8d00c0fe0
commit
195277638c
|
|
@ -26,7 +26,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
|
|||
|
||||
/**
|
||||
* 入库任务详细Controller
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
|
|
@ -116,4 +116,23 @@ public class InputApplyDetailsController extends BaseController {
|
|||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(inputApplyDetailsService.deleteInputApplyDetailsByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修试入库二维码扫描
|
||||
*/
|
||||
@ApiOperation(value = "新增入库任务详细")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("input:details:code")
|
||||
@SysLog(title = "扫描入库", businessType = OperaType.UPDATE, logType = 1,module = "修试入库->增加库存")
|
||||
@PostMapping
|
||||
public AjaxResult sanQrcodeInput(@RequestBody InputApplyDetails inputApplyDetails) {
|
||||
try {
|
||||
return toAjax(inputApplyDetailsService.sanInput(inputApplyDetails));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
|
||||
/**
|
||||
* 入库任务详细对象 input_apply_details
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
|
|
@ -56,5 +56,9 @@ public class InputApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Long companyId;
|
||||
|
||||
@ApiModelProperty(value = "入库人")
|
||||
private String auditBy;
|
||||
|
||||
@ApiModelProperty(value = "二维码")
|
||||
private String qrCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,4 +57,14 @@ public interface InputApplyDetailsMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteInputApplyDetailsByIds(Long[] ids);
|
||||
|
||||
int updateTaskStatus(InputApplyDetails inputApplyDetails);
|
||||
|
||||
int updateStorageNum(InputApplyDetails inputApplyDetails);
|
||||
|
||||
int updateInputNum(InputApplyDetails inputApplyDetails);
|
||||
|
||||
InputApplyDetails selectInputInfoByMaId(InputApplyDetails inputApplyDetails);
|
||||
|
||||
List<InputApplyDetails> selectInputTaskStatus(InputApplyDetails inputApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import com.bonus.material.input.domain.InputApplyDetails;
|
|||
|
||||
/**
|
||||
* 入库任务详细Service接口
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
public interface IInputApplyDetailsService {
|
||||
/**
|
||||
* 查询入库任务详细
|
||||
*
|
||||
*
|
||||
* @param id 入库任务详细主键
|
||||
* @return 入库任务详细
|
||||
*/
|
||||
|
|
@ -20,7 +20,7 @@ public interface IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 查询入库任务详细列表
|
||||
*
|
||||
*
|
||||
* @param inputApplyDetails 入库任务详细
|
||||
* @return 入库任务详细集合
|
||||
*/
|
||||
|
|
@ -28,7 +28,7 @@ public interface IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 新增入库任务详细
|
||||
*
|
||||
*
|
||||
* @param inputApplyDetails 入库任务详细
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -36,7 +36,7 @@ public interface IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 修改入库任务详细
|
||||
*
|
||||
*
|
||||
* @param inputApplyDetails 入库任务详细
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -44,7 +44,7 @@ public interface IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 批量删除入库任务详细
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的入库任务详细主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -52,9 +52,11 @@ public interface IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 删除入库任务详细信息
|
||||
*
|
||||
*
|
||||
* @param id 入库任务详细主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInputApplyDetailsById(Long id);
|
||||
|
||||
int sanInput(InputApplyDetails inputApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,19 @@ package com.bonus.material.input.service.impl;
|
|||
import java.util.List;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.input.mapper.InputApplyDetailsMapper;
|
||||
import com.bonus.material.input.domain.InputApplyDetails;
|
||||
import com.bonus.material.input.service.IInputApplyDetailsService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 入库任务详细Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
|
|
@ -20,9 +24,11 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
|||
@Autowired
|
||||
private InputApplyDetailsMapper inputApplyDetailsMapper;
|
||||
|
||||
@Autowired
|
||||
private MachineMapper machineMapper;
|
||||
/**
|
||||
* 查询入库任务详细
|
||||
*
|
||||
*
|
||||
* @param id 入库任务详细主键
|
||||
* @return 入库任务详细
|
||||
*/
|
||||
|
|
@ -33,7 +39,7 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 查询入库任务详细列表
|
||||
*
|
||||
*
|
||||
* @param inputApplyDetails 入库任务详细
|
||||
* @return 入库任务详细
|
||||
*/
|
||||
|
|
@ -44,7 +50,7 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 新增入库任务详细
|
||||
*
|
||||
*
|
||||
* @param inputApplyDetails 入库任务详细
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -60,7 +66,7 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 修改入库任务详细
|
||||
*
|
||||
*
|
||||
* @param inputApplyDetails 入库任务详细
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -76,7 +82,7 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 批量删除入库任务详细
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的入库任务详细主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -87,7 +93,7 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
|||
|
||||
/**
|
||||
* 删除入库任务详细信息
|
||||
*
|
||||
*
|
||||
* @param id 入库任务详细主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -95,4 +101,89 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
|||
public int deleteInputApplyDetailsById(Long id) {
|
||||
return inputApplyDetailsMapper.deleteInputApplyDetailsById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int sanInput(InputApplyDetails inputApplyDetails) {
|
||||
int result = 0;
|
||||
try {
|
||||
//1查询入参设备是否为待入库设备
|
||||
|
||||
InputApplyDetails inputInfo = new InputApplyDetails();
|
||||
|
||||
inputInfo = checkMachineStatus(inputApplyDetails.getQrCode());
|
||||
if(inputInfo !=null){
|
||||
throw new ServiceException("设备不是修试后待入库状态");
|
||||
}
|
||||
//2更新入库设备数量
|
||||
result = updateInputNum(inputInfo);
|
||||
if(result <= 0){
|
||||
throw new ServiceException("更新入库数量失败");
|
||||
}
|
||||
//3更新库存数量
|
||||
result = updateStorageNum(inputInfo);
|
||||
if(result <= 0){
|
||||
throw new ServiceException("更新库存数量失败");
|
||||
}
|
||||
//4更新任务状态
|
||||
result = updateTaskStatus(inputInfo);
|
||||
if(result <= 0){
|
||||
throw new ServiceException("更新任务状态失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("系统错误, " + e.getMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int updateTaskStatus(InputApplyDetails inputApplyDetails) {
|
||||
int result = 0;
|
||||
|
||||
List<InputApplyDetails> inputList = inputApplyDetailsMapper.selectInputTaskStatus(inputApplyDetails);
|
||||
|
||||
if(inputList.size() > 0 && inputList!=null){
|
||||
result = 1;
|
||||
}else{
|
||||
result = inputApplyDetailsMapper.updateTaskStatus(inputApplyDetails);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int updateStorageNum(InputApplyDetails inputApplyDetails) {
|
||||
int result = 0;
|
||||
result = inputApplyDetailsMapper.updateStorageNum(inputApplyDetails);
|
||||
result = machineMapper.updateStatus(inputApplyDetails.getMaId(), 141);
|
||||
return result;
|
||||
}
|
||||
|
||||
private int updateInputNum(InputApplyDetails inputApplyDetails) {
|
||||
int result = 0;
|
||||
String auditBy = SecurityUtils.getLoginUser().getUserid().toString();
|
||||
result = inputApplyDetailsMapper.updateInputNum(inputApplyDetails);
|
||||
return result;
|
||||
}
|
||||
|
||||
private InputApplyDetails checkMachineStatus(String qrCode) {
|
||||
InputApplyDetails inputInfo = new InputApplyDetails();
|
||||
|
||||
Machine ma = new Machine();
|
||||
ma.setQrCode(qrCode);
|
||||
ma = machineMapper.selectMachineByQrCode(ma);
|
||||
long maId = ma.getId();
|
||||
|
||||
String status = ma.getMaStatus();
|
||||
if("145".equals(status)){
|
||||
InputApplyDetails inputApplyDetails = new InputApplyDetails();
|
||||
inputApplyDetails.setMaId(maId);
|
||||
inputInfo = inputApplyDetailsMapper.selectInputInfoByMaId(inputApplyDetails);
|
||||
|
||||
|
||||
}else{
|
||||
inputInfo = null;
|
||||
}
|
||||
return inputInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
/**
|
||||
* 机具设备管理Mapper接口
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
public interface MachineMapper
|
||||
public interface MachineMapper
|
||||
{
|
||||
/**
|
||||
* 查询机具设备管理
|
||||
*
|
||||
*
|
||||
* @param maId 机具设备管理主键
|
||||
* @return 机具设备管理
|
||||
*/
|
||||
|
|
@ -36,7 +36,7 @@ public interface MachineMapper
|
|||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
*
|
||||
*
|
||||
* @param machine 机具设备管理
|
||||
* @return 机具设备管理集合
|
||||
*/
|
||||
|
|
@ -44,7 +44,7 @@ public interface MachineMapper
|
|||
|
||||
/**
|
||||
* 新增机具设备管理
|
||||
*
|
||||
*
|
||||
* @param machine 机具设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -52,7 +52,7 @@ public interface MachineMapper
|
|||
|
||||
/**
|
||||
* 修改机具设备管理
|
||||
*
|
||||
*
|
||||
* @param machine 机具设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -60,7 +60,7 @@ public interface MachineMapper
|
|||
|
||||
/**
|
||||
* 删除机具设备管理
|
||||
*
|
||||
*
|
||||
* @param maId 机具设备管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -75,7 +75,7 @@ public interface MachineMapper
|
|||
|
||||
/**
|
||||
* 批量删除机具设备管理
|
||||
*
|
||||
*
|
||||
* @param maIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -149,4 +149,7 @@ public interface MachineMapper
|
|||
* @return 结果
|
||||
*/
|
||||
int editAssetsCode(Machine machine);
|
||||
|
||||
|
||||
Machine selectMachineByQrCode(Machine ma);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectInputApplyDetailsList" parameterType="com.bonus.material.input.domain.InputApplyDetails" resultMap="InputApplyDetailsResult">
|
||||
<include refid="selectInputApplyDetailsVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="taskId != null "> and task_id = #{taskId}</if>
|
||||
<if test="maId != null "> and ma_id = #{maId}</if>
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
|
|
@ -35,12 +35,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="companyId != null "> and company_id = #{companyId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectInputApplyDetailsById" parameterType="Long" resultMap="InputApplyDetailsResult">
|
||||
<include refid="selectInputApplyDetailsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertInputApplyDetails" parameterType="com.bonus.material.input.domain.InputApplyDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into input_apply_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -97,9 +97,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<delete id="deleteInputApplyDetailsByIds" parameterType="String">
|
||||
delete from input_apply_details where id in
|
||||
delete from input_apply_details where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
<update id="updateTaskStatus">
|
||||
update tm_task set task_status = 1
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<update id="updateStorageNum">
|
||||
update ma_type set storage_num = storage_num + #{inputNum}
|
||||
where id = #{typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateInputNum">
|
||||
update repair_input_details set input_num = 1,audit_by = #{auditBy},status = 1,audit_time = now()
|
||||
where task_id = #{taskId} and ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<select id="selectInputInfoByMaId" resultMap="InputApplyDetailsResult">
|
||||
select id, task_id, ma_id, type_id, input_num, create_by, create_time, update_by, update_time, remark, company_id from repair_input_details
|
||||
where ma_id = #{maId}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectInputTaskStatus" resultMap="InputApplyDetailsResult">
|
||||
SELECT
|
||||
task_id,
|
||||
SUM(repair_num) - SUM(inputNum) as waitNum
|
||||
FROM
|
||||
(
|
||||
|
||||
SELECT
|
||||
id,
|
||||
task_id,
|
||||
ma_id,
|
||||
type_id,
|
||||
repair_num,
|
||||
IFNULL(input_num,0) as inputNum,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
company_id
|
||||
FROM
|
||||
repair_input_details
|
||||
WHERE
|
||||
task_id =1432
|
||||
) res
|
||||
HAVING waitNum > 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
|
||||
<delete id="deleteMachineByMaIds" parameterType="String">
|
||||
delete from ma_machine where ma_id in
|
||||
delete from ma_machine where ma_id in
|
||||
<foreach item="maId" collection="array" open="(" separator="," close=")">
|
||||
#{maId}
|
||||
</foreach>
|
||||
|
|
@ -501,4 +501,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
assets_code = #{assetsCode}
|
||||
where ma_id = #{maId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
|
||||
|
||||
<select id="selectMachineByQrCode" resultMap="MachineResult">
|
||||
SELECT
|
||||
mm.ma_id as maId,
|
||||
mm.ma_code as maCode,
|
||||
mm.type_id as typeId,
|
||||
mm.ma_status as maStatus,
|
||||
mm.qr_code as qrCode,
|
||||
mm.buy_price as buyPrice,
|
||||
mm.ma_vender as maVender,
|
||||
mm.out_fac_time as outFacTime,
|
||||
mm.out_fac_code as outFacCode,
|
||||
mm.assets_code as assetsCode,
|
||||
mm.check_man as checkMan,
|
||||
mm.this_check_time as thisCheckTime
|
||||
FROM
|
||||
ma_machine mm
|
||||
WHERE
|
||||
mm.qr_code = #{qrCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue