新购绑定
This commit is contained in:
parent
de3594b947
commit
cef5310e65
|
|
@ -51,15 +51,55 @@ public class MaterialConstants {
|
||||||
*/
|
*/
|
||||||
public static final String LATITUDE_PATTERN = "^(-?(90(\\.0+)?|[1-8]?\\d(\\.\\d{1,6})?))$";
|
public static final String LATITUDE_PATTERN = "^(-?(90(\\.0+)?|[1-8]?\\d(\\.\\d{1,6})?))$";
|
||||||
|
|
||||||
public static final String ZERO_CONSTANT = "0";
|
/**
|
||||||
|
* 待提交
|
||||||
|
*/
|
||||||
|
public static final Integer ZERO_CONSTANT = 0;
|
||||||
|
|
||||||
public static final String ONE_CONSTANT = "1";
|
/**
|
||||||
|
* 待通知
|
||||||
|
*/
|
||||||
|
public static final Integer ONE_CONSTANT = 1;
|
||||||
|
|
||||||
public static final String TWO_CONSTANT = "2";
|
/**
|
||||||
|
* 待验收
|
||||||
|
*/
|
||||||
|
public static final Integer TWO_CONSTANT = 2;
|
||||||
|
|
||||||
public static final String THREE_CONSTANT = "3";
|
/**
|
||||||
|
* 待绑定
|
||||||
|
*/
|
||||||
|
public static final Integer THREE_CONSTANT = 3;
|
||||||
|
|
||||||
public static final String FOUR_CONSTANT = "4";
|
/**
|
||||||
|
* 待入库
|
||||||
|
*/
|
||||||
|
public static final Integer FOUR_CONSTANT = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已完成
|
||||||
|
*/
|
||||||
|
public static final Integer FIVE_CONSTANT = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待验收(驳回后)
|
||||||
|
*/
|
||||||
|
public static final Integer SIX_CONSTANT = 6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待绑定(驳回后)
|
||||||
|
*/
|
||||||
|
public static final Integer SEVEN_CONSTANT = 7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待入库(驳回后)
|
||||||
|
*/
|
||||||
|
public static final Integer EIGHT_CONSTANT = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库进行中
|
||||||
|
*/
|
||||||
|
public static final Integer NINE_CONSTANT = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 已全部入库
|
* 已全部入库
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.bonus.material.purchase.controller;
|
package com.bonus.material.purchase.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.common.security.annotation.PreventRepeatSubmit;
|
import com.bonus.common.security.annotation.PreventRepeatSubmit;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.material.purchase.dto.PurchaseDto;
|
import com.bonus.material.purchase.dto.PurchaseDto;
|
||||||
|
|
@ -86,8 +89,35 @@ public class PurchaseBindController extends BaseController {
|
||||||
@ApiOperation(value = "二维码生成下载")
|
@ApiOperation(value = "二维码生成下载")
|
||||||
@PostMapping(value = "/downloadQrCode")
|
@PostMapping(value = "/downloadQrCode")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
//@RequiresPermissions("purchase:bind:download")
|
||||||
public void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto) {
|
public void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto) {
|
||||||
purchaseBindService.downloadQrCode(response, purchaseDto);
|
purchaseBindService.downloadQrCode(response, purchaseDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驳回或批量驳回
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "驳回或批量驳回操作")
|
||||||
|
@com.bonus.material.common.annotation.PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("purchase:bind:reject")
|
||||||
|
@PostMapping("/reject")
|
||||||
|
public AjaxResult reject(@RequestBody PurchaseDto dto) {
|
||||||
|
return purchaseBindService.reject(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出新购验收绑定详细列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "导出新购验收绑定详细列表")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("purchase:bind:export")
|
||||||
|
@SysLog(title = "新购验收绑定任务", businessType = OperaType.EXPORT, module = "仓储管理->导出新购验收绑定任务")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, PurchaseDto dto) {
|
||||||
|
List<PurchaseVo> list = purchaseBindService.selectAll(dto);
|
||||||
|
ExcelUtil<PurchaseVo> util = new ExcelUtil<PurchaseVo>(PurchaseVo.class);
|
||||||
|
util.exportExcel(response, list, "新购验收绑定任务数据");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class PurchaseStorageController extends BaseController {
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "入库或批量入库操作")
|
@ApiOperation(value = "驳回或批量驳回操作")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:storage:reject")
|
@RequiresPermissions("purchase:storage:reject")
|
||||||
@PostMapping("/reject")
|
@PostMapping("/reject")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.bonus.material.purchase.dto;
|
package com.bonus.material.purchase.dto;
|
||||||
|
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -47,6 +45,9 @@ public class PurchaseDto {
|
||||||
@ApiModelProperty(value = "二级明细id")
|
@ApiModelProperty(value = "二级明细id")
|
||||||
private String purchaseId;
|
private String purchaseId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "二级明细id列表")
|
||||||
|
private List<String> purchaseIdList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "id列表")
|
@ApiModelProperty(value = "id列表")
|
||||||
private List<Integer> taskIds;
|
private List<Integer> taskIds;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,4 +73,11 @@ public interface PurchaseBindMapper {
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
void insert(PurchaseDto dto);
|
void insert(PurchaseDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新绑定状态
|
||||||
|
* @param updatedStatus
|
||||||
|
* @param purchaseId
|
||||||
|
*/
|
||||||
|
void updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,4 +47,12 @@ public interface IPurchaseBindService {
|
||||||
* @param purchaseDto
|
* @param purchaseDto
|
||||||
*/
|
*/
|
||||||
void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto);
|
void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驳回或批量驳回操作
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult reject(PurchaseDto dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.bonus.material.purchase.dto.PurchaseDto;
|
||||||
import com.bonus.material.purchase.mapper.PurchaseBindMapper;
|
import com.bonus.material.purchase.mapper.PurchaseBindMapper;
|
||||||
import com.bonus.material.purchase.service.IPurchaseBindService;
|
import com.bonus.material.purchase.service.IPurchaseBindService;
|
||||||
import com.bonus.material.purchase.vo.PurchaseVo;
|
import com.bonus.material.purchase.vo.PurchaseVo;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import com.bonus.system.api.RemoteUserService;
|
import com.bonus.system.api.RemoteUserService;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
|
@ -26,6 +27,7 @@ import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
|
@ -43,6 +45,9 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
@Resource
|
@Resource
|
||||||
private RemoteUserService remoteUserService;
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TmTaskMapper tmTaskMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有绑定信息
|
* 查询所有绑定信息
|
||||||
* @param dto
|
* @param dto
|
||||||
|
|
@ -109,7 +114,9 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
if (dto == null || dto.getTaskId() == null || dto.getTypeId() == null) {
|
if (dto == null || dto.getTaskId() == null || dto.getTypeId() == null) {
|
||||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "参数不能为空");
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "参数不能为空");
|
||||||
}
|
}
|
||||||
return AjaxResult.success(purchaseBindMapper.selectPurchaseCheckInfoById(dto));
|
List<PurchaseVo> list = purchaseBindMapper.selectPurchaseCheckInfoById(dto);
|
||||||
|
extracted(list);
|
||||||
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -145,6 +152,8 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
for (PurchaseDto purchaseDto : dto.getDtoList()) {
|
for (PurchaseDto purchaseDto : dto.getDtoList()) {
|
||||||
purchaseDto.setCreateBy(SecurityUtils.getUserId().toString());
|
purchaseDto.setCreateBy(SecurityUtils.getUserId().toString());
|
||||||
purchaseDto.setCreateTime(DateUtils.getNowDate());
|
purchaseDto.setCreateTime(DateUtils.getNowDate());
|
||||||
|
purchaseDto.setTaskId(dto.getTaskId());
|
||||||
|
purchaseDto.setTypeId(dto.getTypeId());
|
||||||
result += purchaseBindMapper.add(purchaseDto);
|
result += purchaseBindMapper.add(purchaseDto);
|
||||||
}
|
}
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
@ -181,6 +190,78 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驳回或批量驳回操作
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult reject(PurchaseDto dto) {
|
||||||
|
//一级页面驳回
|
||||||
|
int result = 0;
|
||||||
|
if (dto.getTaskId() != null) {
|
||||||
|
//根据任务id查询详细信息
|
||||||
|
List<PurchaseVo> list = purchaseBindMapper.selectPurchaseCheckInfoById(dto);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (PurchaseVo purchaseVo : list) {
|
||||||
|
//更新状态为已驳回
|
||||||
|
purchaseBindMapper.updateStatusById(MaterialConstants.SEVEN_CONSTANT, purchaseVo.getPurchaseId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result += tmTaskMapper.updateStatusById(MaterialConstants.SEVEN_CONSTANT, dto.getTaskId());
|
||||||
|
}
|
||||||
|
//二级页面驳回
|
||||||
|
if (dto.getPurchaseId() != null) {
|
||||||
|
List<String> idList = Arrays.asList(dto.getPurchaseId().split(","));
|
||||||
|
for (String purchaseId : idList) {
|
||||||
|
purchaseBindMapper.updateStatusById(MaterialConstants.SEVEN_CONSTANT, purchaseId);
|
||||||
|
}
|
||||||
|
for (String id : idList) {
|
||||||
|
//根据二级页面驳回状态更新任务状态
|
||||||
|
dto.setPurchaseId(id);
|
||||||
|
List<PurchaseVo> list = purchaseBindMapper.selectPurchaseCheckInfoById(dto);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (PurchaseVo purchaseVo : list) {
|
||||||
|
dto.setTaskId(purchaseVo.getTaskId().toString());
|
||||||
|
List<PurchaseVo> voList = purchaseBindMapper.selectPurchaseCheckInfoById(dto);
|
||||||
|
result = getResult(result, voList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result > 0) {
|
||||||
|
return AjaxResult.success("操作成功");
|
||||||
|
}
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取结果方法抽取
|
||||||
|
* @param result
|
||||||
|
* @param voList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getResult(int result, List<PurchaseVo> voList) {
|
||||||
|
Map<Integer, List<Integer>> groupedByIdStatus = voList.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
PurchaseVo::getTaskId,
|
||||||
|
Collectors.mapping(PurchaseVo::getStatus, Collectors.toList())
|
||||||
|
));
|
||||||
|
result += groupedByIdStatus.entrySet().stream()
|
||||||
|
.mapToInt(entry -> {
|
||||||
|
Integer taskId = entry.getKey();
|
||||||
|
List<Integer> statusList = entry.getValue();
|
||||||
|
if (statusList.contains(MaterialConstants.INBOUND_AUDIT) || statusList.contains(MaterialConstants.PURCHASE_STORAGE_NO_PASSED)) {
|
||||||
|
return tmTaskMapper.updateStatusById(MaterialConstants.NINE_CONSTANT, taskId.toString());
|
||||||
|
} else if (!statusList.contains(MaterialConstants.INBOUND_AUDIT) && !statusList.contains(MaterialConstants.PURCHASE_STORAGE_NO_PASSED)
|
||||||
|
&& !statusList.contains(MaterialConstants.PARTIALLY_WAREHOUSED) && statusList.contains(MaterialConstants.INVENTORY)) {
|
||||||
|
return tmTaskMapper.updateStatusById(MaterialConstants.FOUR_CONSTANT, taskId.toString());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}).sum();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内层二维码下载
|
* 内层二维码下载
|
||||||
* @param purchaseDto
|
* @param purchaseDto
|
||||||
|
|
|
||||||
|
|
@ -266,10 +266,10 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
Integer id = entry.getKey();
|
Integer id = entry.getKey();
|
||||||
List<Integer> statusList = entry.getValue();
|
List<Integer> statusList = entry.getValue();
|
||||||
if (statusList.contains(MaterialConstants.INBOUND_AUDIT) || statusList.contains(MaterialConstants.PURCHASE_STORAGE_NO_PASSED)) {
|
if (statusList.contains(MaterialConstants.INBOUND_AUDIT) || statusList.contains(MaterialConstants.PURCHASE_STORAGE_NO_PASSED)) {
|
||||||
return tmTaskMapper.updateStatusById(MaterialConstants.PARTIALLY_WAREHOUSED, id);
|
return tmTaskMapper.updateStatusById(MaterialConstants.NINE_CONSTANT, id.toString());
|
||||||
} else if (!statusList.contains(MaterialConstants.INBOUND_AUDIT) && !statusList.contains(MaterialConstants.PURCHASE_STORAGE_NO_PASSED)
|
} else if (!statusList.contains(MaterialConstants.INBOUND_AUDIT) && !statusList.contains(MaterialConstants.PURCHASE_STORAGE_NO_PASSED)
|
||||||
&& !statusList.contains(MaterialConstants.PARTIALLY_WAREHOUSED) && statusList.contains(MaterialConstants.INVENTORY)) {
|
&& !statusList.contains(MaterialConstants.PARTIALLY_WAREHOUSED) && statusList.contains(MaterialConstants.INVENTORY)) {
|
||||||
return tmTaskMapper.updateStatusById(MaterialConstants.INVENTORY, id);
|
return tmTaskMapper.updateStatusById(MaterialConstants.FOUR_CONSTANT, id.toString());
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}).sum();
|
}).sum();
|
||||||
|
|
|
||||||
|
|
@ -107,4 +107,7 @@ public class PurchaseVo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "二维码路径")
|
@ApiModelProperty(value = "二维码路径")
|
||||||
private String qrUrl;
|
private String qrUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "异常数量")
|
||||||
|
private Integer exceptionNum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,5 +73,5 @@ public interface TmTaskMapper {
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") Integer id);
|
int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
GROUP_CONCAT( mt.type_name ) AS purchaseMaterial,
|
GROUP_CONCAT( mt.type_name ) AS purchaseMaterial,
|
||||||
GROUP_CONCAT( mt.manage_type ) AS manageType,
|
GROUP_CONCAT( mt.manage_type ) AS manageType,
|
||||||
SUM( pcd.check_num ) AS purchaseNum,
|
SUM( pcd.check_num ) AS purchaseNum,
|
||||||
|
COUNT(CASE WHEN pcd.status != 3 THEN 1 END) AS exceptionNum,
|
||||||
pci.purchaser as purchaserName,
|
pci.purchaser as purchaserName,
|
||||||
pci.create_by as createBy,
|
pci.create_by as createBy,
|
||||||
pci.create_time as createTime,
|
pci.create_time as createTime,
|
||||||
|
|
@ -171,7 +172,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
pm.out_fac_code AS outFacCode,
|
pm.out_fac_code AS outFacCode,
|
||||||
pcd.production_time AS productDate,
|
pcd.production_time AS productDate,
|
||||||
pm.qr_code AS qrCode,
|
pm.qr_code AS qrCode,
|
||||||
pm.qr_url AS qrUrl
|
pm.qr_url AS qrUrl,
|
||||||
|
pcd.status AS status
|
||||||
FROM
|
FROM
|
||||||
purchase_macode_info pm
|
purchase_macode_info pm
|
||||||
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id
|
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id
|
||||||
|
|
@ -188,6 +190,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="purchaseId != null">
|
<if test="purchaseId != null">
|
||||||
AND pcd.id = #{purchaseId}
|
AND pcd.id = #{purchaseId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
pm.ma_code LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
OR pm.out_fac_code LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
OR pm.qr_code LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDetails" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
<select id="getDetails" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue