新购配件

This commit is contained in:
bns_han 2024-01-17 18:28:39 +08:00
parent 2dcc9c5eb6
commit d9e2109ddb
7 changed files with 532 additions and 37 deletions

View File

@ -72,6 +72,17 @@ public class BackApplyController extends BaseController {
return getDataTable(list);
}
/**
* 退料申请详情--用于退料单不带分页
*/
@ApiOperation(value = "退料单")
@GetMapping("/materialReturnNote")
public AjaxResult materialReturnNote(BackApplyInfo bean)
{
List<BackApplyInfo> list = backApplyService.getView(bean);
return success(list);
}
/**
* 退料申请详情修改
*/

View File

@ -1,23 +1,19 @@
package com.bonus.sgzb.material.controller;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.material.domain.PurchaseCheckDetails;
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
import com.bonus.sgzb.material.domain.PurchaseInput;
import com.bonus.sgzb.material.domain.PurchasePartDetails;
import com.bonus.sgzb.material.domain.PurchasePartInfo;
import com.bonus.sgzb.material.service.IPurchaseAccessoryService;
import com.bonus.sgzb.material.service.IPurchaseCheckInfoService;
import com.bonus.sgzb.material.vo.NoticeInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -33,6 +29,29 @@ public class PurchaseAccessoryController extends BaseController
@Autowired
private IPurchaseAccessoryService purchaseAccessoryService;
/**
* 查询新购配件任务验收列表
*/
@ApiOperation("查询新购配件任务验收列表")
@GetMapping("/list")
public TableDataInfo list(PurchasePartInfo purchasePartInfo)
{
startPage();
List<PurchasePartInfo> list = purchaseAccessoryService.selectPurchasePartInfoList(purchasePartInfo);
return getDataTable(list);
}
/**
* 获取新购配件任务验收详细信息
*/
@ApiOperation("获取新购配件任务验收详细信息")
@GetMapping(value = "/getDetails")
public AjaxResult getInfo(@RequestParam(required = false) Long taskId,
@RequestParam(required = false) String keyWord)
{
return success(purchaseAccessoryService.selectPurchasePartInfoByTaskId(taskId,keyWord));
}
/**
* 新增新购配件任务
*/
@ -44,4 +63,49 @@ public class PurchaseAccessoryController extends BaseController
return toAjax(purchaseAccessoryService.insertPurchaseAccessory(purchasePartInfo));
}
/**
* 修改新购配件任务
*/
@ApiOperation("修改新购配件任务")
@Log(title = "修改新购配件任务", businessType = BusinessType.UPDATE)
@PostMapping(value = "/edit")
public AjaxResult edit(@RequestBody PurchasePartInfo purchasePartInfo){
return toAjax(purchaseAccessoryService.updatePurchaseCheckInfo(purchasePartInfo));
}
/**
* 删除新购配件任务
*/
@ApiOperation("删除新购配件任务")
@Log(title = "删除新购配件任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{taskIds}")
public AjaxResult remove(@PathVariable Long[] taskIds)
{
return purchaseAccessoryService.deletePurchasePartInfoByTaskIds(taskIds);
}
/**
* 新购配件验收
*/
@ApiOperation(value = "新购配件验收")
@Log(title = "新购配件验收", businessType = BusinessType.UPDATE)
@PostMapping(value = "/check")
public AjaxResult check(@RequestBody List<PurchasePartDetails> purchasePartDetailsList)
{
return toAjax(purchaseAccessoryService.updatePurchaseCheckDetails(purchasePartDetailsList));
}
/**
* 查询新购配件入库任务列表
*/
@ApiOperation("查询新购配件入库任务列表")
@GetMapping("/putInList")
public TableDataInfo putInList(PurchasePartInfo purchasePartInfo)
{
startPage();
List<PurchasePartInfo> list = purchaseAccessoryService.selectPutInListList(purchasePartInfo);
return getDataTable(list);
}
}

View File

@ -77,6 +77,16 @@ public class PurchaseMacodeInfoController extends BaseController
return getDataTable(purchaseMacodeInfoService.selectPutinDetails(purchaseMacodeInfo));
}
/**
* 获取新购验收编号管理详细信息--用于入库单不带分页
*/
@ApiOperation(value = "入库单")
@GetMapping(value = "/warehousingEntry")
public AjaxResult warehousingEntry(PurchaseMacodeInfo purchaseMacodeInfo)
{
return success(purchaseMacodeInfoService.selectPutinDetails(purchaseMacodeInfo));
}
/**
* 新增新购验收编号管理
*/

View File

@ -32,4 +32,44 @@ public interface PurchaseAccessoryMapper
* @date 2024/1/16 14:05
*/
int insertPurchasePartDetailsList(@Param("purchasePartDetailsList") List<PurchasePartDetails> purchasePartDetailsList);
List<PurchasePartInfo> selectPurchasePartInfoList(PurchasePartInfo purchasePartInfo);
String selectTypeNameByTaskId(Long taskId);
PurchasePartInfo selectPurchasePartInfoByTaskId(Long taskId);
List<PurchasePartDetails> selectPurchasePartDetailsList(PurchasePartDetails purchasePartDetails);
/**
* 先删除全部的任务详情信息
* @param taskId
* @return int
*/
int deletePartDetailsByTaskId(Long taskId);
/**
* 修改新购配件任务purchase_part_info
* @param purchasePartInfo
* @return int
*/
int updatePurchasePartInfo(PurchasePartInfo purchasePartInfo);
/**
* 删除新购配件任务
* @param taskIds
* @return int
*/
int deletePurchasePartInfoByTaskIds(Long[] taskIds);
/**
* 新购配件入库列表
* @param purchasePartInfo
* @return List<PurchasePartInfo>
*/
List<PurchasePartInfo> selectPutInListList(PurchasePartInfo purchasePartInfo);
int updatePurchasePartDetails(PurchasePartDetails purchasePartDetails);
int selectPurchasePartDetailsStatus(Long taskId);
}

View File

@ -1,7 +1,9 @@
package com.bonus.sgzb.material.service;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
import com.bonus.sgzb.material.domain.PurchaseInput;
import com.bonus.sgzb.material.domain.PurchasePartDetails;
import com.bonus.sgzb.material.domain.PurchasePartInfo;
import com.bonus.sgzb.material.vo.NoticeInfoVO;
@ -21,4 +23,43 @@ public interface IPurchaseAccessoryService
*/
public int insertPurchaseAccessory(PurchasePartInfo purchasePartInfo);
/**
* 查询新购配件任务purchase_part_info列表
*
* @param purchasePartInfo 新购配件任务purchase_part_info
* @return 新购配件任务purchase_part_info集合
*/
List<PurchasePartInfo> selectPurchasePartInfoList(PurchasePartInfo purchasePartInfo);
/**
* 查询新购配件任务purchase_part_info
*
* @param taskId 新购配件任务purchase_part_info主键
* @return 新购配件任务purchase_part_info
*/
PurchasePartInfo selectPurchasePartInfoByTaskId(Long taskId, String keyWord);
/**
* 修改新购配件任务purchase_part_info
*
* @param purchasePartInfo 新购配件任务purchase_part_info
* @return 结果
*/
int updatePurchaseCheckInfo(PurchasePartInfo purchasePartInfo);
/**
* 删除新购配件任务
* @param taskIds
* @return int
*/
AjaxResult deletePurchasePartInfoByTaskIds(Long[] taskIds);
/**
* 新购配件入库列表
* @param purchasePartInfo
* @return List<PurchasePartInfo>
*/
List<PurchasePartInfo> selectPutInListList(PurchasePartInfo purchasePartInfo);
int updatePurchaseCheckDetails(List<PurchasePartDetails> purchasePartDetailsList);
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.mapper.PurchaseAccessoryMapper;
@ -20,11 +21,10 @@ import java.util.Date;
import java.util.List;
/**
* 新购验收任务Service业务层处理
*
* @author bonus
* @date 2023-12-10
*/
* @description 新购配件任务Service业务层处理
* @author hay
* @date 2024/1/17 16:42
*/
@Service
public class PurchaseAccessoryServiceImpl implements IPurchaseAccessoryService
{
@ -40,34 +40,178 @@ public class PurchaseAccessoryServiceImpl implements IPurchaseAccessoryService
* @return 结果
*/
@Override
@Transactional
public int insertPurchaseAccessory(PurchasePartInfo purchasePartInfo)
{
TmTask task = new TmTask();
// 暂定的状态字典表
task.setTaskType(67);
task.setTaskStatus(68);
// 采购单号
task.setCode(purchaseCodeRule());
task.setCreateTime(DateUtils.getNowDate());
task.setCompanyId(purchasePartInfo.getCompanyId());
task.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
// 创建任务信息
taskMapper.insertTmTask(task);
purchasePartInfo.setTaskId(task.getTaskId());
purchasePartInfo.setCreateTime(DateUtils.getNowDate());
// 批量新增新购任务详情信息
List<PurchasePartDetails> partDetailsList = purchasePartInfo.getPartDetailsList();
if (partDetailsList != null) {
for (PurchasePartDetails purchasePartDetails : partDetailsList) {
purchasePartDetails.setTaskId(task.getTaskId());
// purchaseCheckDetails.setStatus(2);
@Transactional(rollbackFor = Exception.class)
public int insertPurchaseAccessory(PurchasePartInfo purchasePartInfo) {
int res = 0;
try {
TmTask task = new TmTask();
// 暂定的状态字典表
task.setTaskType(67);
task.setTaskStatus(68);
// 采购单号
task.setCode(purchaseCodeRule());
task.setCreateTime(DateUtils.getNowDate());
task.setCompanyId(purchasePartInfo.getCompanyId());
task.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
// 创建任务信息
res = taskMapper.insertTmTask(task);
if (res == 0) {
throw new RuntimeException("新增失败,创建任务未成功");
}
purchaseAccessoryMapper.insertPurchasePartDetailsList(partDetailsList);
purchasePartInfo.setTaskId(task.getTaskId());
purchasePartInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
purchasePartInfo.setCreateTime(DateUtils.getNowDate());
// 批量新增新购任务详情信息
List<PurchasePartDetails> partDetailsList = purchasePartInfo.getPartDetailsList();
if (partDetailsList != null) {
for (PurchasePartDetails purchasePartDetails : partDetailsList) {
purchasePartDetails.setTaskId(task.getTaskId());
purchasePartDetails.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
purchasePartDetails.setCreateTime(DateUtils.getNowDate());
}
res = purchaseAccessoryMapper.insertPurchasePartDetailsList(partDetailsList);
if (res == 0) {
throw new RuntimeException("新增失败,新增详情未成功");
}
}
// 新增任务信息
res = purchaseAccessoryMapper.insertPurchasePartInfo(purchasePartInfo);
if (res == 0) {
throw new RuntimeException("新增失败,新增新购配件未成功");
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
// 新增任务信息
return purchaseAccessoryMapper.insertPurchasePartInfo(purchasePartInfo);
return res;
}
@Override
public List<PurchasePartInfo> selectPurchasePartInfoList(PurchasePartInfo purchasePartInfo) {
List<PurchasePartInfo> purchasePartInfos = purchaseAccessoryMapper.selectPurchasePartInfoList(purchasePartInfo);
for (PurchasePartInfo partInfo : purchasePartInfos) {
String typeName = purchaseAccessoryMapper.selectTypeNameByTaskId(partInfo.getTaskId());
partInfo.setPurchasingTypeName(typeName);
}
return purchasePartInfos;
}
@Override
public PurchasePartInfo selectPurchasePartInfoByTaskId(Long taskId, String keyWord) {
PurchasePartInfo purchasePartInfo = purchaseAccessoryMapper.selectPurchasePartInfoByTaskId(taskId);
PurchasePartDetails purchasePartDetails = new PurchasePartDetails();
purchasePartDetails.setTaskId(purchasePartInfo.getTaskId());
purchasePartDetails.setKeyWord(keyWord);
List<PurchasePartDetails> purchasePartDetailsList = purchaseAccessoryMapper.selectPurchasePartDetailsList(purchasePartDetails);
purchasePartInfo.setPartDetailsList(purchasePartDetailsList);
return purchasePartInfo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int updatePurchaseCheckInfo(PurchasePartInfo purchasePartInfo){
int res = 0;
try {
Long taskId = purchasePartInfo.getTaskId();
TmTask task = taskMapper.selectTmTaskByTaskId(taskId);
// 判断当前任务是否为待通知状态
if (task == null || task.getTaskStatus() != 68) {
throw new RuntimeException("当前任务不可修改!!!");
}
// 批量新增新购任务详情信息
List<PurchasePartDetails> partDetailsList = purchasePartInfo.getPartDetailsList();
if (partDetailsList != null) {
// 先删除全部的任务详情信息
res = purchaseAccessoryMapper.deletePartDetailsByTaskId(taskId);
if (res == 0) {
throw new RuntimeException("修改失败,删除未成功");
}
for (PurchasePartDetails purchasePartDetails : partDetailsList) {
purchasePartDetails.setTaskId(taskId);
purchasePartDetails.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
purchasePartDetails.setUpdateTime(DateUtils.getNowDate());
}
// 添加任务详情信息
res = purchaseAccessoryMapper.insertPurchasePartDetailsList(partDetailsList);
if (res == 0) {
throw new RuntimeException("修改失败,添加详情信息未成功");
}
}
purchasePartInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
purchasePartInfo.setUpdateTime(DateUtils.getNowDate());
res = purchaseAccessoryMapper.updatePurchasePartInfo(purchasePartInfo);
if (res == 0) {
throw new RuntimeException("修改失败,修改基本信息未成功");
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return res;
}
@Override
public AjaxResult deletePurchasePartInfoByTaskIds(Long[] taskIds) {
for (Long taskId : taskIds){
TmTask task = taskMapper.selectTmTaskByTaskId(taskId);
// 判断当前任务是否为待通知状态
if (task == null || task.getTaskStatus() >= 69) {
return AjaxResult.error("当前任务已验收,不可删除!");
}
}
int res = purchaseAccessoryMapper.deletePurchasePartInfoByTaskIds(taskIds);
if (res>0){
return AjaxResult.success("删除成功");
}else {
return AjaxResult.error("删除失败");
}
}
@Override
public List<PurchasePartInfo> selectPutInListList(PurchasePartInfo purchasePartInfo) {
List<PurchasePartInfo> purchasePartInfos = purchaseAccessoryMapper.selectPutInListList(purchasePartInfo);
for (PurchasePartInfo partInfo : purchasePartInfos) {
String typeName = purchaseAccessoryMapper.selectTypeNameByTaskId(partInfo.getTaskId());
partInfo.setPurchasingTypeName(typeName);
}
return purchasePartInfos;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int updatePurchaseCheckDetails(List<PurchasePartDetails> purchasePartDetailsList) {
int res = 0;
try {
Long taskId = 0L;
for (PurchasePartDetails purchasePartDetails : purchasePartDetailsList) {
taskId = purchasePartDetails.getTaskId();
if ("通过".equals(purchasePartDetails.getCheckResult())) {
purchasePartDetails.setStatus(1);
} else if ("不通过".equals(purchasePartDetails.getCheckResult())) {
purchasePartDetails.setStatus(2);
} else {
purchasePartDetails.setStatus(0);
}
purchasePartDetails.setUpdateTime(DateUtils.getNowDate());
res = purchaseAccessoryMapper.updatePurchasePartDetails(purchasePartDetails);
if (res == 0) {
throw new RuntimeException("验收失败,修改状态未成功");
}
}
// 当全部为已验收,修改任务验收状态
int count = purchaseAccessoryMapper.selectPurchasePartDetailsStatus(taskId);
if (count <= 0) {
TmTask task = new TmTask();
task.setTaskId(taskId);
task.setTaskStatus(69);
res = taskMapper.updateTmTask(task);
if (res == 0) {
throw new RuntimeException("验收失败,修改任务状态未成功");
}
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return res;
}
/**

View File

@ -4,6 +4,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.material.mapper.PurchaseAccessoryMapper">
<resultMap type="com.bonus.sgzb.material.domain.PurchasePartDetails" id="PurchasePartDetailsResult">
<result property="id" column="id" />
<result property="taskId" column="task_id" />
<result property="partId" column="part_id" />
<result property="purchasePrice" column="purchase_price" />
<result property="purchaseNum" column="purchase_num" />
<result property="checkNum" column="check_num" />
<result property="checkResult" column="check_result" />
<result property="supplierId" column="supplier_id" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="productionTime" column="production_time" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="checkUrlName" column="check_url_name" />
<result property="checkUrl" column="check_url" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="companyId" column="company_id" />
</resultMap>
<resultMap type="com.bonus.sgzb.material.domain.PurchasePartInfo" id="PurchasePartInfoResult">
<result property="taskId" column="task_id" />
<result property="purchaseTime" column="purchase_time" />
<result property="arrivalTime" column="arrival_time" />
<result property="purchaser" column="purchaser" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
</resultMap>
<insert id="insertPurchasePartDetailsList">
<foreach item="partDetails" collection="purchasePartDetailsList" open="" separator=";" close="">
insert into purchase_part_details
@ -73,4 +111,151 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<update id="updatePurchasePartInfo" parameterType="com.bonus.sgzb.material.domain.PurchasePartInfo">
update purchase_part_info
<trim prefix="SET" suffixOverrides=",">
<if test="purchaseTime != null and purchaseTime != ''">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 task_id = #{taskId}
</update>
<update id="updatePurchasePartDetails" parameterType="com.bonus.sgzb.material.domain.PurchasePartDetails">
update purchase_part_details
<trim prefix="SET" suffixOverrides=",">
<if test="partId != null">part_id = #{partId},</if>
<if test="purchasePrice != null">purchase_price = #{purchasePrice},</if>
<if test="purchaseNum != null">purchase_num = #{purchaseNum},</if>
<if test="checkNum != null">check_num = #{checkNum},</if>
<if test="checkResult != null">check_result = #{checkResult},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="status != null">status = #{status},</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="fileName != null">file_name = #{fileName},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
</trim>
where task_id = #{taskId}
</update>
<delete id="deletePartDetailsByTaskId">
delete from purchase_part_details where task_id = #{taskId}
</delete>
<delete id="deletePurchasePartInfoByTaskIds" parameterType="String">
delete from purchase_part_info where task_id in
<foreach item="taskId" collection="array" open="(" separator="," close=")">
#{taskId}
</foreach>;
delete from tm_task where task_id in
<foreach item="taskId" collection="array" open="(" separator="," close=")">
#{taskId}
</foreach>;
delete from purchase_part_details where task_id in
<foreach item="taskId" collection="array" open="(" separator="," close=")">
#{taskId}
</foreach>
</delete>
<select id="selectPurchasePartInfoList" resultType="com.bonus.sgzb.material.domain.PurchasePartInfo">
SELECT
ppi.task_id,
ppi.purchase_time,
ppi.arrival_time,
ppi.purchaser,
ppi.create_by,
ppi.create_time,
ppi.update_by,
ppi.update_time,
ppi.remark,
ppi.company_id,
dict.NAME purchasingStatus,
tk.CODE,
su.user_name purchaserName,
tk.task_status taskStatus
FROM
purchase_part_info ppi
LEFT JOIN tm_task tk ON ppi.task_id = tk.task_id
LEFT JOIN ( SELECT id, NAME FROM sys_dic WHERE p_id = 67 ) dict ON tk.task_status = dict.id
LEFT JOIN sys_user su ON ppi.purchaser = su.user_id
WHERE
task_type = 67
<if test="keyWord != null and keyWord != ''"> and tk.code like concat('%',#{keyWord},'%')</if>
<if test="purchaseTime != null and purchaseTime != ''"> and ppi.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null and arrivalTime != ''"> and ppi.arrival_time = #{arrivalTime}</if>
<if test="purchaser != null "> and ppi.purchaser = #{purchaser}</if>
<if test="companyId != null "> and ppi.company_id = #{companyId}</if>
ORDER BY
ppi.create_time DESC
</select>
<select id="selectTypeNameByTaskId" resultType="java.lang.String">
select GROUP_CONCAT(pa_name) typeName from
(select distinct ppd.task_id, mpt1.pa_name
from purchase_part_details ppd
left join ma_part_type mpt on ppd.part_id = mpt.pa_id
left join ma_part_type mpt1 on mpt.parent_id = mpt1.pa_id
where ppd.task_id = #{taskId}
) t
GROUP BY task_id
</select>
<select id="selectPurchasePartInfoByTaskId" resultType="com.bonus.sgzb.material.domain.PurchasePartInfo">
select pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time,
pci.update_by, pci.update_time, pci.remark, pci.company_id, tk.code
from purchase_part_info pci
left join tm_task tk on pci.task_id = tk.task_id
where pci.task_id = #{taskId}
</select>
<select id="selectPurchasePartDetailsList"
parameterType="com.bonus.sgzb.material.domain.PurchasePartDetails" resultMap="PurchasePartDetailsResult">
select pcd.task_id, pcd.part_id, pcd.purchase_price, pcd.purchase_num, pcd.check_num, pcd.check_result,
pcd.supplier_id, msi.supplier, pcd.create_by, pcd.production_time, pcd.create_time,
pcd.file_name, pcd.file_url,pcd.update_by, pcd.update_time, pcd.remark, pcd.company_id,
mt1.pa_name machineTypeName,mt.pa_name specificationType, tk.code ,mt.pa_name typeName,
mt.unit_id unitName
from purchase_part_details pcd
left join ma_part_type mt on pcd.part_id = mt.pa_id
left join ma_part_type mt1 on mt.parent_id = mt1.pa_id
left join ma_supplier_info msi on pcd.supplier_id = msi.supplier_id
left join tm_task tk on pcd.task_id = tk.task_id
<where>
<if test="taskId != null "> and pcd.task_id = #{taskId}</if>
<if test="keyWord != null and keyWord != ''">and (mt.pa_name like concat('%',#{keyWord},'%')
or mt1.pa_name like concat('%',#{keyWord}) or msi.supplier like concat('%',#{keyWord}))</if>
<if test="partId != null "> and pcd.part_id = #{partId}</if>
<if test="purchasePrice != null and purchasePrice != ''"> and pcd.purchase_price = #{purchasePrice}</if>
<if test="purchaseNum != null "> and pcd.purchase_num = #{purchaseNum}</if>
<if test="supplierId != null "> and pcd.supplier_id = #{supplierId}</if>
<if test="productionTime != null "> and pcd.production_time = #{productionTime}</if>
<if test="companyId != null "> and pcd.company_id = #{companyId}</if>
</where>
</select>
<select id="selectPutInListList" resultMap="PurchasePartInfoResult">
select pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time,
pci.update_by,
pci.update_time, pci.remark, pci.company_id ,tk.code,tk.task_status taskStatus,su.user_name purchaserName
from purchase_part_info pci
left join tm_task tk on pci.task_id = tk.task_id
left join sys_user su on pci.purchaser = su.user_id
where task_type = 67 and tk.task_status in (69,70)
<if test="keyWord != null and keyWord != ''">and tk.code like concat('%',#{keyWord},'%')</if>
<if test="purchaseTime != null and purchaseTime != ''">and pci.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null and arrivalTime != ''">and pci.arrival_time = #{arrivalTime}</if>
<if test="purchaser != null ">and pci.purchaser = #{purchaser}</if>
<if test="companyId != null ">and pci.company_id = #{companyId}</if>
order by create_time desc
</select>
<select id="selectPurchasePartDetailsStatus" resultType="java.lang.Integer">
select count(*) from purchase_part_details where task_id = #{taskId} and status != 1
</select>
</mapper>