Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
b23b0aa7eb
|
|
@ -86,4 +86,8 @@ public class BackApplyInfo {
|
||||||
private String lotId;
|
private String lotId;
|
||||||
private String unitId;
|
private String unitId;
|
||||||
private String backTime;
|
private String backTime;
|
||||||
|
/**
|
||||||
|
* 机具管理方式
|
||||||
|
*/
|
||||||
|
private String manageType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,12 @@
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.16</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.bonus.sgzb.material.controller;
|
package com.bonus.sgzb.material.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
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.domain.AjaxResult;
|
||||||
|
|
@ -107,42 +110,67 @@ public class BackApplyController extends BaseController {
|
||||||
bean.setTaskStatus("37");
|
bean.setTaskStatus("37");
|
||||||
// 创建任务
|
// 创建任务
|
||||||
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
||||||
|
|
||||||
if (addTaskResult && bean.getTaskId() != null) {
|
if (addTaskResult && bean.getTaskId() != null) {
|
||||||
//任务协议表(tm_task_agreement)
|
//任务协议表(tm_task_agreement)
|
||||||
Boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean)>0;
|
Boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean) > 0;
|
||||||
if (addTaskAgreementRes){
|
if (addTaskAgreementRes && bean.getBackApplyInfo() != null) {
|
||||||
//退料任务表(back_apply_info)
|
if (CollUtil.isEmpty(bean.getBackApplyDetails())) {
|
||||||
Boolean addBackApply=backApplyService.insertBackApply(bean)>0;
|
return AjaxResult.error("退料设备明细为空,请重新选择后上传!");
|
||||||
if (addBackApply && bean.getId()!=null){
|
|
||||||
if (!StringUtils.isEmpty(bean.getTypeId()) && !StringUtils.isEmpty(bean.getNum())){
|
|
||||||
String[] typeId = bean.getTypeId().split(",");
|
|
||||||
String[] num = bean.getNum().split(",");
|
|
||||||
for (int i=0;i< typeId.length;i++){
|
|
||||||
String typeIdStr=typeId[i];
|
|
||||||
String numStr=num[i];
|
|
||||||
bean.setTypeId(typeIdStr);
|
|
||||||
bean.setNum(numStr);
|
|
||||||
int re =backApplyService.upload(bean);
|
|
||||||
if (re<1){
|
|
||||||
return AjaxResult.error("退料申请详情创建失败");
|
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNull(bean.getBackApplyInfo())) {
|
||||||
|
return AjaxResult.error("退料任务信息为空,请重新选择后上传!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer taskId = bean.getTaskId();
|
||||||
|
// 根据设备所属分公司拆分集合
|
||||||
|
List<List<BackApplyInfo>> backApplyInfoList = CollUtil.groupByField(bean.getBackApplyDetails(), "companyId");
|
||||||
|
// 对拆分后的集合进行each遍历
|
||||||
|
for (List<BackApplyInfo> leaseApplyDetailsList : backApplyInfoList) {
|
||||||
|
// 判断拆分后的集合内是否有数据
|
||||||
|
if (CollUtil.isNotEmpty(leaseApplyDetailsList)) {
|
||||||
|
// 对领料任务表的对象做数据处理
|
||||||
|
BackApplyInfo backApplyInfo = bean.getBackApplyInfo();
|
||||||
|
backApplyInfo.setCode(code); // 创建领料单号
|
||||||
|
backApplyInfo.setTaskId(taskId); // 设置任务ID
|
||||||
|
backApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
|
||||||
|
|
||||||
|
// 创建领料任务,返回领料任务编号
|
||||||
|
boolean addLeaseTaskResult = backApplyService.insertBackApply(backApplyInfo) > 0;
|
||||||
|
// 领料任务创建完成,进行领料任务明细插入
|
||||||
|
if (addLeaseTaskResult) {
|
||||||
|
// 领料任务编号
|
||||||
|
Long backApplyInfoId = backApplyInfo.getId();
|
||||||
|
if (StringUtils.isNotNull(backApplyInfoId)) {
|
||||||
|
for (BackApplyInfo leaseApplyDetails : leaseApplyDetailsList) {
|
||||||
|
leaseApplyDetails.setId(backApplyInfoId); // 设置领料任务ID
|
||||||
|
// 插入领料任务明细
|
||||||
|
boolean addLeaseTaskDetailsResult = backApplyService.upload(leaseApplyDetails) > 0;
|
||||||
|
if (!addLeaseTaskDetailsResult) {
|
||||||
|
return AjaxResult.error("退料任务创建成功,但退料任务明细插入失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success("退料申请成功,已完成");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("退料任务编号为空");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建退料任务失败,或退料明细为空");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
return AjaxResult.error("未获取到物料类型或数量");
|
return AjaxResult.error("创建任务失败,缺少数据");
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
return AjaxResult.error("创建退料申请失败");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
return AjaxResult.error("创建任务协议失败");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("创建任务失败");
|
return AjaxResult.error("创建任务失败");
|
||||||
}
|
}
|
||||||
return AjaxResult.success("退料申请创建成功,已完成");
|
}else {
|
||||||
|
return AjaxResult.error("创建任务失败");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return AjaxResult.error("创建任务失败," + e.getCause().toString() + "," + e.getMessage());
|
return AjaxResult.error("创建任务失败," + e.getCause().toString() + "," + e.getMessage());
|
||||||
}
|
}
|
||||||
|
return AjaxResult.error("任务创建失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.sgzb.material.domain;
|
package com.bonus.sgzb.material.domain;
|
||||||
|
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
|
||||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
@ -7,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 退料
|
* @description 退料
|
||||||
|
|
@ -164,4 +166,23 @@ public class BackApplyInfo extends BaseEntity {
|
||||||
@ApiModelProperty(value = "等级")
|
@ApiModelProperty(value = "等级")
|
||||||
private String level;
|
private String level;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料任务实体
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value="退料任务实体")
|
||||||
|
private BackApplyInfo backApplyInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料任务实体集合
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value="退料任务实体集合")
|
||||||
|
private List<BackApplyInfo> backApplyInfoList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料任务实体集合
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value="退料任务实体集合")
|
||||||
|
private List<BackApplyInfo> backApplyDetails;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.sgzb.material.mapper;
|
package com.bonus.sgzb.material.mapper;
|
||||||
|
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
||||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="upload">
|
<insert id="upload" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||||
insert into back_apply_details
|
insert into back_apply_details
|
||||||
(
|
(
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue