功能完善

This commit is contained in:
bns_han 2024-01-26 11:27:27 +08:00
parent 83dd51fb1c
commit 57130c2559
14 changed files with 499 additions and 73 deletions

View File

@ -102,6 +102,29 @@ public class BackReceiveController extends BaseController {
}
}
/**
* 退料接收-rfid退料
*
* @param record 查询条件
* @return AjaxResult对象
*/
@Log(title = "退料接收-rfid退料", businessType = BusinessType.INSERT)
@PostMapping("setRfidCodeBack")
public AjaxResult setRfidCodeBack(@RequestBody BackApplyInfo record) {
try {
int res =backReceiveService.setRfidCodeBack(record);
if (res>0){
return AjaxResult.success("接收成功");
}else if (res==-1){
return AjaxResult.error("该RFID编码已接收");
}else {
return AjaxResult.error("接收失败");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Log(title = "退料接收-结束任务", businessType = BusinessType.INSERT)
@PostMapping("endBack")
public AjaxResult endBack(@RequestBody BackApplyInfo record) {

View File

@ -7,6 +7,7 @@ import java.util.List;
/**
* 退料
* @author bns_han
*/
@Data
public class BackApplyInfo {

View File

@ -1,14 +1,30 @@
package com.bonus.sgzb.app.domain;
public class GlobalConstants {
/** 9 */
public static final int NINE=9;
/** 100 */
public static final int ONE_HUNDRED=100;
/** 1000 */
public static final int ONE_THOUSAND=1000;
/** 99 */
public static final int NINETY_NINE=99;
/** 41 */
public static final int FORTY_ONE=41;
/**
* 9
*/
public static final int NINE = 9;
/**
* 41
*/
public static final int FORTY_ONE = 41;
/**
* 57
*/
public static final int FIFTY_SEVEN = 57;
/**
* 99
*/
public static final int NINETY_NINE = 99;
/**
* 100
*/
public static final int ONE_HUNDRED = 100;
/**
* 1000
*/
public static final int ONE_THOUSAND = 1000;
}

View File

@ -8,54 +8,164 @@ import java.util.Date;
import java.util.List;
/**
* @author bns_han
*/
@Mapper
public interface BackReceiveMapper {
/**
* 退料接收列表
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getbackReceiveList(BackApplyInfo record);
/**
* 退料接收明细
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> receiveView(BackApplyInfo record);
/**
* 添加退料合格数量
*/
int setCheckDetails(BackApplyInfo record);
* 添加接收数据back_check_details
* @param record
* @return int
*/
int insertCheckDetails(BackApplyInfo record);
/**
* 查询编号
* @param date
* @param taskType
* @return int
*/
int selectTaskNumByMonthWx(@Param("date") Date date, @Param("taskType") Integer taskType);
/**
* 添加维修任务
* @param bean
* @return int
*/
int addWxTask(BackApplyInfo bean);
/**
* 添加维修协议
* @param bean
* @return int
*/
int addWxTaskAgreement(BackApplyInfo bean);
/**
* 更新任务状态
* @param taskId
* @param status
* @return int
*/
int updateTaskStatus(@Param("taskId") int taskId, @Param("status") int status);
/**
* 更新ma_machine
* @param maId
* @param maStatus
* @return int
*/
int updateMaStatus(@Param("maId") int maId,@Param("maStatus") String maStatus);
/**
* getHgList
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getHgList(BackApplyInfo record);
int insertIAD(BackApplyInfo bi);
/**
* 插入input_apply_details
* @param bi
* @return int
*/
int insertIad(BackApplyInfo bi);
int updateMT(BackApplyInfo bi);
/**
* 修改ma_type库存
* @param bi
* @return int
*/
int updateMt(BackApplyInfo bi);
/**
* 查询
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getWxList(BackApplyInfo record);
int insertTT(BackApplyInfo bean);
/**
* tm_task
* @param bean
* @return int
*/
int insertTt(BackApplyInfo bean);
int insertRAD(BackApplyInfo wx);
/**
* repair_apply_details
* @param wx
* @return int
*/
int insertRad(BackApplyInfo wx);
int insertTTA(@Param("taskId") int taskId,@Param("agreementId") String agreementId);
/**
* tm_task_agreement
* @param taskId
* @param agreementId
* @return int
*/
int insertTta(@Param("taskId") int taskId,@Param("agreementId") String agreementId);
/**
* 查询
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getBfList(BackApplyInfo record);
int insertSAD(BackApplyInfo bf);
/**
* 插入scrap_apply_details
* @param bf
* @return int
*/
int insertSad(BackApplyInfo bf);
/**
* 编码查询
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> codeQuery(BackApplyInfo record);
/**
* 二维码查询
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> qrcodeQuery(BackApplyInfo record);
/**
* 退料接收记录
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> backReceiveRecord(BackApplyInfo record);
/**
* 查询
* @param maId
* @param taskId
* @return int
*/
int selectCodeByMaIdAndTaskId(@Param("maId") Integer maId,@Param("taskId") Integer taskId);
/**

View File

@ -6,45 +6,110 @@ import com.bonus.sgzb.app.domain.TmTask;
import java.util.List;
/**
* @author bns_han
*/
public interface BackApplyService {
/**
* 查询退料单位列表
*/
* 查询退料单位列表
* @param record
* @return List<BmAgreementInfo>
*/
List<BmAgreementInfo> getbackUnit(BmAgreementInfo record);
/**
* 查询退料工程列表
*/
* 查询退料工程列表
* @param record
* @return List<BmAgreementInfo>
*/
List<BmAgreementInfo> getbackPro(BmAgreementInfo record);
/**
* 创建任务单
*/
* 创建任务单
* @param task
* @return int
*/
int insertTask(TmTask task);
/**
* 退料申请列表
*/
* 退料申请列表
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getbackList(BackApplyInfo record);
/**
* 任务协议表(tm_task_agreement)
* @param task
* @return int
*/
int insertTaskAgreement(TmTask task);
/**
* 退料任务表(back_apply_info)
* @param task
* @return int
*/
int insertBackApply(TmTask task);
/**
* 获取物料列表
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> materialList(BackApplyInfo record);
/**
* 提交物料型号及数量
*
* @param record 查询条件
* @return int
*/
int upload(BackApplyInfo record);
/**
* 详情查看
* @param record
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> view(BackApplyInfo record);
/**
* 删除
* @param record
* @return int
*/
int del(BackApplyInfo record);
/**
* 退料审核列表
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> examineList(BackApplyInfo record);
/**
* 退料审核明细
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> examineView(BackApplyInfo record);
/**
* 退料审核通过
* @param record
* @return int
*/
int audit(BackApplyInfo record);
/**
* 退料审核驳回
* @param record
* @return int
*/
int refuse(BackApplyInfo record);
}

View File

@ -4,22 +4,74 @@ import com.bonus.sgzb.app.domain.BackApplyInfo;
import java.util.List;
/**
* @author bns_han
*/
public interface BackReceiveService {
/**
* 退料接收列表
*
* @param record 查询条件
* @return AjaxResult对象
*/
List<BackApplyInfo> getbackReceiveList(BackApplyInfo record);
/**
* 退料接收明细
*
* @param record 查询条件
* @return AjaxResult对象
*/
List<BackApplyInfo> receiveView(BackApplyInfo record);
/**
* 数量退料--管理方式为1的
*
* @param record 查询条件
* @return AjaxResult对象
*/
int setNumBack(BackApplyInfo record);
/**
* 编码退料--管理方式为0的
*
* @param record 查询条件
* @return AjaxResult对象
*/
int setCodeBack(BackApplyInfo record);
/**
* 退料接收-结束任务
*
* @param record 查询条件
* @return int
*/
int endBack(BackApplyInfo record);
/**
* 退料接收-编号查询
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> codeQuery(BackApplyInfo record);
/**
* 退料接收-二维码查询
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> qrcodeQuery(BackApplyInfo record);
/**
* 退料接收记录
*
* @param record 查询条件
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> backReceiveRecord(BackApplyInfo record);
/**
@ -28,4 +80,12 @@ public interface BackReceiveService {
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> rfidCodeQuery(BackApplyInfo record);
/**
* 退料接收-rfid退料
*
* @param record 查询条件
* @return int
*/
int setRfidCodeBack(BackApplyInfo record);
}

View File

@ -174,12 +174,47 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return backReceiveMapper.rfidCodeQuery(record);
}
@Override
public int setRfidCodeBack(BackApplyInfo record) {
int res=0;
try{
BackApplyInfo[] arr = record.getArr();
if (arr.length>0){
for (int i=0;i< arr.length;i++){
//根据maId和taskId查询是否已接收
int re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(),record.getTaskId());
if (re>0){
res=-1;
break;
}
}
if (res==-1){
return res;
}
}
int taskId = record.getTaskId();
//修改任务状态
res= updateTaskStatus(taskId,39);
if(res == 0) {
throw new RuntimeException("插入back_check_details异常");
}
//插入back_check_details
res = insertBcd(record);
if(res == 0) {
throw new RuntimeException("插入back_check_details异常");
}
}catch (Exception e){
throw new RuntimeException(e.getMessage());
}
return res;
}
private int insertRad(int taskId, List<BackApplyInfo> wxList) {
int result = 0;
if(wxList !=null){
for( BackApplyInfo wx : wxList ){
wx.setTaskId(taskId);
result = backReceiveMapper.insertRAD(wx);
result = backReceiveMapper.insertRad(wx);
}
}
return result;
@ -190,7 +225,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if(list !=null){
for( BackApplyInfo bf : list ){
bf.setTaskId(taskId);
result = backReceiveMapper.insertSAD(bf);
result = backReceiveMapper.insertSad(bf);
}
}
return result;
@ -199,7 +234,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
private int insertTta(int taskId, List<BackApplyInfo> list) {
int res;
String agreementId = list.get(0).getAgreementId();
res = backReceiveMapper.insertTTA(taskId,agreementId);
res = backReceiveMapper.insertTta(taskId,agreementId);
return res;
}
@ -213,14 +248,14 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if(GlobalConstants.FORTY_ONE == taskType){
taskStatus = "43";
}
if(57 == taskType){
if(GlobalConstants.FIFTY_SEVEN == taskType){
taskStatus = "58";
}
applyInfo.setTaskStatus(taskStatus);
applyInfo.setCode(code);
//创建人
applyInfo.setCreateBy(createBy);
newTask = backReceiveMapper.insertTT(applyInfo);
newTask = backReceiveMapper.insertTt(applyInfo);
if (newTask>0 && applyInfo.getTaskId()>0){
newTask=applyInfo.getTaskId();
}
@ -247,7 +282,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
int res =0;
if(hgList!=null && hgList.size()>0){
for(BackApplyInfo bi : hgList){
res = backReceiveMapper.updateMT(bi);
res = backReceiveMapper.updateMt(bi);
}
}
return res;
@ -257,7 +292,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
int res =0;
if(hgList!=null && hgList.size()>0){
for(BackApplyInfo bi : hgList){
res = backReceiveMapper.insertIAD(bi);
res = backReceiveMapper.insertIad(bi);
}
}
return res;
@ -301,15 +336,15 @@ public class BackReceiveServiceImpl implements BackReceiveService {
String format = dateFormat.format(nowDate);
int taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate,taskType) + 1;
String code="";
if(41 == taskType){
if(GlobalConstants.FORTY_ONE == taskType){
code = "WX";
}
if(57 == taskType){
if(GlobalConstants.FIFTY_SEVEN == taskType){
code = "BF";
}
if (taskNum>9 && taskNum<100){
if (taskNum>GlobalConstants.NINE && taskNum<GlobalConstants.ONE_HUNDRED){
code = code + format + "-00" + taskNum;
}else if (taskNum>99 && taskNum<1000){
}else if (taskNum>GlobalConstants.NINETY_NINE && taskNum<GlobalConstants.ONE_THOUSAND){
code = code +format + "-0" + taskNum;
}else {
code = code + format + "-000" + taskNum;

View File

@ -429,8 +429,6 @@
GROUP BY mt.type_id
) AS subquery2
ON subquery1.type_id = subquery2.type_id
WHERE
subquery1.out_num - COALESCE(subquery2.audit_num, 0)>0
</select>
<select id="view" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">

View File

@ -83,7 +83,7 @@
)
</insert>
<insert id="insertTT" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.app.domain.TmTask" useGeneratedKeys="true">
<insert id="insertTt" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.app.domain.TmTask" useGeneratedKeys="true">
insert into tm_task
(
<if test="taskType != null">
@ -191,7 +191,7 @@
)
</insert>
<insert id="insertTTA">
<insert id="insertTta">
insert into tm_task_agreement
(
<if test="taskId != null">
@ -212,7 +212,7 @@
)
</insert>
<insert id="insertRAD">
<insert id="insertRad">
insert into repair_apply_details
(
<if test="taskId != null">
@ -418,7 +418,7 @@
)
</insert>
<insert id="insertIAD">
<insert id="insertIad">
insert into input_apply_details
(
<if test="taskId != null">
@ -486,7 +486,7 @@
)
</insert>
<insert id="insertSAD">
<insert id="insertSad">
insert into scrap_apply_details
(
<if test="taskId != null">
@ -554,7 +554,7 @@
where ma_id = #{maId}
</update>
<update id="updateMT">
<update id="updateMt">
UPDATE ma_type
SET num = (IFNULL(num, 0)) + #{backNum}
WHERE type_id = #{typeId}
@ -590,9 +590,9 @@
LEFT JOIN ma_type mt3 ON mt3.type_id=mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id=mt3.parent_id
WHERE
tt.task_status>='38'
tt.task_status in (38,39,40)
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
ORDER BY bai.create_time desc
ORDER BY tt.task_status asc ,bai.create_time desc
</select>
<select id="receiveView" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
@ -604,7 +604,8 @@
mt.type_name typeCode,
mt2.type_name AS typeName,
IFNULL(bad.audit_num,0)-(IFNULL(aa.back_num,0)) as num,
mt.manage_type as manageType
mt.manage_type as manageType,
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
FROM
back_apply_details bad
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id

View File

@ -135,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unitName != null">unit_name = #{unitName},</if>
<if test="manageType != null">manage_type = #{manageType},</if>
<if test="leasePrice != null">lease_price = #{leasePrice},</if>
<if test="rentPrice != null">rent_price = #{rentPrice},</if>
<if test="effTime != null">eff_time = #{effTime},</if>
<if test="buyPrice != null">buy_price = #{buyPrice},</if>
<if test="payPrice != null">pay_price = #{payPrice},</if>
@ -328,7 +329,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getListByParentId" resultMap="MaTypeResult">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.unit_name, m.manage_type,
m.lease_price, m.eff_time, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,
su.user_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time,

View File

@ -143,9 +143,12 @@ public class BackApplyController extends BaseController {
if (CollUtil.isNotEmpty(leaseApplyDetailsList)) {
// 对领料任务表的对象做数据处理
BackApplyInfo backApplyInfo = bean.getBackApplyInfo();
backApplyInfo.setCode(code); // 创建领料单号
backApplyInfo.setTaskId(taskId); // 设置任务ID
backApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
// 创建领料单号
backApplyInfo.setCode(code);
// 设置任务ID
backApplyInfo.setTaskId(taskId);
// 设置设备所属分公司,用于交给哪家审核
backApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId());
// 创建领料任务返回领料任务编号
boolean addLeaseTaskResult = backApplyService.insertBackApply(backApplyInfo) > 0;
@ -155,7 +158,8 @@ public class BackApplyController extends BaseController {
Long backApplyInfoId = backApplyInfo.getId();
if (StringUtils.isNotNull(backApplyInfoId)) {
for (BackApplyInfo leaseApplyDetails : leaseApplyDetailsList) {
leaseApplyDetails.setId(backApplyInfoId); // 设置领料任务ID
// 设置领料任务ID
leaseApplyDetails.setId(backApplyInfoId);
// 插入领料任务明细
boolean addLeaseTaskDetailsResult = backApplyService.upload(leaseApplyDetails) > 0;
if (!addLeaseTaskDetailsResult) {

View File

@ -15,39 +15,100 @@ import java.util.List;
@Mapper
public interface BackApplyMapper {
/**
* 获取退料审核列表
*/
* 获取退料审核列表
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getBackApplyList(BackApplyInfo bean);
/**
* 获取在用物料列表
*/
* 获取在用物料列表
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getMaterialList(BackApplyInfo bean);
/**
* 查询
* @param date
* @param taskType
* @return int
*/
int selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType);
/**
* 创建任务
* @param bean
* @return int
*/
int insertTask(BackApplyInfo bean);
/**
* 添加协议
* @param bean
* @return int
*/
int insertTaskAgreement(BackApplyInfo bean);
/**
* 创建领料任务返回领料任务编号
* @param bean
* @return int
*/
int insertBackApply(BackApplyInfo bean);
/**
* 插入领料任务明细
* @param bean
* @return int
*/
int upload(BackApplyInfo bean);
/**
* 详情
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getView(BackApplyInfo bean);
/**
* back_apply_details
* @param detailsId
* @param num
* @return int
*/
int setModify(@Param("detailsId") String detailsId, @Param("num") String num);
/**
* del
* @param bean
* @return int
*/
int del(BackApplyInfo bean);
/**
* tm_task
* @param bean
* @return int
*/
int audit(BackApplyInfo bean);
/**
* tm_task
* @param bean
* @return int
*/
int refuse(BackApplyInfo bean);
/**
* 查询
* @param bean
* @return List<TypeTreeNode>
*/
List<TypeTreeNode> getUseTypeTree(BackApplyInfo bean);
/**
* 退料申请导出
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> exportList(BackApplyInfo bean);
}

View File

@ -13,37 +13,89 @@ import java.util.List;
public interface BackApplyService {
/**
* 获取退料审核列表
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getBackApplyList(BackApplyInfo bean);
/**
* 获取在用物料列表
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getMaterialList(BackApplyInfo bean);
/**
* 生成退料编码
* @param
* @return String
*/
String genderBackCode();
/**
* 创建任务
* @param bean
* @return int
*/
int insertSelective(BackApplyInfo bean);
/**
* 添加协议
* @param bean
* @return int
*/
int insertTaskAgreement(BackApplyInfo bean);
/**
* 创建领料任务返回领料任务编号
* @param bean
* @return int
*/
int insertBackApply(BackApplyInfo bean);
/**
* 插入领料任务明细
* @param bean
* @return int
*/
int upload(BackApplyInfo bean);
/**
* 详情
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> getView(BackApplyInfo bean);
/**
* back_apply_details
* @param bean
* @return AjaxResult
*/
AjaxResult setModify(BackApplyInfo bean);
/**
* del
* @param bean
* @return AjaxResult
*/
AjaxResult del(BackApplyInfo bean);
/**
* tm_task
* @param record
* @return AjaxResult
*/
AjaxResult audit(BackApplyInfo record);
/**
* tm_task
* @param record
* @return AjaxResult
*/
AjaxResult refuse(BackApplyInfo record);
/**
* 查询
* @param bean
* @return AjaxResult
*/
AjaxResult getUseTypeTree(BackApplyInfo bean);
/**
* 退料申请导出
* @param bean
* @return List<BackApplyInfo>
*/
List<BackApplyInfo> exportList(BackApplyInfo bean);
}

View File

@ -504,9 +504,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY
mt.type_id
) AS subquery2 ON subquery1.type_id = subquery2.type_id
WHERE
subquery1.out_num - COALESCE ( subquery2.audit_num, 0 )> 0) mt4 on mt4.typeId = mt.type_id
HAVING num> 0
) mt4 on mt4.typeId = mt.type_id
HAVING num is not null
UNION ALL
SELECT ma_type.type_id, ma_type.parent_id,ma_type.type_name as typeCode, ma_type.`level`,ma_type.unit_name,0 as
num