This commit is contained in:
zhouzy062 2023-12-24 02:23:13 +08:00
commit 94b692e241
18 changed files with 1314 additions and 18 deletions

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.base.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -63,6 +64,12 @@ public class LeaseApplyDetails implements Serializable {
@ApiModelProperty(value = "已领数量")
private Double alNum;
/**
* 此数量是剩余需要出库的数量preNum - alNum
*/
@ApiModelProperty(value = "剩余最大出库数量")
private Double outNum;
/** 审批数量 */
@ApiModelProperty(value = "审批数量")
private Double auditNum;
@ -84,6 +91,7 @@ public class LeaseApplyDetails implements Serializable {
*/
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
@ -97,6 +105,7 @@ public class LeaseApplyDetails implements Serializable {
*/
@ApiModelProperty(value = "更新时间 ")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.base.api.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -121,6 +122,7 @@ public class LeaseApplyInfo implements Serializable {
*/
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
@ -134,6 +136,7 @@ public class LeaseApplyInfo implements Serializable {
*/
@ApiModelProperty(value = "更新时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.base.api.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -62,6 +63,7 @@ public class LeaseOutDetails implements Serializable {
/** 创建时间 */
@ApiModelProperty(value = "创建时间")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
@ -70,6 +72,7 @@ public class LeaseOutDetails implements Serializable {
/** 更新时间 */
@ApiModelProperty(value = "更新时间")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 备注 */

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.base.api.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -83,6 +84,7 @@ public class TmTask implements Serializable {
*/
@ApiModelProperty(value="创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
@ -96,6 +98,7 @@ public class TmTask implements Serializable {
*/
@ApiModelProperty(value="更新时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
@ -197,7 +200,6 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="公司审批备注")
private String companyAuditRemark;
@ApiModelProperty(value="分管审批人")
private String deptAuditBy;

View File

@ -0,0 +1,155 @@
package com.bonus.sgzb.app.controller;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.app.service.*;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import io.swagger.annotations.ApiOperation;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 退料接收
*/
@RestController
@RequestMapping("/backReceive")
public class BackReceiveController extends BaseController {
@Resource
private BackReceiveService backReceiveService; // 任务表Service
/**
* 服务对象
*/
@Resource
private TmTaskService tmTaskService; // 任务表Service
/**
* 退料接收列表
*
* @param record 查询条件
* @return AjaxResult对象
*/
@Log(title = "退料接收列表", businessType = BusinessType.QUERY)
@PostMapping("getbackReceiveList")
public AjaxResult getbackReceiveList(@RequestBody BackApplyInfo record) {
try {
List<BackApplyInfo> list =backReceiveService.getbackReceiveList(record);
return success(list);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 退料接收明细
*
* @param record 查询条件
* @return AjaxResult对象
*/
@Log(title = "退料接收明细", businessType = BusinessType.QUERY)
@PostMapping("receiveView")
public AjaxResult receiveView(@RequestBody BackApplyInfo record) {
try {
List<BackApplyInfo> list =backReceiveService.receiveView(record);
return success(list);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 数量退料--管理方式为1的
*
* @param record 查询条件
* @return AjaxResult对象
*/
@Log(title = "退料接收-数量退料", businessType = BusinessType.INSERT)
@PostMapping("setNumBack")
public AjaxResult setNumBack(@RequestBody BackApplyInfo record) {
try {
int res =backReceiveService.setNumBack(record);
if (res>0){
return AjaxResult.success("接收成功");
}else {
return AjaxResult.error("接收失败");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 数量退料--管理方式为1的
*
* @param record 查询条件
* @return AjaxResult对象
*/
@Log(title = "退料接收-编码退料", businessType = BusinessType.INSERT)
@PostMapping("setCodeBack")
public AjaxResult setCodeBack(@RequestBody BackApplyInfo record) {
try {
int res =backReceiveService.setCodeBack(record);
if (res>0){
return AjaxResult.success("接收成功");
}else {
return AjaxResult.error("接收失败");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Log(title = "退料接收-结束任务", businessType = BusinessType.INSERT)
@PostMapping("endBack")
public AjaxResult endBack(@RequestBody BackApplyInfo record) {
try {
int res =backReceiveService.endBack(record);
if (res>0){
return AjaxResult.success("接收成功");
}else {
return AjaxResult.error("接收失败");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Log(title = "退料接收-编号查询", businessType = BusinessType.INSERT)
@PostMapping("codeQuery")
public AjaxResult codeQuery(@RequestBody BackApplyInfo record) {
try {
List<BackApplyInfo> list =backReceiveService.codeQuery(record);
return AjaxResult.success(list);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Log(title = "退料接收-二维码查询", businessType = BusinessType.INSERT)
@PostMapping("qrcodeQuery")
public AjaxResult qrcodeQuery(@RequestBody BackApplyInfo record) {
try {
List<BackApplyInfo> list =backReceiveService.qrcodeQuery(record);
return AjaxResult.success(list);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -138,4 +138,10 @@ public class BackApplyInfo {
private BackApplyInfo info;
private BackApplyInfo[] arr;
private Integer parentId;
private String sdStatus;
private String qrCode;
private String repairedNum;
private String backId;
private String repairer;
}

View File

@ -0,0 +1,58 @@
package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
@Mapper
public interface BackReceiveMapper {
List<BackApplyInfo> getbackReceiveList(BackApplyInfo record);
List<BackApplyInfo> receiveView(BackApplyInfo record);
/**
* 添加退料合格数量
*/
int setCheckDetails(BackApplyInfo record);
int insertCheckDetails(BackApplyInfo record);
int selectTaskNumByMonthWx(@Param("date") Date date, @Param("taskType") Integer taskType);
int addWxTask(BackApplyInfo bean);
int addWxTaskAgreement(BackApplyInfo bean);
int updateTaskStatus(@Param("taskId") int taskId, @Param("status") int status);
int updateMaStatus(@Param("maId") int maId,@Param("maStatus") String maStatus);
List<BackApplyInfo> getHgList(BackApplyInfo record);
int insertIAD(BackApplyInfo bi);
int updateMT(BackApplyInfo bi);
List<BackApplyInfo> getWxList(BackApplyInfo record);
int insertTT(BackApplyInfo bean);
int insertRAD(BackApplyInfo wx);
int insertTTA(@Param("taskId") int taskId,@Param("agreementId") String agreementId);
List<BackApplyInfo> getBfList(BackApplyInfo record);
int insertSAD(BackApplyInfo bf);
List<BackApplyInfo> codeQuery(BackApplyInfo record);
List<BackApplyInfo> qrcodeQuery(BackApplyInfo record);
}

View File

@ -0,0 +1,24 @@
package com.bonus.sgzb.app.service;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import java.util.List;
public interface BackReceiveService {
List<BackApplyInfo> getbackReceiveList(BackApplyInfo record);
List<BackApplyInfo> receiveView(BackApplyInfo record);
int setNumBack(BackApplyInfo record);
int setCodeBack(BackApplyInfo record);
int endBack(BackApplyInfo record);
List<BackApplyInfo> codeQuery(BackApplyInfo record);
List<BackApplyInfo> qrcodeQuery(BackApplyInfo record);
}

View File

@ -0,0 +1,300 @@
package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.app.mapper.BackApplyMapper;
import com.bonus.sgzb.app.mapper.BackReceiveMapper;
import com.bonus.sgzb.app.service.BackApplyService;
import com.bonus.sgzb.app.service.BackReceiveService;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Service
public class BackReceiveServiceImpl implements BackReceiveService {
@Resource
private BackReceiveMapper backReceiveMapper;
@Override
public List<BackApplyInfo> getbackReceiveList(BackApplyInfo record) {
return backReceiveMapper.getbackReceiveList(record);
}
@Override
public List<BackApplyInfo> receiveView(BackApplyInfo record) {
return backReceiveMapper.receiveView(record);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int setNumBack(BackApplyInfo record) {
int res =0;
try{
int taskId = record.getTaskId();
//修改任务状态
res= updateTaskStatus(taskId,39);
//插入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 updateTaskStatus(int taskId, int i) {
int res=0;
res=backReceiveMapper.updateTaskStatus(taskId,i);
return res;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int setCodeBack(BackApplyInfo record) {
int res = 0;
try{
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;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int endBack(BackApplyInfo record) {
int res =0;
try{
int taskId = record.getTaskId();
//修改任务状态
res= updateTaskStatus(taskId,40);
if(res == 0) {
throw new RuntimeException("插入back_check_details异常");
}
//更加退料接收的数据创建下一步流程
//合格的插入入库记录input_apply_details修改库存ma_type,修改机具状态
List<BackApplyInfo> hgList = backReceiveMapper.getHgList(record);
if(hgList!=null && hgList.size()>0){
res = insertIAD(hgList);
if(res == 0) {
throw new RuntimeException("input_apply_details");
}
res = updateMT(hgList);
if(res == 0) {
throw new RuntimeException("ma_type");
}
res = updateMaStatus(hgList);
if(res == 0) {
throw new RuntimeException("ma_machines");
}
}
//维修的创建维修任务插入任务协议表
List<BackApplyInfo> wxList = backReceiveMapper.getWxList(record);
if(wxList!=null && wxList.size()>0){
//插入任务表tm_task
int newTaskId = insertTT(hgList,41);
//插入协议任务表tm_task_agreement
res = insertTTA(taskId,wxList);
//插入维修记录表repair_apply_details
res = insertRAD(taskId,wxList);
}
//待报废的创建报废任务插入任务协议表
List<BackApplyInfo> bfList = backReceiveMapper.getBfList(record);
if(wxList!=null && wxList.size()>0){
//插入任务表tm_task
int newTaskId = insertTT(hgList,57);
//插入协议任务表tm_task_agreement
res = insertTTA(taskId,hgList);
//插入维修记录表scrap_apply_details
res = insertSAD(taskId,hgList);
}
}catch (Exception e){
throw new RuntimeException(e.getMessage());
}
return 0;
}
@Override
public List<BackApplyInfo> codeQuery(BackApplyInfo record) {
return backReceiveMapper.codeQuery(record);
}
@Override
public List<BackApplyInfo> qrcodeQuery(BackApplyInfo record) {
return backReceiveMapper.qrcodeQuery(record);
}
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);
}
}
return result;
}
private int insertSAD(int taskId, List<BackApplyInfo> list) {
int result = 0;
if(list !=null){
for( BackApplyInfo bf : list ){
bf.setTaskId(taskId);
result = backReceiveMapper.insertSAD(bf);
}
}
return result;
}
private int insertTTA(int taskId, List<BackApplyInfo> list) {
int res = 0 ;
String agreementId = list.get(0).getAgreementId();
res = backReceiveMapper.insertTTA(taskId,agreementId);
return res;
}
private int insertTT(List<BackApplyInfo> hgList, int taskType) {
int newTask = 0;
//生成单号
String code = genCodeRule(taskType);
BackApplyInfo applyInfo = new BackApplyInfo();
applyInfo.setTaskType(taskType);
String taskStatus="";
if(41 == taskType){
taskStatus = "42";
}
if(57 == taskType){
taskStatus = "58";
}
applyInfo.setTaskStatus(taskStatus);
applyInfo.setCode(code);
//创建人
newTask = backReceiveMapper.insertTT(applyInfo);
return newTask;
}
private int updateMaStatus(List<BackApplyInfo> hgList) {
int res =0;
if(hgList!=null && hgList.size()>0){
for(BackApplyInfo bi : hgList){
Integer maId = bi.getMaId();
if(maId == null){
}else{
res = backReceiveMapper.updateMaStatus(maId,"15");
}
}
}
return res;
}
private int updateMT(List<BackApplyInfo> hgList) {
int res =0;
if(hgList!=null && hgList.size()>0){
for(BackApplyInfo bi : hgList){
res = backReceiveMapper.updateMT(bi);
}
}
return res;
}
private int insertIAD(List<BackApplyInfo> hgList) {
int res =0;
if(hgList!=null && hgList.size()>0){
for(BackApplyInfo bi : hgList){
res = backReceiveMapper.insertIAD(bi);
}
}
return res;
}
private int insertBCD(BackApplyInfo record) {
int res =0;
BackApplyInfo[] arr = record.getArr();
if(arr.length>0){
for(int i=0 ; i< arr.length;i++){
res = backReceiveMapper.insertCheckDetails(arr[i]);
String manageType = arr[i].getManageType();
if("0".equals(manageType)){
String backStatus = arr[i].getBackStatus();
int maId = arr[i].getMaId();
if("1".equals(backStatus)){
//退料合格状态变为退料带入库84
backReceiveMapper.updateMaStatus(maId,"84");
}
if("2".equals(backStatus)){
//退料维修状态变为退料待检修17
backReceiveMapper.updateMaStatus(maId,"17");
}
if("3".equals(backStatus)){
//退料待报废状态变为退料待报废20
backReceiveMapper.updateMaStatus(maId,"20");
}
}
}
}
return res;
}
// 编号生成规则
private String genCodeRule(int taskType) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
int taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate,taskType) + 1;
String code="";
if(41 == taskType){
code = "WX";
}
if(57 == taskType){
code = "BF";
}
if (taskNum>9 && taskNum<100){
code = code + format + "-00" + taskNum;
}else if (taskNum>99 && taskNum<1000){
code = code +format + "-0" + taskNum;
}else {
code = code + format + "-000" + taskNum;
}
return code;
}
}

View File

@ -113,6 +113,9 @@ public class CommonUtil {
BigDecimal jjValue = new BigDecimal(new Double(0).toString());
BigDecimal tsValue = new BigDecimal(new Double(0).toString());
for (int i = 0; i < list.size(); i++) {
if(Objects.isNull(list.get(i))){
continue;
}
if (Objects.equals(list.get(i).getCompanyName(), CommonConstants.JJ)) {
BigDecimal value = new BigDecimal(new Double(list.get(i).getNum()).toString());
jjValue = jjValue.add(value);

View File

@ -341,8 +341,8 @@
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
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
bai.company_id=#{companyId}
# WHERE
# bai.company_id=#{companyId}
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
</select>
@ -451,8 +451,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
bai.company_id=#{companyId}
and bad.type_id is not null
# bai.company_id=#{companyId}
# and
bad.type_id is not null
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
</select>
<select id="examineView" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">

View File

@ -0,0 +1,729 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.app.mapper.BackReceiveMapper">
<resultMap id="BaseResultMap" type="com.bonus.sgzb.app.domain.BmAgreementInfo">
<!--@mbg.generated-->
<!--@Table bm_agreement_info-->
<id column="agreement_id" jdbcType="INTEGER" property="agreementId" />
<result column="agreement_code" jdbcType="VARCHAR" property="agreementCode" />
<result column="sign_time" jdbcType="VARCHAR" property="signTime" />
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
<result column="project_id" jdbcType="INTEGER" property="projectId" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="lease_day" jdbcType="INTEGER" property="leaseDay" />
<result column="plan_start_time" jdbcType="TIMESTAMP" property="planStartTime" />
<result column="contract_code" jdbcType="VARCHAR" property="contractCode" />
<result column="auth_person" jdbcType="VARCHAR" property="authPerson" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
<result column="lot_id" jdbcType="INTEGER" property="lotId" />
<result column="lot_name" jdbcType="VARCHAR" property="lotName" />
</resultMap>
<insert id="addWxTask" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
insert into tm_task
(
<if test="taskType != null">
task_type,
</if>
<if test="taskStatus != null">
task_status,
</if>
<if test="code != null and code != ''">
code,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
) values (
<if test="taskType != null">
#{taskType},
</if>
<if test="taskStatus != null">
#{taskStatus},
</if>
<if test="code != null and code != ''">
#{code},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="insertTT" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
insert into tm_task
(
<if test="taskType != null">
task_type,
</if>
<if test="taskStatus != null">
task_status,
</if>
<if test="code != null and code != ''">
code,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
) values (
<if test="taskType != null">
#{taskType},
</if>
<if test="taskStatus != null">
#{taskStatus},
</if>
<if test="code != null and code != ''">
#{code},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="addWxTaskAgreement">
insert into tm_task_agreement
(
<if test="taskId != null">
task_id,
</if>
<if test="agreementId != null">
agreement_id,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
) values (
<if test="taskId != null">
#{taskId},
</if>
<if test="agreementId != null">
#{agreementId},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="insertTTA">
insert into tm_task_agreement
(
<if test="taskId != null">
task_id,
</if>
<if test="agreementId != null">
agreement_id,
</if>
create_time
) values (
<if test="taskId != null">
#{taskId},
</if>
<if test="agreementId != null">
#{agreementId},
</if>
NOW()
)
</insert>
<insert id="insertRAD">
insert into repair_apply_details
(
<if test="taskId != null">
task_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="backNum != null">
repair_num,
</if>
<if test="repairedNum != null">
repaired_num,
</if>
<if test="scrapNum != null">
scrap_num,
</if>
<if test="status != null">
status,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createBy != null and createBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="backId != null">
back_id,
</if>
<if test="repairer != null">
repairer,
</if>
create_time
)
values (
<if test="taskId != null">
#{taskId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="backNum != null">
#{backNum},
</if>
<if test="repairedNum != null">
#{repairedNum},
</if>
<if test="scrapNum != null">
#{scrapNum},
</if>
<if test="status != null">
#{status},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
NOW(),
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
<if test="backId != null">
#{backId},
</if>
<if test="repairer != null">
#{repairer},
</if>
NOW()
)
</insert>
<insert id="insertCheckDetails">
insert into back_check_details
(
<if test="id != null">
parent_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="backNum != null">
back_num,
</if>
<if test="backStatus != null">
back_status,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createBy != null and createBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
)
values (
<if test="id != null">
#{id},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="backNum != null">
#{backNum},
</if>
<if test="backStatus != null">
#{backStatus},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
NOW(),
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="setInputApplyDetails">
insert into input_apply_details
(
<if test="taskId != null">
task_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="inputNum != null">
input_num,
</if>
input_type,
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createBy != null and createBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
)
values (
<if test="taskId != null">
#{taskId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="parentId != null">
#{parentId},
</if>
<if test="inputNum != null">
#{inputNum},
</if>
'2',
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
NOW(),
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="insertIAD">
insert into input_apply_details
(
<if test="taskId != null">
task_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="backNum != null">
input_num,
</if>
input_type,
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createBy != null and createBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
)
values (
<if test="taskId != null">
#{taskId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="parentId != null">
#{parentId},
</if>
<if test="backNum != null">
#{backNum},
</if>
'2',
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
NOW(),
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="insertSAD">
insert into scrap_apply_details
(
<if test="taskId != null">
task_id,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="maId != null">
ma_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="backNum != null">
scrap_num,
</if>
scrap_source,
status,
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
)
values (
<if test="taskId != null">
#{taskId},
</if>
<if test="parentId != null">
#{parentId},
</if>
<if test="maId != null">
#{maId},
</if>
<if test="typeId != null">
#{typeId},
</if>
<if test="backNum != null">
#{backNum},
</if>
'1',
'0',
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<update id="updateTaskStatus">
update tm_task
set task_status=#{status}
where task_id = #{taskId}
</update>
<update id="updateMaStatus">
update ma_machine
set ma_status=#{maStatus}
where ma_id = #{maId}
</update>
<update id="updateMT">
UPDATE ma_type
SET num = (IFNULL(num, 0)) + #{backNum}
WHERE type_id = #{typeId}
</update>
<select id="getbackReceiveList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
bai.id,
bai.`code`,
bai.task_id as taskId,
bai.back_person as backPerson,
bai.phone,
bpl.lot_id,
bpl.lot_name as lotName,
bui.unit_id as unitId,
bui.unit_name as unitName,
bai.back_time as backTime,
tt.task_status as taskStatus,
tta.agreement_id as agreementId,
GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
GROUP_CONCAT(mt2.type_name, '') AS typeName
FROM
back_apply_info bai
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id=tta.agreement_id
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bagi.project_id
LEFT JOIN bm_unit_info bui on bui.unit_id=bagi.unit_id
LEFT JOIN sys_user us on us.user_id=bai.create_by
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
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
# bai.company_id=#{companyId}
# and
tt.task_status>='38'
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
</select>
<select id="receiveView" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
bai.id,
bai.task_id as taskId,
tta.agreement_id as agreementId,
mt.type_name typeCode,
mt2.type_name AS typeName,
bad.audit_num as num,
mt.manage_type as manageType
FROM
back_apply_details bad
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
WHERE
bai.id=#{id}
</select>
<select id="selectTaskNumByMonthWx" resultType="java.lang.Integer">
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
</select>
<select id="getHgList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
tta.agreement_id as agreementId,
bai.id,
bcd.type_id as typeId,
bcd.back_num as backNum,
bcd.parent_id as parentId,
bcd.create_by as createBy
FROM
back_check_details bcd
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
WHERE
parent_id=#{parentId}
and bcd.back_status='1'
</select>
<select id="getWxList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
tta.agreement_id as agreementId,
bai.id,
bcd.type_id as typeId,
bcd.back_num as backNum,
bcd.parent_id as parentId,
bcd.create_by as createBy
FROM
back_check_details bcd
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
WHERE
parent_id=#{parentId}
and bcd.back_status='2'
</select>
<select id="getBfList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
tta.agreement_id as agreementId,
bai.id,
bcd.type_id as typeId,
bcd.back_num as backNum,
bcd.parent_id as parentId,
bcd.create_by as createBy
FROM
back_check_details bcd
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
WHERE
parent_id=#{parentId}
and bcd.back_status='3'
</select>
<select id="codeQuery" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
mt.type_id as typeId,
mm.ma_id as maId,
mm.ma_code as maCode,
mt.type_name as typeCode,
mt2.type_name as typeName,
sd.`name` as sdStatus
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
LEFT JOIN sys_dic sd on mm.ma_status=sd.id
WHERE
ma_code LIKE concat('%', #{maCode}, '%')
</select>
<select id="qrcodeQuery" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
mt.type_id as typeId,
mm.ma_id as maId,
mm.ma_code as maCode,
mt.type_name as typeCode,
mt2.type_name as typeName,
sd.`name` as sdStatus
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
LEFT JOIN sys_dic sd on mm.ma_status=sd.id
WHERE
qr_code =#{qrCode}
</select>
</mapper>

View File

@ -48,7 +48,7 @@
remark, company_id)
values (#{parenntId,jdbcType=INTEGER}, #{typeId,jdbcType=INTEGER}, #{preNum,jdbcType=FLOAT},
#{alNum,jdbcType=FLOAT}, #{status,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
NOW(), #{updateBy,jdbcType=VARCHAR}, NOW(),
#{remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails" useGeneratedKeys="true">
@ -331,7 +331,7 @@
<foreach collection="list" item="item" separator=",">
(#{item.parenntId,jdbcType=INTEGER}, #{item.typeId,jdbcType=INTEGER}, #{item.preNum,jdbcType=FLOAT},
#{item.alNum,jdbcType=FLOAT}, #{item.status,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
NOW(), #{item.updateBy,jdbcType=VARCHAR}, NOW(),
#{item.remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER})
</foreach>
</insert>

View File

@ -512,7 +512,7 @@
SELECT
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName, mt.manage_type as manageType,
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
mt.num
mt.num, (lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id

View File

@ -68,7 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mps.prop_id = #{propId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (m.ma_code like concat('%',#{keyWord},'%') or m.buy_task like concat('%',#{keyWord},'%'))
AND (m.ma_code like concat('%',#{keyWord},'%') or m.buy_task like concat('%',#{keyWord},'%')
or mt.type_name like concat('%',#{keyWord},'%') or mt1.type_name like concat('%',#{keyWord},'%')
or mt2.type_name like concat('%',#{keyWord},'%'))
</if>
<if test="beginTime != null and endTime != null and beginTime != '' and endTime != null">
AND m.create_time between #{beginTime} and #{endTime}
@ -88,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_label_bind mmb on m.ma_id = mmb.ma_id and m.type_id = mmb.type_id
where m.ma_code = #{maCode}
where m.ma_code = #{maCode} or m.qr_code = #{maCode}
</select>

View File

@ -16,13 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<!--退料数据-->
<select id="getMaterialReturnData" resultType="com.bonus.sgzb.largeScreen.domain.MaTypeDo">
SELECT SUM(bcd.back_num) AS num,
bcd.company_id AS companyId,
SELECT bad.audit_num AS num,
mt.company_id AS companyId,
sd.dept_name AS companyName
FROM back_check_details bcd
LEFT JOIN sys_dept sd ON bcd.company_id = sd.dept_id
WHERE bcd.create_time BETWEEN CONCAT(#{nowDate}, ' 00:00:00') AND CONCAT(#{nowDate}, ' 23:59:59')
GROUP BY bcd.company_id
FROM back_apply_details bad
LEFT JOIN ma_type mt ON bad.type_id = mt.type_id AND mt.`level` = '4'
LEFT JOIN sys_dept sd ON mt.company_id = sd.dept_id
WHERE bad.create_time BETWEEN CONCAT(#{nowDate}, ' 00:00:00') AND CONCAT(#{nowDate}, ' 23:59:59')
</select>
<!--当月领料分析-->
<select id="getPickingAnalysisByMonth" resultType="com.bonus.sgzb.largeScreen.domain.MaTypeDo">

View File

@ -306,7 +306,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
bai.company_id=#{companyId}
1=1
# bai.company_id=#{companyId}
<if test="keyWord != null and keyWord != ''">
and bai.`code` like concat('%', #{keyWord}, '%') or
bai.back_person like concat('%', #{keyWord}, '%') or

View File

@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBmQrcodeInfoVo"/>
where qr_id = #{qrId}
</select>
<insert id="insertBmQrcodeInfo" parameterType="com.bonus.sgzb.material.domain.BmQrcodeInfo" useGeneratedKeys="true" keyProperty="qrId">
insert into bm_qrcode_info
<trim prefix="(" suffix=")" suffixOverrides=",">