修试后入库扫描二维码入库开发
This commit is contained in:
parent
b8d00c0fe0
commit
195277638c
|
|
@ -116,4 +116,23 @@ public class InputApplyDetailsController extends BaseController {
|
||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
return toAjax(inputApplyDetailsService.deleteInputApplyDetailsByIds(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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,5 +56,9 @@ public class InputApplyDetails extends BaseEntity {
|
||||||
@ApiModelProperty(value = "数据所属组织")
|
@ApiModelProperty(value = "数据所属组织")
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "入库人")
|
||||||
|
private String auditBy;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "二维码")
|
||||||
|
private String qrCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,14 @@ public interface InputApplyDetailsMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteInputApplyDetailsByIds(Long[] ids);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,6 @@ public interface IInputApplyDetailsService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteInputApplyDetailsById(Long id);
|
public int deleteInputApplyDetailsById(Long id);
|
||||||
|
|
||||||
|
int sanInput(InputApplyDetails inputApplyDetails);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,15 @@ package com.bonus.material.input.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.input.mapper.InputApplyDetailsMapper;
|
import com.bonus.material.input.mapper.InputApplyDetailsMapper;
|
||||||
import com.bonus.material.input.domain.InputApplyDetails;
|
import com.bonus.material.input.domain.InputApplyDetails;
|
||||||
import com.bonus.material.input.service.IInputApplyDetailsService;
|
import com.bonus.material.input.service.IInputApplyDetailsService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库任务详细Service业务层处理
|
* 入库任务详细Service业务层处理
|
||||||
|
|
@ -20,6 +24,8 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InputApplyDetailsMapper inputApplyDetailsMapper;
|
private InputApplyDetailsMapper inputApplyDetailsMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MachineMapper machineMapper;
|
||||||
/**
|
/**
|
||||||
* 查询入库任务详细
|
* 查询入库任务详细
|
||||||
*
|
*
|
||||||
|
|
@ -95,4 +101,89 @@ public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
|
||||||
public int deleteInputApplyDetailsById(Long id) {
|
public int deleteInputApplyDetailsById(Long id) {
|
||||||
return inputApplyDetailsMapper.deleteInputApplyDetailsById(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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,4 +149,7 @@ public interface MachineMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int editAssetsCode(Machine machine);
|
int editAssetsCode(Machine machine);
|
||||||
|
|
||||||
|
|
||||||
|
Machine selectMachineByQrCode(Machine ma);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,4 +102,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<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>
|
</mapper>
|
||||||
|
|
@ -501,4 +501,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
assets_code = #{assetsCode}
|
assets_code = #{assetsCode}
|
||||||
where ma_id = #{maId}
|
where ma_id = #{maId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
</mapper>
|
||||||
Loading…
Reference in New Issue