新购绑定
This commit is contained in:
parent
246b482bc2
commit
2bed78391e
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.bonus.material.purchase.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.common.security.annotation.PreventRepeatSubmit;
|
||||||
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.material.purchase.dto.PurchaseDto;
|
||||||
|
import com.bonus.material.purchase.service.IPurchaseBindService;
|
||||||
|
import com.bonus.material.purchase.vo.PurchaseVo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新购验收绑定接口
|
||||||
|
* @Author ma_sh
|
||||||
|
* @create 2024/10/21 18:41
|
||||||
|
*/
|
||||||
|
@Api(tags = "新购验收绑定接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/purchase/bind")
|
||||||
|
public class PurchaseBindController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPurchaseBindService purchaseBindService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级分页查询
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询新购验收绑定详细列表")
|
||||||
|
@RequiresPermissions("purchase:bind:list")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public TableDataInfo getList(PurchaseDto dto) {
|
||||||
|
startPage();
|
||||||
|
List<PurchaseVo> list = purchaseBindService.selectAll(dto);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新购绑定二级明细列表
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取新购绑定二级明细列表")
|
||||||
|
@RequiresPermissions("purchase:bind:details")
|
||||||
|
@GetMapping("/details")
|
||||||
|
public TableDataInfo getDetails(PurchaseDto dto) {
|
||||||
|
startPage();
|
||||||
|
List<PurchaseVo> list = purchaseBindService.getDetails(dto);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "编码绑定")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("purchase:bind:add")
|
||||||
|
@PostMapping("/bind")
|
||||||
|
public AjaxResult bind(@RequestBody PurchaseDto dto) {
|
||||||
|
return purchaseBindService.bind(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新购验收绑定详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取新购验收绑定详细信息")
|
||||||
|
@RequiresPermissions("purchase:bind:query")
|
||||||
|
@GetMapping(value = "/getById")
|
||||||
|
public AjaxResult getInfo(PurchaseDto dto) {
|
||||||
|
return AjaxResult.success(purchaseBindService.selectPurchaseCheckInfoById(dto));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.material.purchase.dto;
|
package com.bonus.material.purchase.dto;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -10,10 +11,10 @@ import java.util.List;
|
||||||
* @create 2024/10/21 13:58
|
* @create 2024/10/21 13:58
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class PurchaseDto {
|
public class PurchaseDto extends BaseEntity {
|
||||||
|
|
||||||
@ApiModelProperty(value = "id")
|
@ApiModelProperty(value = "id")
|
||||||
private String id;
|
private String taskId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "类型id")
|
@ApiModelProperty(value = "类型id")
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
|
|
@ -44,4 +45,22 @@ public class PurchaseDto {
|
||||||
|
|
||||||
@ApiModelProperty(value = "id列表")
|
@ApiModelProperty(value = "id列表")
|
||||||
private List<Integer> taskIds;
|
private List<Integer> taskIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机具编号")
|
||||||
|
private String maCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出厂编号")
|
||||||
|
private String outFacCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "二维码")
|
||||||
|
private String qrCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "二维码路径")
|
||||||
|
private String qrUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否下载二维码 (0 否,1 是)")
|
||||||
|
private String isDownload;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "提交绑定数据集合")
|
||||||
|
private List<PurchaseDto> dtoList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.bonus.material.purchase.mapper;
|
||||||
|
|
||||||
|
import com.bonus.material.purchase.dto.PurchaseDto;
|
||||||
|
import com.bonus.material.purchase.vo.PurchaseVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ma_sh
|
||||||
|
* @create 2024/10/21 18:43
|
||||||
|
*/
|
||||||
|
public interface PurchaseBindMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseVo> selectAll(PurchaseDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询绑定信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseVo> selectPurchaseCheckInfoById(PurchaseDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取绑定信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseVo> getDetails(PurchaseDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询
|
||||||
|
* @param purchaseDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseDto> selectByCode(PurchaseDto purchaseDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增绑定信息
|
||||||
|
* @param purchaseDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int add(PurchaseDto purchaseDto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.bonus.material.purchase.service;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.purchase.dto.PurchaseDto;
|
||||||
|
import com.bonus.material.purchase.vo.PurchaseVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ma_sh
|
||||||
|
* @create 2024/10/21 18:42
|
||||||
|
*/
|
||||||
|
public interface IPurchaseBindService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseVo> selectAll(PurchaseDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询采购绑定信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseVo> selectPurchaseCheckInfoById(PurchaseDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新购绑定二级明细列表
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseVo> getDetails(PurchaseDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult bind(PurchaseDto dto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.bonus.material.purchase.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.constant.MaterialConstants;
|
||||||
|
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.material.purchase.dto.PurchaseDto;
|
||||||
|
import com.bonus.material.purchase.mapper.PurchaseBindMapper;
|
||||||
|
import com.bonus.material.purchase.service.IPurchaseBindService;
|
||||||
|
import com.bonus.material.purchase.vo.PurchaseVo;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ma_sh
|
||||||
|
* @create 2024/10/21 18:42
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PurchaseBindMapper purchaseBindMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有绑定信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<PurchaseVo> selectAll(PurchaseDto dto) {
|
||||||
|
List<PurchaseVo> list = purchaseBindMapper.selectAll(dto);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
Iterator<PurchaseVo> iterator = list.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
PurchaseVo purchaseVo = iterator.next();
|
||||||
|
String[] split = purchaseVo.getManageType().split(",");
|
||||||
|
// 检查是否全部为 1
|
||||||
|
boolean allOnes = true;
|
||||||
|
for (String manageType : split) {
|
||||||
|
if (!MaterialConstants.ONE_CONSTANT.equals(manageType.trim())) {
|
||||||
|
allOnes = false;
|
||||||
|
// 发现不是 1,跳出循环
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果全部为 1,移除该记录
|
||||||
|
if (allOnes) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询绑定信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<PurchaseVo> selectPurchaseCheckInfoById(PurchaseDto dto) {
|
||||||
|
return purchaseBindMapper.selectPurchaseCheckInfoById(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新购绑定二级明细列表
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<PurchaseVo> getDetails(PurchaseDto dto) {
|
||||||
|
return purchaseBindMapper.getDetails(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult bind(PurchaseDto dto) {
|
||||||
|
//先查询提交的编码中是否存在重复提交
|
||||||
|
long distinctCodes = dto.getDtoList().stream().map(PurchaseDto::getMaCode).distinct().count();
|
||||||
|
if (distinctCodes < dto.getDtoList().size()) {
|
||||||
|
return AjaxResult.error(1113,"提交的数据中设备编码存在重复,请勿重复添加");
|
||||||
|
}
|
||||||
|
for (PurchaseDto purchaseDto : dto.getDtoList()) {
|
||||||
|
//根据设备编码唯一校验
|
||||||
|
List<PurchaseDto> tbBdDeviceRecord = purchaseBindMapper.selectByCode(purchaseDto);
|
||||||
|
if (CollectionUtils.isNotEmpty(tbBdDeviceRecord)) {
|
||||||
|
return AjaxResult.error(1114,"设备编码与库中重复,请勿重复添加");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int result = 0;
|
||||||
|
for (PurchaseDto purchaseDto : dto.getDtoList()) {
|
||||||
|
purchaseDto.setCreateBy(SecurityUtils.getUserId().toString());
|
||||||
|
purchaseDto.setCreateTime(DateUtils.getNowDate());
|
||||||
|
result += purchaseBindMapper.add(purchaseDto);
|
||||||
|
}
|
||||||
|
if (result > 0) {
|
||||||
|
return AjaxResult.success("绑定成功");
|
||||||
|
}
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ import static com.bonus.common.biz.constant.MaterialConstants.ZERO_CONSTANT;
|
||||||
* @create 2024/10/21 13:53
|
* @create 2024/10/21 13:53
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class IPurchaseStorageServiceImpl implements IPurchaseStorageService {
|
public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PurchaseStorageMapper purchaseStorageMapper;
|
private PurchaseStorageMapper purchaseStorageMapper;
|
||||||
|
|
@ -149,7 +149,9 @@ public class IPurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
dto.setId(String.valueOf(taskId));
|
dto.setId(String.valueOf(taskId));
|
||||||
List<PurchaseVo> details;
|
List<PurchaseVo> details;
|
||||||
details = purchaseStorageMapper.getDetails(dto);
|
details = purchaseStorageMapper.getDetails(dto);
|
||||||
result += updateDetailsAndStatus(details);
|
for (PurchaseVo purchaseVo : details) {
|
||||||
|
result += purchaseStorageMapper.updateStatusById(MaterialConstants.PURCHASE_STORAGE_NO_PASSED, Integer.parseInt(purchaseVo.getPurchaseId()));
|
||||||
|
}
|
||||||
details = purchaseStorageMapper.getDetails(dto);
|
details = purchaseStorageMapper.getDetails(dto);
|
||||||
result += updateTaskStatus(details);
|
result += updateTaskStatus(details);
|
||||||
}
|
}
|
||||||
|
|
@ -215,9 +217,7 @@ public class IPurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
dto.setId(String.valueOf(taskId));
|
dto.setId(String.valueOf(taskId));
|
||||||
List<PurchaseVo> details;
|
List<PurchaseVo> details;
|
||||||
details = purchaseStorageMapper.getDetails(dto);
|
details = purchaseStorageMapper.getDetails(dto);
|
||||||
for (PurchaseVo purchaseVo : details) {
|
result += updateDetailsAndStatus(details);
|
||||||
result += purchaseStorageMapper.updateStatusById(MaterialConstants.PURCHASE_STORAGE_NO_PASSED, Integer.parseInt(purchaseVo.getPurchaseId()));
|
|
||||||
}
|
|
||||||
details = purchaseStorageMapper.getDetails(dto);
|
details = purchaseStorageMapper.getDetails(dto);
|
||||||
result += updateTaskStatus(details);
|
result += updateTaskStatus(details);
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ import java.util.Date;
|
||||||
public class PurchaseVo {
|
public class PurchaseVo {
|
||||||
|
|
||||||
@ApiModelProperty(value="任务id")
|
@ApiModelProperty(value="任务id")
|
||||||
private Integer id;
|
private Integer taskId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "二级明细id")
|
@ApiModelProperty(value = "二级明细id")
|
||||||
private String purchaseId;
|
private String purchaseId;
|
||||||
|
|
@ -95,4 +95,13 @@ public class PurchaseVo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "采购人")
|
@ApiModelProperty(value = "采购人")
|
||||||
private String purchaserName;
|
private String purchaserName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机具编号")
|
||||||
|
private String maCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出厂编号")
|
||||||
|
private String outFacCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "二维码")
|
||||||
|
private String qrCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,193 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bonus.material.purchase.mapper.PurchaseBindMapper">
|
||||||
|
|
||||||
|
<insert id="insertMachine">
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="add">
|
||||||
|
insert into purchase_macode_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">task_id,</if>
|
||||||
|
<if test="typeId != null">type_id,</if>
|
||||||
|
<if test="maCode != null">ma_code,</if>
|
||||||
|
<if test="qrCode != null">qr_code,</if>
|
||||||
|
<if test="fixCode != null">fix_code,</if>
|
||||||
|
<if test="codeType != null">code_type,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="companyId != null">company_id,</if>
|
||||||
|
<if test="outFacCode != null">out_fac_code,</if>
|
||||||
|
<if test="qrUrl != null">qr_url,</if>
|
||||||
|
del_flag
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">#{taskId},</if>
|
||||||
|
<if test="typeId != null">#{typeId},</if>
|
||||||
|
<if test="maCode != null">#{maCode},</if>
|
||||||
|
<if test="qrCode != null">#{qrCode},</if>
|
||||||
|
<if test="fixCode != null">#{fixCode},</if>
|
||||||
|
<if test="codeType != null">#{codeType},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="companyId != null">#{companyId},</if>
|
||||||
|
<if test="outFacCode != null">#{outFacCode},</if>
|
||||||
|
<if test="qrUrl != null">#{qrUrl},</if>
|
||||||
|
0
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateNum">
|
||||||
|
UPDATE purchase_check_details
|
||||||
|
SET input_num = #{purchaseNum}
|
||||||
|
WHERE
|
||||||
|
id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateStatusById">
|
||||||
|
UPDATE purchase_check_details
|
||||||
|
SET `status` = #{updatedStatus}
|
||||||
|
WHERE
|
||||||
|
id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateStorageNum">
|
||||||
|
UPDATE ma_type
|
||||||
|
SET storage_num = #{inputNum} + IFNULL(storage_num, 0)
|
||||||
|
WHERE
|
||||||
|
type_id = #{typeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectAll" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
|
SELECT
|
||||||
|
pci.task_id as taskId,
|
||||||
|
pci.arrival_time as arrivalTime,
|
||||||
|
tt.`code` as purchaseCode,
|
||||||
|
GROUP_CONCAT( mt.type_name ) AS purchaseMaterial,
|
||||||
|
GROUP_CONCAT( mt.manage_type ) AS manageType,
|
||||||
|
SUM( pcd.check_num ) AS purchaseNum,
|
||||||
|
pci.purchaser as purchaserName,
|
||||||
|
pci.create_by as createBy,
|
||||||
|
pci.create_time as createTime,
|
||||||
|
tt.task_status as STATUS,
|
||||||
|
pci.remark as remark
|
||||||
|
FROM
|
||||||
|
purchase_check_info pci
|
||||||
|
LEFT JOIN purchase_check_details pcd ON pcd.task_id = pci.task_id
|
||||||
|
LEFT JOIN tm_task tt ON pci.task_id = tt.task_id
|
||||||
|
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||||
|
where 1 = 1
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
<![CDATA[ AND DATE_FORMAT( pci.arrival_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||||
|
</if>
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
tt.`code` LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
OR pci.remark LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND pcd.`status` = #{status}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
pci.task_id
|
||||||
|
ORDER BY
|
||||||
|
pci.arrival_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPurchaseCheckInfoById" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
|
SELECT
|
||||||
|
pm.task_id AS taskId,
|
||||||
|
mt1.type_name AS materialName,
|
||||||
|
mt.type_name AS materialModel,
|
||||||
|
pm.ma_code AS maCode,
|
||||||
|
pm.create_by AS createBy,
|
||||||
|
pm.create_time AS createTime,
|
||||||
|
pm.type_id AS typeId,
|
||||||
|
pm.out_fac_code AS outFacCode,
|
||||||
|
pcd.production_time AS productDate,
|
||||||
|
pm.qr_code AS qrCode
|
||||||
|
FROM
|
||||||
|
purchase_macode_info pm
|
||||||
|
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id
|
||||||
|
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
<if test="taskId != null and taskId != ''">
|
||||||
|
AND pm.task_id = #{taskId}
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
AND pm.type_id = #{typeId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDetails" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
|
SELECT
|
||||||
|
pcd.task_id AS taskId,
|
||||||
|
pcd.id AS purchaseId,
|
||||||
|
mt1.type_name AS materialName,
|
||||||
|
mt.type_name AS materialModel,
|
||||||
|
pcd.check_num AS purchaseNum,
|
||||||
|
pcd.check_num AS checkNum,
|
||||||
|
pcd.bind_num AS bindNum,
|
||||||
|
pcd.type_id as typeId,
|
||||||
|
mt.unit_name AS unitName,
|
||||||
|
ms.supplier AS supplierName,
|
||||||
|
pcd.production_time AS productDate,
|
||||||
|
mt.manage_type AS manageType,
|
||||||
|
pcd.`status` AS STATUS
|
||||||
|
FROM
|
||||||
|
purchase_check_details pcd
|
||||||
|
LEFT JOIN tm_task tt ON pcd.task_id = tt.task_id
|
||||||
|
LEFT JOIN purchase_check_info pci ON pci.task_id = pcd.task_id
|
||||||
|
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||||
|
LEFT JOIN ma_supplier_info ms ON pcd.supplier_id = ms.supplier_id
|
||||||
|
where 1 = 1
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
AND mt.id = #{typeId}
|
||||||
|
</if>
|
||||||
|
<if test="supplierId != null and supplierId != ''">
|
||||||
|
AND ms.supplier_id = #{supplierId}
|
||||||
|
</if>
|
||||||
|
<if test="productDate != null and productDate != ''">
|
||||||
|
<![CDATA[ AND DATE_FORMAT( pcd.production_time, '%Y-%m-%d' ) = #{productDate} ]]>
|
||||||
|
</if>
|
||||||
|
<if test="taskId != null">
|
||||||
|
AND pcd.task_id = #{taskId}
|
||||||
|
</if>
|
||||||
|
<if test="purchaseId != null">
|
||||||
|
AND pcd.id = #{purchaseId}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
pcd.type_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="select" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
|
SELECT
|
||||||
|
pcd.task_id as taskId,
|
||||||
|
pcd.status as STATUS
|
||||||
|
FROM
|
||||||
|
purchase_check_details pcd
|
||||||
|
where pcd.task_id = #{taskId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByCode" resultType="com.bonus.material.purchase.dto.PurchaseDto">
|
||||||
|
SELECT
|
||||||
|
task_id as taskId,
|
||||||
|
type_id as typeId,
|
||||||
|
ma_code as maCode
|
||||||
|
FROM
|
||||||
|
purchase_macode_info
|
||||||
|
where del_flag = '0' and ma_code = #{maCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -10,7 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<update id="updateNum">
|
<update id="updateNum">
|
||||||
UPDATE purchase_check_details
|
UPDATE purchase_check_details
|
||||||
SET input_num = #{purchaseNum}
|
SET input_num = #{purchaseNum},
|
||||||
|
input_time = now()
|
||||||
WHERE
|
WHERE
|
||||||
id = #{id}
|
id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -31,11 +32,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectAll" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
<select id="selectAll" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
SELECT
|
SELECT
|
||||||
pci.task_id as id,
|
pci.task_id as taskId,
|
||||||
pci.arrival_time as arrivalTime,
|
pci.arrival_time as arrivalTime,
|
||||||
tt.`code` as purchaseCode,
|
tt.`code` as purchaseCode,
|
||||||
GROUP_CONCAT( mt.type_name ) AS purchaseMaterial,
|
GROUP_CONCAT( mt.type_name ) AS purchaseMaterial,
|
||||||
SUM( pcd.check_num ) AS purchaseNum,
|
COALESCE(SUM(pcd.bind_num), SUM(pcd.check_num)) AS purchaseNum,
|
||||||
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,
|
||||||
|
|
@ -67,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectPurchaseCheckInfoById" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
<select id="selectPurchaseCheckInfoById" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
SELECT
|
SELECT
|
||||||
pci.task_id as id,
|
pci.task_id as taskId,
|
||||||
mt1.type_name AS materialName,
|
mt1.type_name AS materialName,
|
||||||
mt.type_name AS materialModel,
|
mt.type_name AS materialModel,
|
||||||
pcd.check_num AS purchaseNum,
|
pcd.check_num AS purchaseNum,
|
||||||
|
|
@ -91,8 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="getDetails" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
<select id="getDetails" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
SELECT
|
SELECT
|
||||||
|
pcd.task_id AS taskId,
|
||||||
pcd.id AS purchaseId,
|
pcd.id AS purchaseId,
|
||||||
pcd.task_id AS id,
|
|
||||||
mt1.type_name AS materialName,
|
mt1.type_name AS materialName,
|
||||||
mt.type_name AS materialModel,
|
mt.type_name AS materialModel,
|
||||||
pcd.check_num AS purchaseNum,
|
pcd.check_num AS purchaseNum,
|
||||||
|
|
@ -121,17 +122,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="productDate != null and productDate != ''">
|
<if test="productDate != null and productDate != ''">
|
||||||
<![CDATA[ AND DATE_FORMAT( pcd.production_time, '%Y-%m-%d' ) = #{productDate} ]]>
|
<![CDATA[ AND DATE_FORMAT( pcd.production_time, '%Y-%m-%d' ) = #{productDate} ]]>
|
||||||
</if>
|
</if>
|
||||||
<if test="id != null and id != ''">
|
<if test="taskId != null">
|
||||||
AND pcd.task_id = #{id}
|
AND pcd.task_id = #{taskId}
|
||||||
</if>
|
</if>
|
||||||
<if test="purchaseId != null and purchaseId != ''">
|
<if test="purchaseId != null">
|
||||||
AND pcd.id = #{purchaseId}
|
AND pcd.id = #{purchaseId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="select" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
<select id="select" resultType="com.bonus.material.purchase.vo.PurchaseVo">
|
||||||
SELECT
|
SELECT
|
||||||
pcd.task_id as id,
|
pcd.task_id as taskId,
|
||||||
pcd.status as STATUS
|
pcd.status as STATUS
|
||||||
FROM
|
FROM
|
||||||
purchase_check_details pcd
|
purchase_check_details pcd
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue