功能完善

This commit is contained in:
bns_han 2024-01-22 18:25:23 +08:00
parent c1f3d612e6
commit cf0d751327
11 changed files with 212 additions and 73 deletions

View File

@ -3,6 +3,7 @@ package com.bonus.sgzb.app.controller;
import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.app.domain.GlobalConstants;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.service.BackApplyService;
import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
@ -23,26 +24,22 @@ import java.util.Date;
import java.util.List;
/**
* 退料申请--App
*/
* @description 退料申请--app
* @author hay
* @date 2024/1/22 10:17
*/
@RestController
@RequestMapping("/back_apply")
public class BackApplyController extends BaseController {
@Resource
private BackApplyService backApplyService; // 任务表Service
private BackApplyService backApplyService;
/**
* 服务对象
*/
@Resource
private TmTaskService tmTaskService; // 任务表Service
@Resource
private LeaseApplyInfoService leaseApplyInfoService; // 领料申请表Service
@Resource
private LeaseApplyDetailsService leaseApplyDetailsService; // 领料申请明细表Service
private TmTaskService tmTaskService;
/**
* 退料申请列表
@ -231,16 +228,18 @@ public class BackApplyController extends BaseController {
}
}
// 退料编号生成规则
/**
* 退料编号生成规则
*/
private String purchaseCodeRule() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
int taskNum = tmTaskService.selectTaskNumByMonth(nowDate, 36) + 1;
String code = "";
if (taskNum > 9 && taskNum < 100) {
if (taskNum > GlobalConstants.NINE && taskNum < GlobalConstants.ONE_HUNDRED) {
code = "T" + format + "-00" + taskNum;
} else if (taskNum > 99 && taskNum < 1000) {
} else if (taskNum > GlobalConstants.NINETY_NINE && taskNum < GlobalConstants.ONE_THOUSAND) {
code = "T" + format + "-0" + taskNum;
} else {
code = "T" + format + "-000" + taskNum;

View File

@ -10,6 +10,11 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @description 退料申请--app
* @author hay
* @date 2024/1/22 11:13
*/
@Service
public class BackApplyServiceImpl implements BackApplyService {

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.GlobalConstants;
import com.bonus.sgzb.app.mapper.BackReceiveMapper;
import com.bonus.sgzb.app.service.BackReceiveService;
import com.bonus.sgzb.common.core.utils.DateUtils;
@ -12,6 +13,11 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description 退料申请--app
* @author hay
* @date 2024/1/22 11:16
*/
@Service
public class BackReceiveServiceImpl implements BackReceiveService {
@ -33,13 +39,13 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override
@Transactional(rollbackFor = Exception.class)
public int setNumBack(BackApplyInfo record) {
int res =0;
int res;
try{
int taskId = record.getTaskId();
//修改任务状态
res= updateTaskStatus(taskId,39);
//插入back_check_details
res = insertBCD(record);
res = insertBcd(record);
if(res == 0) {
throw new RuntimeException("插入back_check_details异常");
}
@ -51,7 +57,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
}
private int updateTaskStatus(int taskId, int i) {
int res=0;
int res;
res=backReceiveMapper.updateTaskStatus(taskId,i);
return res;
}
@ -59,7 +65,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override
@Transactional(rollbackFor = Exception.class)
public int setCodeBack(BackApplyInfo record) {
int res = 0;
int res;
try{
//todo 此处需要判断 接收数量是否大于退料数量或者查询待接收数量是否为0
@ -70,7 +76,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
throw new RuntimeException("插入back_check_details异常");
}
//插入back_check_details
res = insertBCD(record);
res = insertBcd(record);
if(res == 0) {
throw new RuntimeException("插入back_check_details异常");
}
@ -83,7 +89,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override
@Transactional(rollbackFor = Exception.class)
public int endBack(BackApplyInfo record) {
int res =0;
int res;
try{
int taskId = record.getTaskId();
//修改任务状态
@ -95,11 +101,11 @@ public class BackReceiveServiceImpl implements BackReceiveService {
//合格的插入入库记录input_apply_details修改库存ma_type,修改机具状态
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
if(hgList!=null && hgList.size()>0){
res = insertIAD(hgList);
res = insertIad(hgList);
if(res == 0) {
throw new RuntimeException("input_apply_details");
}
res = updateMT(hgList);
res = updateMt(hgList);
if(res == 0) {
throw new RuntimeException("ma_type");
}
@ -112,22 +118,22 @@ public class BackReceiveServiceImpl implements BackReceiveService {
List<BackApplyInfo> wxList = backReceiveMapper.getWxList(record);
if(wxList!=null && wxList.size()>0){
//插入任务表tm_task
int newTaskId = insertTT(wxList,41,record.getCreateBy());
int newTaskId = insertTt(wxList,41,record.getCreateBy());
//插入协议任务表tm_task_agreement
res = insertTTA(newTaskId,wxList);
res = insertTta(newTaskId,wxList);
//插入维修记录表repair_apply_details
res = insertRAD(newTaskId,wxList);
res = insertRad(newTaskId,wxList);
}
//待报废的创建报废任务插入任务协议表
List<BackApplyInfo> bfList = backReceiveMapper.getBfList(record);
if(bfList!=null && bfList.size()>0){
//插入任务表tm_task
int newTaskId = insertTT(bfList,57,record.getCreateBy());
int newTaskId = insertTt(bfList,57,record.getCreateBy());
//插入协议任务表tm_task_agreement
res = insertTTA(newTaskId,bfList);
res = insertTta(newTaskId,bfList);
//插入维修记录表scrap_apply_details
res = insertSAD(newTaskId,bfList);
res = insertSad(newTaskId,bfList);
}
}catch (Exception e){
throw new RuntimeException(e.getMessage());
@ -150,7 +156,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return backReceiveMapper.backReceiveRecord(record);
}
private int insertRAD(int taskId, List<BackApplyInfo> wxList) {
private int insertRad(int taskId, List<BackApplyInfo> wxList) {
int result = 0;
if(wxList !=null){
for( BackApplyInfo wx : wxList ){
@ -161,7 +167,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return result;
}
private int insertSAD(int taskId, List<BackApplyInfo> list) {
private int insertSad(int taskId, List<BackApplyInfo> list) {
int result = 0;
if(list !=null){
for( BackApplyInfo bf : list ){
@ -172,21 +178,21 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return result;
}
private int insertTTA(int taskId, List<BackApplyInfo> list) {
int res = 0 ;
private int insertTta(int taskId, List<BackApplyInfo> list) {
int res;
String agreementId = list.get(0).getAgreementId();
res = backReceiveMapper.insertTTA(taskId,agreementId);
return res;
}
private int insertTT(List<BackApplyInfo> hgList, int taskType,String createBy) {
int newTask = 0;
private int insertTt(List<BackApplyInfo> hgList, int taskType,String createBy) {
int newTask;
//生成单号
String code = genCodeRule(taskType);
BackApplyInfo applyInfo = new BackApplyInfo();
applyInfo.setTaskType(taskType);
String taskStatus="";
if(41 == taskType){
if(GlobalConstants.FORTY_ONE == taskType){
taskStatus = "43";
}
if(57 == taskType){
@ -219,7 +225,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return res;
}
private int updateMT(List<BackApplyInfo> hgList) {
private int updateMt(List<BackApplyInfo> hgList) {
int res =0;
if(hgList!=null && hgList.size()>0){
for(BackApplyInfo bi : hgList){
@ -229,7 +235,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return res;
}
private int insertIAD(List<BackApplyInfo> hgList) {
private int insertIad(List<BackApplyInfo> hgList) {
int res =0;
if(hgList!=null && hgList.size()>0){
for(BackApplyInfo bi : hgList){
@ -239,7 +245,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return res;
}
private int insertBCD(BackApplyInfo record) {
private int insertBcd(BackApplyInfo record) {
int res =0;
BackApplyInfo[] arr = record.getArr();
if(arr.length>0){
@ -268,7 +274,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
}
// 编号生成规则
/**
* 编号生成规则
*/
private String genCodeRule(int taskType) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();

View File

@ -215,6 +215,6 @@ public class BackApplyController extends BaseController {
{
List<BackApplyInfo> list = backApplyService.exportList(bean);
ExcelUtil<BackApplyInfo> util = new ExcelUtil<BackApplyInfo>(BackApplyInfo.class);
util.exportExcel(response, list, "新购验收任务数据");
util.exportExcel(response, list, "退料申请数据");
}
}

View File

@ -1,5 +1,6 @@
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;
@ -12,6 +13,8 @@ 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;
/**
@ -93,6 +96,19 @@ public class PurchaseAccessoryController extends BaseController
return toAjax(purchaseAccessoryService.updatePurchaseCheckDetails(purchasePartDetailsList));
}
/**
* 新购配件验收导出
*/
@ApiOperation("新购配件验收导出")
@Log(title = "新购配件验收导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PurchasePartInfo bean)
{
List<PurchasePartInfo> list = purchaseAccessoryService.exportList(bean);
ExcelUtil<PurchasePartInfo> util = new ExcelUtil<PurchasePartInfo>(PurchasePartInfo.class);
util.exportExcel(response, list, "新购配件验收数据");
}
/**
@ -136,4 +152,17 @@ public class PurchaseAccessoryController extends BaseController
public AjaxResult checkInput(@RequestBody List<PurchasePartDetails> purchasePartDetails){
return toAjax(purchaseAccessoryService.checkInput(purchasePartDetails));
}
/**
* 新购配件入库导出
*/
@ApiOperation("新购配件入库导出")
@Log(title = "新购配件入库导出", businessType = BusinessType.EXPORT)
@PostMapping("/inputExport")
public void inputExport(HttpServletResponse response, PurchasePartDetails bean)
{
List<PurchasePartDetails> list = purchaseAccessoryService.inputExport(bean);
ExcelUtil<PurchasePartDetails> util = new ExcelUtil<PurchasePartDetails>(PurchasePartDetails.class);
util.exportExcel(response, list, "新购配件入库数据");
}
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.material.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
@ -33,6 +34,10 @@ public class PurchasePartDetails extends BaseEntity
@ApiModelProperty(value = "规格id")
private Long modelId;
@ApiModelProperty(value = "采购单号")
@Excel(name = "采购单号")
private String code;
/** 采购单价 */
@ApiModelProperty(value = "采购单价")
private String purchasePrice;
@ -124,9 +129,6 @@ public class PurchasePartDetails extends BaseEntity
@ApiModelProperty(value = "管理方式(0编号 1计数)")
private String manageType;
@ApiModelProperty(value = "采购单号")
private String code;
@ApiModelProperty(value = "关键字筛选")
private String keyWord;

View File

@ -39,43 +39,46 @@ public class PurchasePartInfo extends BaseEntity
@Excel(name = "到货日期")
private String arrivalTime;
/** 采购员名称 */
@ApiModelProperty(value = "采购员名称")
@Excel(name = "采购员")
private String purchaserName;
/** 采购员 */
@ApiModelProperty(value = "采购员")
private Long purchaser;
/** 采购机具设备名称 */
@ApiModelProperty(value = "采购机具设备")
@Excel(name = "机具类型名称")
@Excel(name = "配件名称")
private String purchasingTypeName;
/** 采购机具设备型号 */
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
@Excel(name = "配件规格")
private String purchasingTypeCode;
/** 采购员名称 */
@ApiModelProperty(value = "采购员名称")
@Excel(name = "采购员")
private String purchaserName;
/** 管理模式 */
@ApiModelProperty(value = "管理模式")
@Excel(name = "管理模式",readConverterExp = "0=编码管理,1=计数管理")
private String manageType;
/** 机具厂家 */
@ApiModelProperty(value = "机具厂家")
@Excel(name = "机具厂家")
private String supplier;
/** 采购单价 */
@ApiModelProperty(value = "采购单价")
@Excel(name = "采购单价")
private String purchasePrice;
/** 采购数量 */
@ApiModelProperty(value = "采购数量")
@Excel(name = "采购数量")
private String purchaseNum;
/** 配件厂家 */
@ApiModelProperty(value = "配件厂家")
@Excel(name = "配件厂家")
private String supplier;
/** 验收数量 */
@ApiModelProperty(value = "验收数量")
@Excel(name = "验收数量")
private String checkNum;
/** 采购状态 */
@ -324,6 +327,14 @@ public class PurchasePartInfo extends BaseEntity
this.taskStatusResult = taskStatusResult;
}
public String getPurchasePrice() {
return purchasePrice;
}
public void setPurchasePrice(String purchasePrice) {
this.purchasePrice = purchasePrice;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -86,4 +86,18 @@ public interface PurchaseAccessoryMapper
int updatePartTypeNum(@Param("partId") Long partId,@Param("inputNum") BigDecimal inputNum);
int setlectStatusById(Long id);
/**
* 新购配件导出
* @param bean
* @return List<PurchasePartInfo>
*/
List<PurchasePartInfo> exportList(PurchasePartInfo bean);
/**
* 新购配件入库导出
* @param bean
* @return List<PurchasePartInfo>
*/
List<PurchasePartDetails> inputExport(PurchasePartDetails bean);
}

View File

@ -73,4 +73,18 @@ public interface IPurchaseAccessoryService
List<PurchasePartDetails> selectPutinDetails(PurchasePartDetails purchasePartDetails);
int checkInput(List<PurchasePartDetails> purchasePartDetails);
/**
* 新购配件导出
* @param bean
* @return List<PurchasePartInfo>
*/
List<PurchasePartInfo> exportList(PurchasePartInfo bean);
/**
* 新购配件入库导出
* @param bean
* @return List<PurchasePartDetails>
*/
List<PurchasePartDetails> inputExport(PurchasePartDetails bean);
}

View File

@ -281,6 +281,16 @@ public class PurchaseAccessoryServiceImpl implements IPurchaseAccessoryService
return res;
}
@Override
public List<PurchasePartInfo> exportList(PurchasePartInfo bean) {
return purchaseAccessoryMapper.exportList(bean);
}
@Override
public List<PurchasePartDetails> inputExport(PurchasePartDetails bean) {
return purchaseAccessoryMapper.inputExport(bean);
}
/**
* 新购配件--采购单号编码生成规则
*/

View File

@ -266,9 +266,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectPutInListList" resultMap="PurchasePartInfoResult">
select pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time,
SELECT
pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, us.user_name as createBy, pci.create_time,
pci.update_by,
pci.update_time, pci.remark, pci.company_id ,tk.code,tk.task_status taskStatus,
pci.update_time, pci.remark, pci.company_id ,tk.code,tk.task_status taskStatus,GROUP_CONCAT(distinct mpt1.pa_name) purchasingTypeName,
CASE
tk.task_status
WHEN 69 THEN '待入库'
@ -276,15 +277,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ELSE ''
END taskStatusResult,
su.user_name purchaserName
from purchase_part_info pci
FROM
purchase_part_details ppd
LEFT JOIN purchase_part_info pci on pci.task_id=ppd.task_id
left join tm_task tk on pci.task_id = tk.task_id
left join sys_user su on pci.purchaser = su.user_id
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
LEFT JOIN sys_user us on us.user_id = pci.create_by
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>
<if test="keyWord != null and keyWord != ''"> and tk.code like concat('%',#{keyWord},'%')</if>
<if test="submitStorageTime != null and submitStorageTime != ''"> and pci.create_time like concat('%',#{submitStorageTime},'%')</if>
<if test="partId != null and partId != ''"> and mpt1.pa_id in (#{partId})</if>
GROUP BY task_id
order by create_time desc
</select>
<select id="selectPurchasePartDetailsStatus" resultType="java.lang.Integer">
@ -347,4 +352,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mt.pa_id = #{partId}
</if>
</select>
<select id="exportList" resultType="com.bonus.sgzb.material.domain.PurchasePartInfo">
SELECT
tk.`code`,
ppi.purchase_time as purchaseTime,
ppi.arrival_time as arrivalTime,
mpt2.pa_name as purchasingTypeName,
mpt.pa_name as purchasingTypeCode,
su.user_name purchaserName,
ppd.purchase_price as purchasePrice,
ppd.purchase_num as purchaseNum,
msi.supplier,
CASE
WHEN ppd.`status` = 0 THEN '待验收'
WHEN ppd.`status` = 1 THEN '已验收'
WHEN ppd.`status` = 2 THEN '验收不通过'
WHEN ppd.`status` = 3 THEN '已入库'
ELSE ''
END AS purchasingStatus
FROM
purchase_part_details ppd
LEFT JOIN purchase_part_info ppi on ppd.task_id=ppi.task_id
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
LEFT JOIN ma_part_type mpt on mpt.pa_id=ppd.part_id
LEFT JOIN ma_part_type mpt2 on mpt2.pa_id=mpt.parent_id
LEFT JOIN ma_supplier_info msi on msi.supplier_id=ppd.supplier_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="inputExport" resultType="com.bonus.sgzb.material.domain.PurchasePartDetails">
</select>
</mapper>