1.调整领用设备自定义序列号产品自定义码生成时间为提交审核

zhairh
x_z 2 years ago
parent 513faef851
commit 9c52af8755

@ -62,4 +62,11 @@ public interface DeviceCollectOrderDetailDao {
* @return
*/
DeviceCollectOrderDetailEntity findOneByCode(@Param("code") String code);
/**
*
*
* @param details
*/
void updateCodeBatch(List<DeviceCollectOrderDetailEntity> details);
}

@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -95,11 +96,27 @@ public class DeviceCollectOrderServiceImpl implements DeviceCollectOrderService
if (CollUtil.isEmpty(detailList)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请添加领用设备!");
}
List<DeviceCollectOrderDetailEntity> details = new ArrayList<>(detailList.size());
//检验序列号,校验通过更新无序列号产品编码
for (DeviceCollectOrderDetailEntity deviceCollectOrderDetailEntity : detailList) {
if (StrUtil.isBlank(deviceCollectOrderDetailEntity.getSerialNo())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "领用设备中存在无序列号设备,无法提交审核,请完善设备信息!");
} else if (StrUtil.isBlank(deviceCollectOrderDetailEntity.getCode())) {
//有自定义序列号,重新生成码
WarehouseEntity warehouseEntity = new WarehouseEntity();
BeanUtil.copyProperties(deviceCollectOrderDetailEntity, warehouseEntity);
String code = FilterUdiUtils.transGlxpHasSerStr(warehouseEntity);
deviceCollectOrderDetailEntity.setCode(code);
details.add(deviceCollectOrderDetailEntity);
}
}
if (CollUtil.isNotEmpty(details)) {
//更新自定义码详情
deviceCollectOrderDetailDao.updateCodeBatch(details);
}
//更新领用记录状态为待审核
deviceCollectOrderDao.updateStatusById(1, id);
return ResultVOUtils.success("提交成功!");
@ -112,21 +129,8 @@ public class DeviceCollectOrderServiceImpl implements DeviceCollectOrderService
}
DeviceCollectOrderEntity deviceCollectOrderEntity = deviceCollectOrderDao.selectByPrimaryKey(id);
if (null == deviceCollectOrderEntity) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "领用记录不出存在!");
}
//查询此领用记录详情中定义序列号的记录,重新生成码
List<DeviceCollectOrderDetailEntity> detailEntityList = deviceCollectOrderDetailDao.selectByOrderId(deviceCollectOrderEntity.getOrderId());
detailEntityList.forEach(detailEntity -> {
if (StrUtil.isBlank(detailEntity.getCode())) {
WarehouseEntity warehouseEntity = new WarehouseEntity();
BeanUtil.copyProperties(detailEntity, warehouseEntity);
String code = FilterUdiUtils.transGlxpHasSerStr(warehouseEntity);
detailEntity.setCode(code);
//更新详情的条码信息
deviceCollectOrderDetailDao.updateByPrimaryKey(detailEntity);
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "领用记录不存在!");
}
});
String auditUser = customerService.getUserBean().getUserName();
deviceCollectOrderEntity.setAuditUser(auditUser);
deviceCollectOrderEntity.setStatus(status);

@ -395,4 +395,16 @@
</where>
limit 1
</select>
<update id="updateCodeBatch">
<foreach collection="list" item="item" index="index" separator=";">
update device_collect_order_detail
<set>
<if test="item.code != null and item.code != ''">
code = #{item.code}
</if>
</set>
where id = #{item.id}
</foreach>
</update>
</mapper>
Loading…
Cancel
Save