领料接口优化
This commit is contained in:
parent
a24d84e624
commit
4e3520aa3d
|
|
@ -193,6 +193,12 @@
|
|||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.22</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -55,4 +55,8 @@ public class MaterialConstants {
|
|||
/** 领料单号的开头字母 */
|
||||
public static final String LEASE_TASK_TYPE_LABEL = "L";
|
||||
|
||||
public static final String INNER_PROTOCAL = "1"; //内部单位协议
|
||||
|
||||
public static final String OUTER_PROTOCAL = "2"; //外部单位协议
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,159 @@
|
|||
package com.bonus.common.biz.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpHelper {
|
||||
|
||||
public static String sendHttpPost(String url, String JSONBody) throws Exception {
|
||||
System.out.println("JSONBody-=========:" + JSONBody);
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.addHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
httpPost.setEntity(new StringEntity(JSONBody,StandardCharsets.UTF_8));
|
||||
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||
HttpEntity entity = response.getEntity();
|
||||
String responseContent = EntityUtils.toString(entity, StandardCharsets.UTF_8);
|
||||
response.close();
|
||||
httpClient.close();
|
||||
return responseContent;
|
||||
}
|
||||
|
||||
public static String sendHttpPost(String url,String token,String content,String intelligentAppKey) throws Exception {
|
||||
System.out.println("JSONBody-=========:" + content);
|
||||
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
||||
HttpPost post = new HttpPost(url);
|
||||
post.setHeader("token", token);
|
||||
post.setHeader("appKey", intelligentAppKey);
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
builder.addBinaryBody("params", content.getBytes());
|
||||
post.setEntity(builder.build());
|
||||
|
||||
CloseableHttpResponse response = client.execute(post);
|
||||
HttpEntity entity = response.getEntity();
|
||||
String responseContent = EntityUtils.toString(entity, StandardCharsets.UTF_8);
|
||||
response.close();
|
||||
return responseContent;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String doPost(String urlString,String param) {
|
||||
HttpURLConnection connection = null;
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
BufferedReader br = null;
|
||||
String result = null;
|
||||
try {
|
||||
URL url = new URL(urlString);
|
||||
// 通过远程url连接对象打开连接
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
// 设置连接请求方式
|
||||
connection.setRequestMethod("POST");
|
||||
// 设置连接主机服务器超时时间:15000毫秒
|
||||
connection.setConnectTimeout(15000);
|
||||
// 设置读取主机服务器返回数据超时时间:60000毫秒
|
||||
connection.setReadTimeout(60000);
|
||||
|
||||
// 默认值为:false,当向远程服务器传送数据/写数据时,需要设置为true
|
||||
connection.setDoOutput(true);
|
||||
// 默认值为:true,当前向远程服务读取数据时,设置为true,该参数可有可无
|
||||
connection.setDoInput(true);
|
||||
// 设置传入参数的格式:请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
// 设置鉴权信息:Authorization: Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0
|
||||
connection.setRequestProperty("Authorization", "Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0");
|
||||
// 通过连接对象获取一个输出流
|
||||
os = connection.getOutputStream();
|
||||
// 通过输出流对象将参数写出去/传输出去,它是通过字节数组写出的
|
||||
os.write(param.getBytes());
|
||||
// 通过连接对象获取一个输入流,向远程读取
|
||||
if (connection.getResponseCode() == 200) {
|
||||
|
||||
is = connection.getInputStream();
|
||||
// 对输入流对象进行包装:charset根据工作项目组的要求来设置
|
||||
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
|
||||
StringBuffer sbf = new StringBuffer();
|
||||
String temp = null;
|
||||
// 循环遍历一行一行读取数据
|
||||
while ((temp = br.readLine()) != null) {
|
||||
sbf.append(temp);
|
||||
sbf.append("\r\n");
|
||||
}
|
||||
result = sbf.toString();
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// 关闭资源
|
||||
if (null != br) {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != os) {
|
||||
try {
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != is) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// 断开与远程地址url的连接
|
||||
connection.disconnect();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// public static String getIotToken() {
|
||||
// Map<String,Object> map=new HashMap<>();
|
||||
// String redisCode = null;
|
||||
// map.put("type", UserConstants.IOT_TYPE);
|
||||
// map.put("from",UserConstants.IOT_FROM);
|
||||
// map.put("username",UserConstants.IOT_USERNAME);
|
||||
// //采用md5加密
|
||||
// map.put("password",UserConstants.IOT_PASSWORD);
|
||||
// String param = JSON.toJSONString(map);
|
||||
// String resultUser = HttpHelper.doPost(HttpStatus.LOGIN_URL,param);
|
||||
// if (resultUser == null){
|
||||
// throw new RuntimeException("返回数据为空!!");
|
||||
// }
|
||||
// JSONObject object = JSONObject.parseObject(resultUser);
|
||||
// if ("0".equals(object.getString("status"))){
|
||||
// redisCode = object.getString("token");
|
||||
// }else {
|
||||
// throw new RuntimeException("返回数据为空!!");
|
||||
// }
|
||||
// return redisCode;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -65,4 +65,6 @@ public class LeaseOutDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "出库类型 0编码出库 1数量出库 2成套出库")
|
||||
private Integer manageType;
|
||||
|
||||
@ApiModelProperty(value = "数量出库-出库数量")
|
||||
private Long inputNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,6 @@ public interface LeaseApplyDetailsMapper {
|
|||
public int deleteLeaseApplyDetailsByIds(Long[] ids);
|
||||
|
||||
public int deleteLeaseApplyDetailsByParentIds(Long[] ids);
|
||||
|
||||
List<LeaseApplyDetails> getByParentId(Long parentId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
package com.bonus.material.lease.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.domain.LeaseOutDetails;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 领料出库详细Mapper接口
|
||||
|
|
@ -57,4 +62,20 @@ public interface LeaseOutDetailsMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteLeaseOutDetailsByIds(Long[] ids);
|
||||
|
||||
String getMachineStatus(LeaseOutDetails record);
|
||||
|
||||
LeaseApplyDetails getOutboundNum(LeaseOutDetails record);
|
||||
|
||||
String getTaskId(Long parentId);
|
||||
|
||||
int getmaChineByCt(LeaseOutDetails record);
|
||||
|
||||
List<TmTask> getMaTypeDetails(LeaseOutDetails record);
|
||||
|
||||
int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status);
|
||||
|
||||
Type selectByTypeId(@Param("record") LeaseOutDetails record);
|
||||
|
||||
int getCountOfCodeMachine(@Param("record") LeaseOutDetails record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
PurchaseTaskStatusEnum.TO_NOTICE.getStatus(),
|
||||
tmTaskRequestVo.getLeaseApplyInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode);
|
||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
tmTask.setCreateBy(SecurityUtils.getUsername());
|
||||
tmTaskMapper.insertTmTask(tmTask);
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), tmTaskRequestVo.getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
|
|
|
|||
|
|
@ -1,9 +1,25 @@
|
|||
package com.bonus.material.lease.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.utils.HttpHelper;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.lease.mapper.LeaseOutDetailsMapper;
|
||||
|
|
@ -18,10 +34,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
* @date 2024-10-16
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||
@Autowired
|
||||
private LeaseOutDetailsMapper leaseOutDetailsMapper;
|
||||
|
||||
@Autowired
|
||||
LeaseApplyDetailsMapper leaseApplyDetailsMapper;
|
||||
|
||||
/**
|
||||
* 查询领料出库详细
|
||||
*
|
||||
|
|
@ -57,7 +77,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
// if (ajaxResult.isError()) {
|
||||
// return ajaxResult;
|
||||
// }
|
||||
leaseOutDetailsMapper.insertLeaseOutDetails(bean);
|
||||
//leaseOutDetailsMapper.insertLeaseOutDetails(bean);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
|
@ -145,7 +165,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
// if (res == 0) {
|
||||
// throw new RuntimeException("出库失败,插入结算记录失败");
|
||||
// }
|
||||
// record.setPostStoreNum(getStorageNum(record));
|
||||
// //record.setPostStoreNum(getStorageNum(record));
|
||||
// } else {
|
||||
// return AjaxResult.error("领料出库失败,机具库存不足");
|
||||
// }
|
||||
|
|
@ -157,29 +177,168 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
// }
|
||||
// return AjaxResult.success("出库成功");
|
||||
// }
|
||||
//
|
||||
// private int checkRepeatSubmit(LeaseOutDetails record) {
|
||||
// String maStatus = "15";
|
||||
// int res = 0;
|
||||
// if (record.getManageType() == 1 || record.getManageType() == 2) {
|
||||
// // 如果是数量出库校验待出库数量
|
||||
// LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
|
||||
// if (details == null) {
|
||||
// return res;
|
||||
// } else {
|
||||
// res = 1;
|
||||
// }
|
||||
// } else {
|
||||
// // 如果是编码出库判断是否在库
|
||||
// if (!(Objects.equals(0, record.getMaId()) || record.getMaId() == null)) {
|
||||
// String status = leaseOutDetailsMapper.getMachineStatus(record);
|
||||
// if (!maStatus.equals(status)) {
|
||||
// return res;
|
||||
// } else {
|
||||
// res = 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return res;
|
||||
// }
|
||||
|
||||
private int checkRepeatSubmit(LeaseOutDetails record) {
|
||||
String maStatus = "15";
|
||||
int res = 0;
|
||||
if (record.getManageType() == 1 || record.getManageType() == 2) {
|
||||
// 如果是数量出库校验待出库数量
|
||||
LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
|
||||
if (details == null) {
|
||||
return res;
|
||||
} else {
|
||||
res = 1;
|
||||
}
|
||||
} else {
|
||||
// 如果是编码出库判断是否在库
|
||||
if (!(Objects.equals(0, record.getMaId()) || record.getMaId() == null)) {
|
||||
String status = leaseOutDetailsMapper.getMachineStatus(record);
|
||||
if (!maStatus.equals(status)) {
|
||||
return res;
|
||||
} else {
|
||||
res = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int checkStorageNumCt(LeaseOutDetails record) {
|
||||
int res = 0;
|
||||
double outNum = 0.1;
|
||||
if (StringUtils.isNull(record)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (record.getOutNum() == null || record.getOutNum() < outNum) {
|
||||
record.setOutNum(0L);
|
||||
}
|
||||
//先判断成套机具的库存是否足够
|
||||
int num = leaseOutDetailsMapper.getmaChineByCt(record);
|
||||
if (num < record.getOutNum()) {
|
||||
return res;
|
||||
}
|
||||
//判断(ma_type 设备规格表)中的库存够不够出库的
|
||||
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
||||
typeIds.removeIf(item -> item == null);
|
||||
// for (TmTask typeId : typeIds) {
|
||||
// MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
|
||||
// machinePart.setPartNum((typeId.getPartNum() * record.getOutNum()));
|
||||
// if (machinePart.getNum() < machinePart.getPartNum()) {
|
||||
// return res;
|
||||
// }
|
||||
// }
|
||||
return 1;
|
||||
}
|
||||
|
||||
private int updateTaskStatus(LeaseOutDetails record) {
|
||||
int res = 0;
|
||||
// 进行状态判断
|
||||
List<LeaseApplyDetails> leaseApplyDetailsList = leaseApplyDetailsMapper.getByParentId(record.getParentId());
|
||||
int i = 0;
|
||||
for (LeaseApplyDetails bean : leaseApplyDetailsList) {
|
||||
if (Objects.equals(bean.getPreNum(), bean.getAlNum())) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
|
||||
if (i == leaseApplyDetailsList.size()) {
|
||||
leaseOutDetailsMapper.updateTaskStatus(taskId, 35);
|
||||
res = 1;
|
||||
} else {
|
||||
leaseOutDetailsMapper.updateTaskStatus(taskId, 34);
|
||||
res = 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int checkStorageNum(LeaseOutDetails record) {
|
||||
double outNum = 0.1;
|
||||
if (StringUtils.isNull(record)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (record.getOutNum() == null || record.getOutNum() < outNum) {
|
||||
record.setOutNum(0L);
|
||||
}
|
||||
//判断(ma_type 设备规格表)中的库存够不够出库的
|
||||
Type maType = leaseOutDetailsMapper.selectByTypeId(record);
|
||||
if (maType != null) {
|
||||
if ("0".equals(maType.getManageType())) {
|
||||
int count = leaseOutDetailsMapper.getCountOfCodeMachine(record);
|
||||
if (BigDecimal.valueOf(count).compareTo(BigDecimal.valueOf(record.getOutNum())) < 0) {
|
||||
return 0;
|
||||
}
|
||||
} else if ("1".equals(maType.getManageType())) {
|
||||
if (maType.getStorageNum() == null || maType.getStorageNum().compareTo(record.getOutNum()) < 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// private int insertRecords(LeaseOutDetails record) {
|
||||
// int res = 0;
|
||||
// // 首先更新领料任务详情表的领料数及状态(lease_apply_details)
|
||||
// res = leaseOutDetailsMapper.updateLeaseApplyDetailsOutNum(record);
|
||||
// LeaseApplyDetails leaseApplyDetails = leaseOutDetailsMapper.getLeaseApplyDetails(record);
|
||||
// if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) {
|
||||
// leaseOutDetailsMapper.updateLeaseApplyDetails(record);
|
||||
// }
|
||||
// if (res > 0) {
|
||||
// // 插入领料出库明细表(lease_out_details)
|
||||
// res = leaseOutDetailsMapper.insertSelective(record);
|
||||
// if (res > 0) {
|
||||
// if (record.getManageType() == 2) {
|
||||
// // 成套机具减少 (ma_type 设备规格表)的库存数量
|
||||
// res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
||||
// // 成套机具减少 (ma_type 设备规格表)配件的库存数量
|
||||
// List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
||||
// typeIds.removeIf(item -> item == null);
|
||||
//// for (TmTask typeId : typeIds) {
|
||||
//// MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
|
||||
//// machinePart.setPartNum((typeId.getPartNum() * record.getOutNum()));
|
||||
//// typeId.setNum(machinePart.getNum() - machinePart.getPartNum());
|
||||
//// res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId);
|
||||
//// }
|
||||
// } else {
|
||||
// // 普通机具减少 (ma_type 设备规格表)的库存数量
|
||||
// res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
||||
// }
|
||||
// // 更新 (ma_machine 设备表)的状态
|
||||
// leaseOutDetailsMapper.updateMaMachineStatus(record);
|
||||
// }
|
||||
// }
|
||||
// return res;
|
||||
// }
|
||||
//
|
||||
// public int insSltInfo(String taskId, LeaseOutDetails record) {
|
||||
// int res = 0;
|
||||
// SltAgreementInfo sltAgreementInfo = leaseOutDetailsMapper.getSltAgreementInfo(record);
|
||||
// if (sltAgreementInfo != null) {
|
||||
// Long num = sltAgreementInfo.getNum();
|
||||
// Long outNum = record.getOutNum();
|
||||
// sltAgreementInfo.setNum(num + outNum);
|
||||
// res = leaseOutDetailsMapper.updSltInfo(sltAgreementInfo);
|
||||
// } else {
|
||||
// String agreementId = leaseOutDetailsMapper.getAgreementId(taskId);
|
||||
// String protocol = leaseOutDetailsMapper.getProtocol(agreementId);
|
||||
// Type ma = leaseOutDetailsMapper.getMaType(record.getTypeId());
|
||||
// if (StringUtils.isEmpty(protocol)) {
|
||||
// ma.setFinalPrice(ma.getLeasePrice());
|
||||
// } else {
|
||||
// if (MaterialConstants.INNER_PROTOCAL.equals(protocol)) {
|
||||
// ma.setFinalPrice(ma.getLeasePrice());
|
||||
// } else if (Constants.OUTER_PROTOCAL.equals(protocol)) {
|
||||
// ma.setFinalPrice(ma.getRentPrice());
|
||||
// } else {
|
||||
// ma.setFinalPrice(ma.getLeasePrice());
|
||||
// }
|
||||
// }
|
||||
// res = leaseOutDetailsMapper.insSltInfo(record, agreementId, ma);
|
||||
// }
|
||||
// return res;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="companyId" column="company_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, parent_id, type_id, pre_num, al_num, `status`, create_by, create_time, update_by, update_time, remark, company_id
|
||||
</sql>
|
||||
|
||||
<sql id="selectLeaseApplyDetailsVo">
|
||||
select id, parent_id, type_id, pre_num, audit_num, al_num, status, create_by, create_time, update_by, update_time, remark, company_id from lease_apply_details
|
||||
</sql>
|
||||
|
|
@ -127,4 +132,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="getByParentId" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from lease_apply_details
|
||||
where parennt_id = #{parentId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -107,4 +107,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getMachineStatus" resultType="java.lang.String">
|
||||
select ma_status
|
||||
from ma_machine
|
||||
where ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
<select id="getOutboundNum" resultType="com.bonus.material.lease.domain.LeaseOutDetails">
|
||||
SELECT pre_num AS preNum,
|
||||
pre_num - IFNULL(al_num, 0) AS nums
|
||||
FROM lease_apply_details
|
||||
WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0
|
||||
</select>
|
||||
|
||||
<select id="getTaskId" resultType="java.lang.String">
|
||||
select task_id
|
||||
from lease_apply_info
|
||||
where id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="getmaChineByCt" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
CASE mt.manage_type
|
||||
WHEN 0 THEN
|
||||
IFNULL(subquery0.num, 0)
|
||||
ELSE
|
||||
IFNULL(mt.num, 0)
|
||||
END as num
|
||||
FROM ma_type mt
|
||||
left join (SELECT mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
count(mm.ma_id) num
|
||||
FROM ma_machine mm
|
||||
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
WHERE mm.ma_code is not null and mm.ma_status in (15)
|
||||
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
|
||||
WHERE mt.del_flag = '0' and mt.type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<select id="getMaTypeDetails" resultType="com.bonus.material.task.domain.TmTask">
|
||||
SELECT
|
||||
mws2.type_id AS typeId,
|
||||
mws2.part_num AS partNum
|
||||
FROM
|
||||
ma_type mt1
|
||||
LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
|
||||
WHERE
|
||||
mt1.type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<update id="updateTaskStatus">
|
||||
update tm_task
|
||||
set task_status = #{status},
|
||||
update_time = NOW()
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<select id="selectByTypeId" resultType="com.bonus.material.ma.domain.Type">
|
||||
select * from ma_type WHERE
|
||||
type_id = #{record.typeId}
|
||||
</select>
|
||||
|
||||
<select id="getCountOfCodeMachine" resultType="java.lang.Integer">
|
||||
select count(mm.ma_id)
|
||||
FROM ma_type mt
|
||||
left join ma_machine mm on mm.type_id=mt.type_id
|
||||
WHERE
|
||||
mm.type_id = #{record.typeId}
|
||||
and mm.ma_code is not null
|
||||
and mm.ma_status in (15)
|
||||
and mt.`level` = 4
|
||||
and mt.del_flag = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue