退料申请表数据问题修改
This commit is contained in:
parent
b9edcaf673
commit
85aecf7f66
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
||||||
* direct_apply_info 工地直转信息
|
* direct_apply_info 工地直转信息
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class DirectApplyInfo extends BaseEntity{
|
public class DirectApplyInfo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
|
|
@ -22,6 +22,41 @@ public class DirectApplyInfo extends BaseEntity{
|
||||||
* 退料单位协议
|
* 退料单位协议
|
||||||
*/
|
*/
|
||||||
private int backAgreementId;
|
private int backAgreementId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料工程id
|
||||||
|
*/
|
||||||
|
private String backProId;
|
||||||
|
/**
|
||||||
|
* 退料工程名称
|
||||||
|
*/
|
||||||
|
private String backProName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料单位id
|
||||||
|
*/
|
||||||
|
private String backUnitId;
|
||||||
|
/**
|
||||||
|
* 退料单位名称
|
||||||
|
*/
|
||||||
|
private String backUnitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领料工程id
|
||||||
|
*/
|
||||||
|
private String leaseProId;
|
||||||
|
/**
|
||||||
|
* 领料工程名称
|
||||||
|
*/
|
||||||
|
private String leaseProName;
|
||||||
|
/**
|
||||||
|
* 领料单位id
|
||||||
|
*/
|
||||||
|
private String leaseUnitId;
|
||||||
|
/**
|
||||||
|
* 领料单位名称
|
||||||
|
*/
|
||||||
|
private String leaseUnitName;
|
||||||
/**
|
/**
|
||||||
* 退料人
|
* 退料人
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.sgzb.material.controller;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
|
||||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||||
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;
|
||||||
|
|
@ -119,36 +120,64 @@ public class WorkSiteDirectManageController extends BaseController {
|
||||||
|
|
||||||
TmTask task = directApplyInfoDetails.getTask();
|
TmTask task = directApplyInfoDetails.getTask();
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
return AjaxResult.error("任务新建失败");
|
return AjaxResult.error("任务参数为空");
|
||||||
} else {
|
}
|
||||||
String code = tmTaskService.genderLeaseCode();
|
// 创建领料任务
|
||||||
if (StringUtils.isEmpty(code)) {
|
// 生成领料code
|
||||||
return AjaxResult.error("领料单号生成失败");
|
String lcode = tmTaskService.genderLeaseCode();
|
||||||
}
|
if (StringUtils.isEmpty(lcode)) {
|
||||||
task.setCode(code);
|
return AjaxResult.error("领料单号生成失败");
|
||||||
// 创建领料任务(tm_task)
|
}
|
||||||
int res1 = workSiteDirectManageService.insertLeaseApplyInfo(task);
|
task.setCode(lcode);
|
||||||
if (res1 == 0) {
|
// 创建领料任务(tm_task)
|
||||||
return AjaxResult.error("任务新建失败");
|
int res1 = workSiteDirectManageService.insertTmTask(task);
|
||||||
}
|
if (res1 == 0) {
|
||||||
|
return AjaxResult.error("领料任务新建失败");
|
||||||
|
}
|
||||||
|
|
||||||
//任务与协议建立关联关系 (tm_task_agreement)
|
//任务与协议建立关联关系 (tm_task_agreement)
|
||||||
int res2 = workSiteDirectManageService.insertAgreement(task);
|
int res2 = workSiteDirectManageService.insertAgreement(task);
|
||||||
if (res2 == 0) {
|
if (res2 == 0) {
|
||||||
return AjaxResult.error("协议建立失败");
|
return AjaxResult.error("协议建立失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
//新增领料信息和详情(lease_apply_info、lease_apply_details)
|
//新增领料信息和详情(lease_apply_info、lease_apply_details)
|
||||||
int res3 = workSiteDirectManageService.insertApplyInfoAndDetails(task);
|
int res3 = workSiteDirectManageService.insertApplyInfoAndDetails(task);
|
||||||
if (res3 == 0) {
|
if (res3 == 0) {
|
||||||
return AjaxResult.error("领料信息和详情新增失败");
|
return AjaxResult.error("领料信息和详情新增失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LeaseOutDetails leaseOutDetails = directApplyInfoDetails.getLeaseOutDetails();
|
||||||
|
if (leaseOutDetails == null) {
|
||||||
|
return AjaxResult.error("领料出库信息为空");
|
||||||
|
}
|
||||||
|
// 新增出库记录
|
||||||
|
int res4 = workSiteDirectManageService.insertLeaseOutDetail(leaseOutDetails);
|
||||||
|
if (res4 == 0) {
|
||||||
|
return AjaxResult.error("新增出库记录失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//创建退料任务
|
//创建退料任务
|
||||||
|
// 生成退料code
|
||||||
|
String tcode = tmTaskService.genderBackCode();
|
||||||
|
task.setCode(tcode);
|
||||||
|
//创建退料任务(tm_task)
|
||||||
|
int res5 = workSiteDirectManageService.insertTmTask(task);
|
||||||
|
if (res5 == 0) {
|
||||||
|
return AjaxResult.error("退料任务新建失败");
|
||||||
|
}
|
||||||
|
//任务与协议建立关联关系 (tm_task_agreement)
|
||||||
|
int res6 = workSiteDirectManageService.insertAgreement(task);
|
||||||
|
if (res6 == 0) {
|
||||||
|
return AjaxResult.error("协议建立失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增领料信息和详情(back_apply_info、back_apply_details)
|
||||||
|
int res7 = workSiteDirectManageService.insertBackApplyInfoAndDetails(task);
|
||||||
|
if (res7 == 0) {
|
||||||
|
return AjaxResult.error("退料信息和详情新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.material.domain;
|
||||||
|
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
|
||||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -21,4 +22,6 @@ public class DirectApplyInfoDetails extends BaseEntity {
|
||||||
private List<DirectApplyDetails> directApplyInfoDetails;
|
private List<DirectApplyDetails> directApplyInfoDetails;
|
||||||
|
|
||||||
private TmTask task;
|
private TmTask task;
|
||||||
|
|
||||||
|
private LeaseOutDetails leaseOutDetails;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package com.bonus.sgzb.material.mapper;
|
package com.bonus.sgzb.material.mapper;
|
||||||
|
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
import com.bonus.sgzb.base.api.domain.*;
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
|
||||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
|
||||||
import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
|
|
||||||
import com.bonus.sgzb.material.domain.LeaseApplyDetails;
|
import com.bonus.sgzb.material.domain.LeaseApplyDetails;
|
||||||
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
|
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
@ -44,4 +41,16 @@ public interface WorkSiteDirectManageMapper {
|
||||||
int batchInsert(List<LeaseApplyDetails> leaseApplyDetailsList);
|
int batchInsert(List<LeaseApplyDetails> leaseApplyDetailsList);
|
||||||
|
|
||||||
int batchDel(@Param("ids") ArrayList<Integer> ids);
|
int batchDel(@Param("ids") ArrayList<Integer> ids);
|
||||||
|
|
||||||
|
String getMachineStatus(LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
int updateLeaseApplyDetailsOutNum(@Param("record")LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
List<DirectApplyInfo> getListLease();
|
||||||
|
|
||||||
|
int updateMaTypeStockNum(@Param("record")LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
int updateMaMachineStatus(@Param("record")LeaseOutDetails leaseOutDetails);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,4 +66,6 @@ public interface TaskService
|
||||||
int insertSelective(TmTask task);
|
int insertSelective(TmTask task);
|
||||||
|
|
||||||
int insertAgreement(TmTask task);
|
int insertAgreement(TmTask task);
|
||||||
|
|
||||||
|
String genderBackCode();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package com.bonus.sgzb.material.service;
|
package com.bonus.sgzb.material.service;
|
||||||
|
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
import com.bonus.sgzb.base.api.domain.*;
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
|
||||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
|
||||||
import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
|
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.material.domain.TmTask;
|
import com.bonus.sgzb.material.domain.TmTask;
|
||||||
|
|
||||||
|
|
@ -27,9 +24,13 @@ public interface WorkSiteDirectManageService {
|
||||||
|
|
||||||
DirectApplyInfo getDirectApplyInfoById(String directApplyInfoDetails);
|
DirectApplyInfo getDirectApplyInfoById(String directApplyInfoDetails);
|
||||||
|
|
||||||
int insertLeaseApplyInfo(TmTask task);
|
int insertTmTask(TmTask task);
|
||||||
|
|
||||||
int insertAgreement(TmTask task);
|
int insertAgreement(TmTask task);
|
||||||
|
|
||||||
int insertApplyInfoAndDetails(TmTask task);
|
int insertApplyInfoAndDetails(TmTask task);
|
||||||
|
|
||||||
|
int insertLeaseOutDetail(LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
int insertBackApplyInfoAndDetails(TmTask task);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||||
import com.bonus.sgzb.material.domain.TmTask;
|
import com.bonus.sgzb.material.domain.TmTask;
|
||||||
|
import com.bonus.sgzb.material.vo.GlobalContants;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.sgzb.material.mapper.TaskMapper;
|
import com.bonus.sgzb.material.mapper.TaskMapper;
|
||||||
|
|
@ -125,4 +126,21 @@ public class TaskServiceImpl implements TaskService
|
||||||
public int insertAgreement(TmTask task) {
|
public int insertAgreement(TmTask task) {
|
||||||
return tmTaskMapper.insertAgreement(task);
|
return tmTaskMapper.insertAgreement(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String genderBackCode() {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Date nowDate = DateUtils.getNowDate();
|
||||||
|
String format = dateFormat.format(nowDate);
|
||||||
|
int taskNum = tmTaskMapper.selectTaskNumByMonth(nowDate, 36) + 1;
|
||||||
|
String code = "";
|
||||||
|
if (taskNum > GlobalContants.NUM1 && taskNum < GlobalContants.NUM2) {
|
||||||
|
code = "T" + format + "-00" + taskNum;
|
||||||
|
} else if (taskNum > GlobalContants.NUM3 && taskNum < GlobalContants.NUM4) {
|
||||||
|
code = "T" + format + "-0" + taskNum;
|
||||||
|
} else {
|
||||||
|
code = "T" + format + "-000" + taskNum;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,13 @@ package com.bonus.sgzb.material.service.impl;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
|
||||||
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
|
||||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
import com.bonus.sgzb.material.domain.LeaseApplyDetails;
|
import com.bonus.sgzb.material.domain.LeaseApplyDetails;
|
||||||
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
|
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
|
||||||
import com.bonus.sgzb.material.domain.TmTask;
|
import com.bonus.sgzb.material.domain.TmTask;
|
||||||
|
|
@ -24,6 +27,7 @@ import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:梁超
|
* @Author:梁超
|
||||||
|
|
@ -82,7 +86,8 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insertLeaseApplyInfo(TmTask task) {
|
@Transactional(rollbackFor=Exception.class)
|
||||||
|
public int insertTmTask(TmTask task) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
if (StringUtils.isNull(task)) {
|
if (StringUtils.isNull(task)) {
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -98,6 +103,7 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor=Exception.class)
|
||||||
public int insertAgreement(TmTask task) {
|
public int insertAgreement(TmTask task) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
boolean b = tmTaskService.insertAgreement(task) > 0;
|
boolean b = tmTaskService.insertAgreement(task) > 0;
|
||||||
|
|
@ -108,6 +114,7 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor=Exception.class)
|
||||||
public int insertApplyInfoAndDetails(TmTask task) {
|
public int insertApplyInfoAndDetails(TmTask task) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
if (task.getLeaseApplyInfo() != null) {
|
if (task.getLeaseApplyInfo() != null) {
|
||||||
|
|
@ -166,4 +173,125 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int insertLeaseOutDetail(LeaseOutDetails leaseOutDetails) {
|
||||||
|
int res = 0;
|
||||||
|
String maStatus = "15";
|
||||||
|
double outNum = 0.1;
|
||||||
|
if (StringUtils.isNull(leaseOutDetails)) {
|
||||||
|
log.info("领料出库失败,请检查参数是否填写完整!");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
if (!(Objects.equals(Integer.valueOf(0), leaseOutDetails.getMaId()) || leaseOutDetails.getMaId() == null)) {
|
||||||
|
String status = workSiteDirectManageMapper.getMachineStatus(leaseOutDetails);
|
||||||
|
if (!maStatus.equals(status)) {
|
||||||
|
log.info("领料出库失败,该设备不是在库状态!");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 首先更新领料任务详情表的领料数及状态
|
||||||
|
leaseOutDetails.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
|
||||||
|
/* int updateLeaseApplyDetailsOutNum = workSiteDirectManageMapper.updateLeaseApplyDetailsOutNum(leaseOutDetails);
|
||||||
|
if (updateLeaseApplyDetailsOutNum < 1) {
|
||||||
|
return res;
|
||||||
|
}*/
|
||||||
|
// 插入领料出库明细表
|
||||||
|
int insertSelectiveNum = workSiteDirectManageMapper.insertLeaseOutDetails(leaseOutDetails);
|
||||||
|
if (insertSelectiveNum < 1) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
// 减少 (ma_type 设备规格表)的库存数量
|
||||||
|
int updateMaTypeStockNum = workSiteDirectManageMapper.updateMaTypeStockNum(leaseOutDetails);
|
||||||
|
if (updateMaTypeStockNum < 1) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
// 更新 (ma_machine 设备表)的状态
|
||||||
|
int updateMaMachineNum = workSiteDirectManageMapper.updateMaMachineStatus(leaseOutDetails);
|
||||||
|
if (updateMaMachineNum < 1) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res = 1;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int insertBackApplyInfoAndDetails(TmTask task) {
|
||||||
|
/* boolean addLeaseTaskResult = false;
|
||||||
|
Long backApplyInfoId = 0L;
|
||||||
|
|
||||||
|
try {
|
||||||
|
task.setTaskType(36);
|
||||||
|
task.setTaskStatus(37);
|
||||||
|
// 创建任务
|
||||||
|
boolean addTaskResult = workSiteDirectManageMapper.insertSelective(task) > 0;
|
||||||
|
if (addTaskResult && bean.getTaskId() != null) {
|
||||||
|
//任务协议表(tm_task_agreement)
|
||||||
|
Boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean) > 0;
|
||||||
|
if (addTaskAgreementRes && bean.getBackApplyInfo() != null) {
|
||||||
|
if (CollUtil.isEmpty(bean.getBackApplyDetails())) {
|
||||||
|
return AjaxResult.error("退料设备明细为空,请重新选择后上传!");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNull(bean.getBackApplyInfo())) {
|
||||||
|
return AjaxResult.error("退料任务信息为空,请重新选择后上传!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer taskId = bean.getTaskId();
|
||||||
|
// 根据设备所属分公司拆分集合
|
||||||
|
List<List<BackApplyInfo>> backApplyInfoList = CollUtil.groupByField(bean.getBackApplyDetails(), "companyId");
|
||||||
|
// 判断拆分后的集合内是否有数据
|
||||||
|
if (CollUtil.isNotEmpty(backApplyInfoList)) {
|
||||||
|
// 对拆分后的集合进行each遍历
|
||||||
|
for (List<BackApplyInfo> leaseApplyDetailsList : backApplyInfoList) {
|
||||||
|
BackApplyInfo backApplyInfo1 = leaseApplyDetailsList.get(0);
|
||||||
|
// 对领料任务表的对象做数据处理
|
||||||
|
BackApplyInfo backApplyInfo = bean.getBackApplyInfo();
|
||||||
|
*//* 创建领料单号*//*
|
||||||
|
backApplyInfo.setCode(code);
|
||||||
|
*//*设置任务ID*//*
|
||||||
|
backApplyInfo.setTaskId(taskId);
|
||||||
|
*//*设置设备所属分公司,用于交给哪家审核*//*
|
||||||
|
backApplyInfo.setCompanyId(backApplyInfo1.getCompanyId());
|
||||||
|
// 创建领料任务,返回领料任务编号
|
||||||
|
addLeaseTaskResult = backApplyService.insertBackApply(backApplyInfo) > 0;
|
||||||
|
// 领料任务编号
|
||||||
|
backApplyInfoId = backApplyInfo.getId();
|
||||||
|
|
||||||
|
// 领料任务创建完成,进行领料任务明细插入
|
||||||
|
if (addLeaseTaskResult) {
|
||||||
|
if (StringUtils.isNotNull(backApplyInfoId)) {
|
||||||
|
for (BackApplyInfo leaseApplyDetails : leaseApplyDetailsList) {
|
||||||
|
*//* 设置领料任务ID*//*
|
||||||
|
leaseApplyDetails.setId(backApplyInfoId);
|
||||||
|
// 插入领料任务明细
|
||||||
|
boolean addLeaseTaskDetailsResult = backApplyService.upload(leaseApplyDetails) > 0;
|
||||||
|
if (!addLeaseTaskDetailsResult) {
|
||||||
|
return AjaxResult.error("退料任务创建成功,但退料任务明细插入失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("退料任务编号为空");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建退料任务失败,或退料明细为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败,缺少数据");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("创建任务失败," + e.getCause().toString() + "," + e.getMessage());
|
||||||
|
}
|
||||||
|
return AjaxResult.success("退料任务创建成功");*/
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,26 @@
|
||||||
WHERE
|
WHERE
|
||||||
parennt_id = #{record.parentId} and type_id = #{record.typeId}
|
parennt_id = #{record.parentId} and type_id = #{record.typeId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateMaTypeStockNum">
|
||||||
|
UPDATE
|
||||||
|
ma_type
|
||||||
|
SET
|
||||||
|
num = num - #{record.outNum} ,update_time = NOW()
|
||||||
|
WHERE
|
||||||
|
type_id = #{record.typeId}
|
||||||
|
</update>
|
||||||
|
<update id="updateMaMachineStatus">
|
||||||
|
UPDATE
|
||||||
|
ma_machine
|
||||||
|
SET
|
||||||
|
ma_status = '16' , create_time = NOW()
|
||||||
|
<where>
|
||||||
|
type_id = #{record.typeId}
|
||||||
|
<if test="record.maId != null and record.maId != ''">
|
||||||
|
and ma_id = #{record.maId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</update>
|
||||||
<delete id="batchDel">
|
<delete id="batchDel">
|
||||||
delete
|
delete
|
||||||
from lease_user_book
|
from lease_user_book
|
||||||
|
|
@ -329,7 +349,24 @@
|
||||||
sai.type_id,sai.ma_id
|
sai.type_id,sai.ma_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getList" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
<select id="getList" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
||||||
select * from direct_apply_info
|
SELECT DISTINCT
|
||||||
|
dai.*,
|
||||||
|
bpl.lot_id AS backProId,
|
||||||
|
bpl.lot_name AS backProName,
|
||||||
|
bui.unit_id AS backUnitId,
|
||||||
|
bui.unit_name AS backUnitName,
|
||||||
|
bpl1.lot_id AS leaseProId,
|
||||||
|
bpl1.lot_name AS leaseProName,
|
||||||
|
bui1.unit_id AS leaseUnitId,
|
||||||
|
bui1.unit_name AS leaseUnitName
|
||||||
|
FROM
|
||||||
|
direct_apply_info dai
|
||||||
|
LEFT JOIN bm_agreement_info bai ON dai.back_agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_agreement_info bai1 ON dai.lease_agreement_id = bai1.agreement_id
|
||||||
|
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
|
||||||
|
LEFT JOIN bm_project_lot bpl1 ON bpl1.lot_id = bai1.project_id
|
||||||
|
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN bm_unit_info bui1 ON bui1.unit_id = bai1.unit_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getDirectApplyInfoById" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
<select id="getDirectApplyInfoById" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
||||||
select * from direct_apply_info where id = #{id}
|
select * from direct_apply_info where id = #{id}
|
||||||
|
|
@ -339,4 +376,14 @@
|
||||||
from ma_machine
|
from ma_machine
|
||||||
where ma_id = #{maId}
|
where ma_id = #{maId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getListLease" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
|
||||||
|
SELECT DISTINCT
|
||||||
|
bpl.lot_id as backProId,bpl.lot_name as backProName,
|
||||||
|
bui.unit_id as backUnitId,bui.unit_name as backUnitName
|
||||||
|
FROM
|
||||||
|
direct_apply_info dai
|
||||||
|
LEFT JOIN bm_agreement_info bai ON dai.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue