优化功能
This commit is contained in:
parent
bd8bef233a
commit
a2a25fe20f
|
|
@ -368,7 +368,7 @@ public class MachineServiceImpl implements IMachineService
|
|||
|
||||
// 根据maid查询领料任务
|
||||
LeaseApplyInfo leaseInfo = machineMapper.getLeaseParentId(machine);
|
||||
if (leaseInfo.getParentId() == null){
|
||||
if (leaseInfo == null || leaseInfo.getParentId() == null){
|
||||
baseInfo.setLeaseTime(null);
|
||||
baseInfo.setLeaseUnit(null);
|
||||
baseInfo.setLeaseProject(null);
|
||||
|
|
@ -381,7 +381,7 @@ public class MachineServiceImpl implements IMachineService
|
|||
|
||||
// 根据maid查询退料任务
|
||||
LeaseApplyInfo leaseInfoBack = machineMapper.getBackParentId(machine);
|
||||
if (leaseInfoBack.getParentId() == null){
|
||||
if (leaseInfoBack == null || leaseInfoBack.getParentId() == null){
|
||||
baseInfo.setBackTime(null);
|
||||
baseInfo.setBackUnit(null);
|
||||
baseInfo.setBackProject(null);
|
||||
|
|
|
|||
|
|
@ -125,4 +125,11 @@ public interface PartArrivedMapper
|
|||
* @return
|
||||
*/
|
||||
int updateTaskStatus(@Param("taskId") Long taskId,@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* 修改采购配件主表
|
||||
* @param partTypeCheckInfo
|
||||
* @return
|
||||
*/
|
||||
int updatePurchaseCheckInfo(PartTypeCheckInfo partTypeCheckInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ public class PartArrivedServiceImpl implements IPartArrivedService
|
|||
@Transactional
|
||||
public AjaxResult insertPartTypeCheckInfo(PartTypeCheckDto partTypeCheckDto) {
|
||||
partTypeCheckDto.getPartTypeCheckInfo().setCreateTime(DateUtils.getNowDate());
|
||||
partTypeCheckDto.getPartTypeCheckInfo().setPurchaseTime(DateUtils.getNowDate());
|
||||
partTypeCheckDto.getPartTypeCheckInfo().setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
try {
|
||||
final int thisMonthMaxOrder = partArrivedMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PART_TYPE.getTaskTypeId());
|
||||
|
|
@ -237,17 +238,17 @@ public class PartArrivedServiceImpl implements IPartArrivedService
|
|||
BigDecimal inputNum = new BigDecimal(0);
|
||||
BigDecimal purchasePrice = new BigDecimal(0);
|
||||
BigDecimal purchaseTaxPrice = new BigDecimal(0);
|
||||
String partName = "";
|
||||
Set<String> partNameSet = new HashSet<>();
|
||||
for (int j = 0; j < partTypeCheckDetails.size(); j++) {
|
||||
purchaseNum = purchaseNum.add(partTypeCheckDetails.get(j).getPurchaseNum());
|
||||
inputNum = inputNum.add(partTypeCheckDetails.get(j).getInputNum());
|
||||
purchasePrice = purchasePrice.add(partTypeCheckDetails.get(j).getPurchasePrice().multiply(partTypeCheckDetails.get(j).getPurchaseNum()));
|
||||
purchaseTaxPrice = purchaseTaxPrice.add(partTypeCheckDetails.get(j).getPurchaseTaxPrice().multiply(partTypeCheckDetails.get(j).getPurchaseNum()));
|
||||
partName = partName + partTypeCheckDetails.get(j).getMaTypeName();
|
||||
if (j < partTypeCheckDetails.size() - 1) {
|
||||
partName += ",";
|
||||
}
|
||||
// 将名称添加到Set中(自动去重)
|
||||
partNameSet.add(partTypeCheckDetails.get(j).getMaTypeName());
|
||||
}
|
||||
// 将Set中的元素用逗号拼接成字符串
|
||||
String partName = String.join(",", partNameSet);
|
||||
partTypeCheckInfos.get(i).setInputMaNumber(inputNum);
|
||||
partTypeCheckInfos.get(i).setPurchaseMaNumber(purchaseNum);
|
||||
partTypeCheckInfos.get(i).setPurchasePrice(purchasePrice);
|
||||
|
|
@ -402,6 +403,11 @@ public class PartArrivedServiceImpl implements IPartArrivedService
|
|||
}
|
||||
partArrivedMapper.deletePartTypeCheckDetailsByParentIds(partTypeCheckDto.getPartTypeCheckInfo().getTaskId());
|
||||
if (ids.length > 0) {
|
||||
// 修改采购配件主表
|
||||
int res = partArrivedMapper.updatePurchaseCheckInfo(partTypeCheckDto.getPartTypeCheckInfo());
|
||||
if (res == 0) {
|
||||
throw new ServiceException("修改失败");
|
||||
}
|
||||
insertPartTypeCheckDetails(partTypeCheckDto.getPartTypeCheckDetailsList(), partTypeCheckDto.getPartTypeCheckInfo().getTaskId());
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -335,14 +335,14 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult getInfoByQrcode(BmQrcodeInfo bmQrcodeInfo) {
|
||||
if (bmQrcodeInfo.getQrCode() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "二维码code不能为空");
|
||||
if (bmQrcodeInfo.getQrCode() == null && bmQrcodeInfo.getMaCode() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "编码或二维码code不能为空");
|
||||
}
|
||||
List<RepairInputDetails> recordList = repairInputDetailsMapper.getInfoByQrcode(bmQrcodeInfo);
|
||||
if (CollectionUtil.isNotEmpty(recordList)) {
|
||||
return AjaxResult.success(recordList);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.SYSTEM_ERROR.getCode(), "该二维码处于非修试待入库状态");
|
||||
return AjaxResult.error(HttpCodeEnum.SYSTEM_ERROR.getCode(), "该编码处于非修试待入库状态");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -781,8 +781,11 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
//1查询入参设备是否为待入库设备
|
||||
|
||||
RepairInputDetails inputInfo = new RepairInputDetails();
|
||||
|
||||
if (StringUtils.isNotBlank(inputApplyDetails.getMaCode())) {
|
||||
inputInfo = checkCodeMachineStatus(inputApplyDetails.getMaCode());
|
||||
} else {
|
||||
inputInfo = checkMachineStatus(inputApplyDetails.getQrCode());
|
||||
}
|
||||
if(inputInfo ==null){
|
||||
throw new ServiceException("设备不是修试后待入库状态");
|
||||
}
|
||||
|
|
@ -808,6 +811,32 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修饰入库之编码入库
|
||||
* @param maCode
|
||||
* @return
|
||||
*/
|
||||
private RepairInputDetails checkCodeMachineStatus(String maCode) {
|
||||
RepairInputDetails inputInfo = new RepairInputDetails();
|
||||
|
||||
Machine ma = new Machine();
|
||||
ma.setMaCode(maCode);
|
||||
Machine ma2 = machineMapper.selectMachineByQrCode(ma);
|
||||
long maId = ma2.getMaId();
|
||||
|
||||
String status = ma2.getMaStatus();
|
||||
if("5".equals(status)){
|
||||
InputApplyDetails inputApplyDetails = new InputApplyDetails();
|
||||
inputApplyDetails.setMaId(maId);
|
||||
inputInfo = repairInputDetailsMapper.selectInputInfoByMaId(inputApplyDetails);
|
||||
|
||||
|
||||
}else{
|
||||
inputInfo = null;
|
||||
}
|
||||
return inputInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int sanQrBoxInput(RepairInputDetails repairInputDetails) {
|
||||
|
|
|
|||
|
|
@ -622,8 +622,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM
|
||||
ma_machine mm
|
||||
WHERE
|
||||
mm.qr_code = #{qrCode}
|
||||
|
||||
1 = 1
|
||||
<if test="qrCode != null and qrCode != ''">
|
||||
and mm.qr_code = #{qrCode}
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
and mm.ma_code LIKE CONCAT('%',#{maCode},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getInfoByQrcode" resultType="com.bonus.material.ma.domain.Machine">
|
||||
|
|
|
|||
|
|
@ -13,6 +13,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<update id="updatePurchaseCheckInfo">
|
||||
update purchase_part_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="taskId != null">task_id = #{taskId},</if>
|
||||
<if test="purchaseTime != null">purchase_time = #{purchaseTime},</if>
|
||||
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
|
||||
<if test="purchaser != null">purchaser = #{purchaser},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
</trim>
|
||||
where ID = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getTypeTree" resultType="com.bonus.material.part.domain.PartTypeDto">
|
||||
select DISTINCT m.pa_id as partId, m.pa_name as partName, m.parent_id as parentId, m.unit_id as unitId, m.unit_name as unitName, m.storage_num as storageNum,
|
||||
m.rent_price as rentPrice, m.buy_price as buyPrice, m.level,m.del_flag as delFlag,m.remark
|
||||
|
|
@ -130,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectPartTypeCheckDetailsList" resultType="com.bonus.material.part.domain.PartTypeCheckDetails">
|
||||
select part_id as partId,
|
||||
mpt.pa_name as maTypeName,
|
||||
mpt2.pa_name as maTypeName,
|
||||
purchase_price as purchasePrice,
|
||||
purchase_tax_price as purchaseTaxPrice,
|
||||
purchase_num as purchaseNum,
|
||||
|
|
@ -138,6 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
IFNULL(ppd.input_num, 0) as inputNum
|
||||
from purchase_part_details ppd
|
||||
left join ma_part_type mpt on ppd.part_id = mpt.pa_id and mpt.del_flag = 0
|
||||
left join ma_part_type mpt2 on mpt.parent_id = mpt2.pa_id and mpt2.del_flag = 0
|
||||
where ppd.task_id = #{taskId}
|
||||
and ppd.del_flag = 0
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -331,7 +331,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN repair_apply_details rad ON rad.id = rid.repair_id
|
||||
LEFT JOIN tm_task tt1 on rad.task_id = tt1.task_id
|
||||
WHERE
|
||||
mm.ma_status = '5' and mm.qr_code = #{qrCode}
|
||||
rid.`status` = '0' and mm.ma_status = '5'
|
||||
<if test="qrCode != null and qrCode != ''">
|
||||
and mm.qr_code = #{qrCode}
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
and mm.ma_code like concat('%',#{maCode},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="batchInsertRepairInputDetails" parameterType="com.bonus.common.biz.domain.repair.RepairInputDetails">
|
||||
|
|
@ -491,7 +497,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectInputInfoByMaId" resultMap="RepairInputDetailsResult">
|
||||
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}
|
||||
where status = '0' and ma_id = #{maId}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue