This commit is contained in:
2024-12-24 09:16:45 +08:00
parent 819ea770e3
commit 8187160185
13 changed files with 288 additions and 179 deletions

View File

@@ -18,6 +18,7 @@ import com.industry.work.domain.dto.IndustryMaterialDto;
import com.industry.work.domain.vo.IndustryMaterialVo;
import com.industry.work.service.IIndustryMaterialService;
import com.industry.work.service.IIndustryStepService;
import com.industry.work.service.IMomService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +54,9 @@ public class IndustryMaterialController extends BaseController
@Autowired
private IIndustryStepService industryStepService;
@Autowired
private IMomService momService;
@Autowired
@@ -216,7 +220,7 @@ public class IndustryMaterialController extends BaseController
}
industryMaterialService.updateIndustryMaterial(industryMaterial);
// TODO 加入ip地址请求
// HttpUtils.dataPost()
momService.processPowerDown(industryMaterial);
}
}

View File

@@ -178,7 +178,8 @@ public class IndustryStepController extends BaseController
@GetMapping("/check/{batchId}")
public AjaxResult check(@PathVariable Long batchId)
{
return AjaxResult.success(industryStepService.finishCheck(batchId));
Long result = industryStepService.finishCheck(batchId);
return AjaxResult.success(result);
}
/**
* 结束检查

View File

@@ -15,7 +15,7 @@ spring:
enabled: false
url: jdbc:mysql://localhost:3306/industry2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: WANGyu11!
password: root
# 初始连接数
initialSize: 5
# 最小连接池数量

View File

@@ -145,3 +145,5 @@ xss:
ipAddress: 10.20.10.29
httpIp: http://10.20.10.158

View File

@@ -1,67 +1,105 @@
package com.industry.work.domain;
import com.industry.common.core.domain.BaseEntity;
import lombok.Data;
import com.industry.common.annotation.Excel;
/**
* 钽靶主类对象 industry_material
*
*
* @author hdka
* @date 2024-06-07
*/
@Data
public class IndustryMaterial extends BaseEntity
{
public class IndustryMaterial extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id批号 */
/**
* 主键id批号
*/
private String id;
/** 规格 */
/**
* 规格
*/
@Excel(name = "规格")
private String specification;
/** 工艺 */
/**
* 工艺
*/
@Excel(name = "工艺")
private String technology;
/** 是否正在操作 */
/**
* 是否正在操作
*/
@Excel(name = "是否正在操作")
private Long operation;
/** 直径 */
/**
* 直径
*/
@Excel(name = "直径")
private Double diameter;
/** 该批次的道次数量 */
/**
* 该批次的道次数量
*/
@Excel(name = "该批次的道次数量")
private Long stepSize;
/** 批次号 */
/**
* 批次号
*/
@Excel(name = "批次号")
private Long batchId;
/** 序号 */
/**
* 序号
*/
@Excel(name = "序号")
private Long sort;
/** 最大轧制力 */
/**
* 最大轧制力
*/
private Double width;
/** 删除标志 */
/**
* 删除标志
*/
private Long delFlag;
/** 0未提交1提交2完成3此批次中存在道次异常 */
/**
* 0未提交1提交2完成3此批次中存在道次异常
*/
private Long state;
/** 最终厚度 */
/**
* 最终厚度
*/
private Double finalWidth;
/** 最终直径 */
/**
* 最终直径
*/
private Double finalDiameter;
/** 最大轧制力 */
/**
* 最终厚度2
*/
private Double finalWidth2;
/**
* 最终直径2
*/
private Double finalDiameter2;
/**
* 最大轧制力
*/
private Double weight;

View File

@@ -0,0 +1,41 @@
package com.industry.work.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MomResource {
// 物料id
private String ticketNo;
// 设备编号
private String devicesCode;
// 接收时间
private Date receiveTime;
// 上机时间
private Date powerOnTime;
// 接收人
private String receiveUser;
// 上机人
private String powerOnUser;
// 工艺
private String processSide;
// 接口调用方
private String caller;
}

View File

@@ -74,9 +74,9 @@ public interface IndustryStepMapper
/**
* 检擦是否有道次未处理
* @return
* @param industryStep
* @param batchId
*/
int finishCheck(IndustryStep industryStep);
Long finishCheck(@Param("batchId") Long batchId);
/**
* 查询异常
@@ -86,7 +86,7 @@ public interface IndustryStepMapper
int delAbnormalData(String id);
int finishCheckAbnormal(String id);
Long finishCheckAbnormal(@Param("batchId") Long batchId);
int delAbnormalDataByMaterialId(String materialId);

View File

@@ -5,7 +5,6 @@ import java.util.List;
import com.industry.common.plc.PLCSystemData;
import com.industry.work.domain.IndustryMaterial;
import com.industry.work.domain.IndustryStep;
import com.industry.work.domain.PLCData;
import com.industry.work.domain.vo.IndustryStepVo;
/**
@@ -71,11 +70,6 @@ public interface IIndustryStepService
*/
List<IndustryStepVo> selectIndustryStepListByProcess(IndustryStep industryStep);
/**
* 获取plc中实时出现的数据将其存入redis中
*/
public void getProcessingPLCData();
/**
* 下道次
* @param industryStep
@@ -83,7 +77,7 @@ public interface IIndustryStepService
*/
String nextStep(IndustryStep industryStep);
String finish(Long batchId);
int finish(Long batchId);
List<IndustryStepVo> getAbnormalData();
@@ -91,9 +85,9 @@ public interface IIndustryStepService
PLCSystemData getPLCData(IndustryStep industryStep);
String finishCheck(Long batchId);
Long finishCheck(Long batchId);
String finishCheckAbnormal(Long batchId);
Long finishCheckAbnormal(Long batchId);
int createStep(IndustryMaterial industryMaterial);

View File

@@ -0,0 +1,12 @@
package com.industry.work.service;
import com.industry.work.domain.IndustryMaterial;
import com.industry.work.domain.MomResource;
public interface IMomService {
public void processPowerOn(MomResource momResource);
void processPowerDown(IndustryMaterial industryMaterial);
}

View File

@@ -2,6 +2,7 @@ package com.industry.work.service.impl;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@@ -17,12 +18,14 @@ import com.industry.common.utils.DateUtils;
import com.industry.common.utils.MathUtils;
import com.industry.work.domain.IndustryBatch;
import com.industry.work.domain.IndustryMaterial;
import com.industry.work.domain.MomResource;
import com.industry.work.domain.dto.IndustryMaterialDto;
import com.industry.work.domain.vo.IndustryBatchVo;
import com.industry.work.domain.vo.IndustryMaterialVo;
import com.industry.work.mapper.IndustryMaterialMapper;
import com.industry.work.service.IIndustryBatchService;
import com.industry.work.service.IIndustryMaterialService;
import com.industry.work.service.IMomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -46,6 +49,9 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
@Autowired
private RedisCache redisCache;
@Autowired
private IMomService momService;
@Value("${ipAddress}")
private String ipAddress;
@@ -220,20 +226,43 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
// 提醒前端已经开始了,无需重新开始
return 0;
}
// 到这里没有return出去 表示该批次未开始
// 拿到序号为第一的将其操作中设置成1
firstMaterial.setOperation(1L);
updateIndustryMaterial(firstMaterial);
// 记录materialFlag为升序
redisCache.setCacheObject("materialFlag", 1L, 100, TimeUnit.HOURS);
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
MomResource momResource = getMomResource(industryMaterialVo);
momService.processPowerOn(momResource);
}
return 1;
}
private MomResource getMomResource(IndustryMaterialVo industryMaterialVo) {
MomResource momResource = new MomResource();
momResource.setTicketNo(industryMaterialVo.getId());
momResource.setReceiveTime(new Date());
momResource.setPowerOnTime(new Date());
momResource.setCaller("ZJ");
momResource.setReceiveUser("wang");
momResource.setPowerOnUser("wang");
if ("1".equals(mode)) {
// 精轧
momResource.setDevicesCode("00401020934");
}else{
// 粗轧
momResource.setDevicesCode("00401020935");
}
momResource.setProcessSide(mode);
return momResource;
}
@Override
@Transactional
public String nextMaterial(IndustryMaterialDto industryMaterialDto) {
@@ -426,13 +455,11 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
pos = i;
}
}
Long materialFlag = redisCache.getCacheObject("materialFlag");
// 处理是向上走还是向下走
if (materialFlag == 0L) {
// 降序
// 表示走到了最后一个了
if (start == pos) {
// 向上升并且已经升到头了
redisCache.setCacheObject("nextStepFlag", 1L, 100, TimeUnit.HOURS);
@@ -444,7 +471,6 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
return 0;
}
}
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
return 1;

View File

@@ -1,6 +1,5 @@
package com.industry.work.service.impl;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -18,7 +17,6 @@ import com.industry.work.domain.IndustryMaterial;
import com.industry.work.domain.IndustryStep;
import com.industry.work.domain.IndustryTechnology;
import com.industry.work.domain.vo.IndustryBatchVo;
import com.industry.work.domain.vo.IndustryMaterialVo;
import com.industry.work.domain.vo.IndustryStepVo;
import com.industry.work.domain.vo.IndustryTechnologyVo;
@@ -220,24 +218,19 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
return "2";
}
// 如果不为0 说明该批次依然有道次未处理
// 获取第一个 将其operation改为1
industryStep1.setOperation(1L);
// 更新一下下一步的状态
industryStepMapper.updateIndustryStepByBatchId(industryStep1);
// TODO 向plc发送当前道次
s7PLC2.writeInt32("DB16.0", Math.toIntExact(newStep));
s7PLC2.writeInt32("DB16.0", Math.toIntExact(newStep));
// 当前厚度
// s7PLC2.writeFloat32("DB16.6", industryStepVos.get(0).get);
//以及剩余道次
Long num = industryStepMapper.selectMaxStepNum(industryStep.getBatchId());
s7PLC2.writeInt32("M854", Math.toIntExact(num - newStep));
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
s7PLC2.writeBoolean("DB15.1.2",false);
s7PLC2.writeFloat32("DB15.118",industryStepVos.get(0).getSetValue().floatValue());
s7PLC2.writeBoolean("DB15.0.3",true);
@@ -245,21 +238,14 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
while (s7PLC2.readBoolean("DB15.0.3")){
s7PLC2.writeBoolean("DB15.0.3",false);
}
// if (Objects.equals(mode, "0")){
// s7PLC.writeInt32("M200",5*200);
// }else{
// s7PLC.writeInt32("M200",5*333);
// }
}
while (s7PLC2.readBoolean("DB15.1.2")){
Threads.sleep(500);
}
s7PLC2.close();
return "1";
}
@@ -290,7 +276,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
industryStep1.setDelFlag(1L);
// 查询下一步还有没有
List<IndustryStepVo> industryStepVos = industryStepMapper.selectErrorIndustryStepList(industryStep1);
if (industryStepVos.size() == 0) {
if (industryStepVos.isEmpty()) {
// 等于0说明没有下一步了 通知前端处理下一批
return "2";
}
@@ -323,12 +309,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
while (s7PLC.readBoolean("DB15.0.3")){
s7PLC.writeBoolean("DB15.0.3",false);
}
//
// if (Objects.equals(mode, "0")){
// s7PLC.writeInt32("M200",5*200);
// }else{
// s7PLC.writeInt32("M200",5*333);
// }
}
@@ -378,7 +358,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
industryMaterialService.updateIndustryMaterial(materialVo);
}
// 将该批次所有的道次的进行中置零
IndustryStep industryStep = new IndustryStep();
industryStep.setOperation(0L);
@@ -411,44 +390,24 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
}
/**
* 查询数量
* @param batchId
* @return
*/
@Override
public String finishCheck(Long batchId) {
// 返回非异常列表
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(batchId);
int count = 0;
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
IndustryStep industryStep = new IndustryStep();
industryStep.setMaterialId(industryMaterialVo.getId());
industryStep.setBatchId(batchId);
int i = industryStepMapper.finishCheck(industryStep);
count += i;
}
// -1 表示全部结束
return count > 0 ? "1" : "-1";
public Long finishCheck(Long batchId) {
return industryStepMapper.finishCheck(batchId);
}
@Override
public String finishCheckAbnormal(Long batchId) {
// 返回异常列表
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryAbnormalMaterialByBatchId(batchId);
int count = 0;
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
int i = industryStepMapper.finishCheckAbnormal(industryMaterialVo.getId());
count += i;
}
// -1 表示全部结束
return count > 0 ? "1" : "-1";
public Long finishCheckAbnormal(Long batchId) {
return industryStepMapper.finishCheckAbnormal(batchId);
}
@Override
public int createStep(IndustryMaterial industryMaterial) {
String success = industryMaterialService.resourceToWorkAndCreateStep(industryMaterial);
if (!Objects.equals(success, "0")) {
// 进入这里说明工艺没问题接下里根据工艺表创建道次
// 判断当前是粗轧还是精轧
@@ -464,7 +423,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(industryMaterial.getBatchId());
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
for (IndustryTechnologyVo industryTechnologyVo : industryTechnologyVos) {
IndustryStep industryStep = new IndustryStep();
industryStep.setStep(industryTechnologyVo.getStep());
industryStep.setSetValue(industryTechnologyVo.getSetValue());
@@ -485,7 +443,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
@Override
public String finish(Long batchId) {
public int finish(Long batchId) {
// 表示该批次全部处理完毕
industryMaterialService.updateIndustryMaterialStateByBatchId(batchId);
@@ -519,8 +477,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
}
}
s7PLC.writeBoolean("DB15.1.2",false);
// -1 表示全部结束
return "-1";
return 1;
}
@Override
@@ -556,62 +513,9 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
@Override
public PLCSystemData getPLCData(IndustryStep industryStep) {
// // TODO 等待正式环境打开
// plcData.setCircleContainerAddress((Double) redisCache.getCacheObject("circleContainerAddress"));
// plcData.setOperationContainerAddress((Double) redisCache.getCacheObject("operationContainerAddress"));
// plcData.setConvey((Double) redisCache.getCacheObject("convey"));
// plcData.setOperation((Double) redisCache.getCacheObject("operation"));
// plcData.setHighElectric((Double) redisCache.getCacheObject("highElectric"));
// plcData.setLowElectric((Double) redisCache.getCacheObject("lowElectric"));
// plcData.setMachineBackSpeed((Double) redisCache.getCacheObject("machineBackSpeed"));
// plcData.setAGC((Double) redisCache.getCacheObject("AGC"));
// plcData.setOrdinary((Double) redisCache.getCacheObject("ordinary"));
// Random random = new Random();
//
// plcData.setCircleContainerAddress( random.nextDouble());
// plcData.setOperationContainerAddress( random.nextDouble());
// plcData.setConvey(random.nextDouble());
// plcData.setOperation(random.nextDouble());
// plcData.setHighElectric(random.nextDouble());
// plcData.setLowElectric(random.nextDouble());
// plcData.setMachineBackSpeed(random.nextDouble());
// plcData.setAGC(random.nextDouble());
// plcData.setOrdinary(random.nextDouble());
return s7Serializer.read(PLCSystemData.class);
}
@Override
public void getProcessingPLCData() {
// S7ConnectorPLC s7ConnectorPLC = new S7ConnectorPLC();
// //创建读取plc数据对象
// //初始化
// S7Connector connector = s7ConnectorPLC.initConnect(ipAddress);
//
//
// getProcessingData(connector,15, 182, false, "circleContainerAddress");
// getProcessingData(connector,15, 186, false, "operationContainerAddress");
// getProcessingData(connector,15, 198, false, "convey");
// getProcessingData(connector,15, 202, false, "operation");
// getProcessingData(connector,0, 238, true, "highElectric");
// getProcessingData(connector,0, 230, true, "lowElectric");
// getProcessingData(connector,0, 234, true, "machineBackSpeed");
// getProcessingData(connector,33, 404, false, "AGC");
// getProcessingData(connector,34, 404, false, "ordinary");
//
//
// try {
// //关闭链接
// connector.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
}
/**
* 定时任务 纠正莫名其妙改成1的问题
*/
@@ -640,32 +544,14 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
@Override
public void start(IndustryStep industryStep) {
List<IndustryStepVo> industryStepVos = industryStepMapper.selectIndustryStepList(industryStep);
if (industryStepVos.size()>0){
if (!industryStepVos.isEmpty()){
s7PLC.writeFloat32("DB15.118",industryStepVos.get(0).getSetValue().floatValue());
s7PLC.writeBoolean("DB15.0.3",true);
while (s7PLC.readBoolean("DB15.0.3")){
s7PLC.writeBoolean("DB15.0.3",false);
}
}
industryStep.setOperation(1L);
industryStepMapper.start(industryStep);
}
// private void getProcessingData(S7Connector connector,int dbCode, int offset, Boolean mbFlag, String key) {
// Double data;
// if (mbFlag) {
// data = (Double) PLCUtils.getPLCData(connector,ipAddress, 0, offset, "double", 0, 0, true);
// } else {
// data = (Double) PLCUtils.getPLCData(connector,ipAddress, dbCode, offset, "double", 0, 0, false);
// }
// redisCache.setCacheObject(key, data);
//
// }
}

View File

@@ -0,0 +1,101 @@
package com.industry.work.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.industry.common.utils.http.HttpUtils;
import com.industry.work.domain.IndustryMaterial;
import com.industry.work.domain.MomResource;
import com.industry.work.service.IMomService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
public class MomServiceImpl implements IMomService {
@Value("${httpIp}")
private String httpIp;
@Value("${mode}")
private String mode;
/**
* 来料与mom通信
*
* @param momResource
*/
@Override
public void processPowerOn(MomResource momResource) {
String url = "/api/ticket/processPowerOn";
JSONObject jsonObject = new JSONObject();
jsonObject.put("ticketNo", momResource.getTicketNo());
jsonObject.put("devicesCode", momResource.getDevicesCode());
jsonObject.put("receiveTime", momResource.getReceiveTime());
jsonObject.put("powerOnTime", momResource.getPowerOnTime());
jsonObject.put("receiveUser", momResource.getReceiveUser());
jsonObject.put("powerOnUser", momResource.getPowerOnUser());
jsonObject.put("processSide", momResource.getProcessSide());
jsonObject.put("caller", momResource.getCaller());
String res = HttpUtils.dataPost(httpIp + url, jsonObject);
System.out.println(res);
}
@Override
public void processPowerDown(IndustryMaterial industryMaterial) {
String url = "/api/ticket/processPowerDown";
ArrayList<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
if ("0".equals(mode)) {
map.put("code", "CZ_COLLECT_1");
map.put("value", industryMaterial.getFinalDiameter());
list.add(map);
map.put("code", "CZ_COLLECT_2");
map.put("value", industryMaterial.getFinalWidth());
list.add(map);
map.put("code", "CZ_COLLECT_3");
map.put("value", industryMaterial.getWidth());
list.add(map);
} else {
map.put("code", "JZ_COLLECT_1");
map.put("value", industryMaterial.getFinalDiameter());
list.add(map);
map.put("code", "JZ_COLLECT_2");
map.put("value", industryMaterial.getFinalDiameter2());
list.add(map);
map.put("code", "JZ_COLLECT_3");
map.put("value", industryMaterial.getWidth());
list.add(map);
map.put("code", "JZ_COLLECT_4");
map.put("value", industryMaterial.getFinalWidth());
list.add(map);
map.put("code", "JZ_COLLECT_5");
map.put("value", industryMaterial.getFinalWidth2());
list.add(map);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("ticketNo", industryMaterial.getId());
jsonObject.put("productCode", industryMaterial.getId());
jsonObject.put("devicesCode", industryMaterial.getId());
jsonObject.put("collectTime", new Date());
jsonObject.put("powerDownTime", new Date());
jsonObject.put("transmitTime", new Date());
jsonObject.put("collectUser", "wang");
jsonObject.put("powerDownUser", "wang");
jsonObject.put("transmitUser", "wang");
jsonObject.put("processSide", mode);
jsonObject.put("caller", "ZJ");
jsonObject.put("dataCollect", list);
String res = HttpUtils.dataPost(httpIp + url, jsonObject);
System.out.println(res);
}
}

View File

@@ -106,23 +106,28 @@
</select>
<select id="finishCheck" resultType="java.lang.Integer" parameterType="IndustryStep" >
<select id="finishCheck" resultType="java.lang.Long">
select count(*)
from industry_step
where state = 0
and material_id = #{materialId}
and del_flag=0
and batch_id = #{batchId}
from industry_step step
left join industry.industry_material im on step.material_id = im.id
where step.state = 0
and step.del_flag=0
and step.batch_id = #{batchId}
and im.state =1
</select>
<select id="finishCheckAbnormal" resultType="java.lang.Integer" parameterType="String">
<select id="finishCheckAbnormal" resultType="java.lang.Long">
select count(*)
from industry_step
where state = 0
and material_id = #{materialId}
and del_flag=1
from industry_step step
left join industry.industry_material im on step.material_id = im.id
where step.state = 0
and step.del_flag=1
and step.batch_id = #{batchId}
and im.state =5
</select>
<select id="selectMaxStepNum" resultType="java.lang.Long" parameterType="Long">
select max(step) from industry_step where batch_id = #{batchId}
</select>
@@ -231,14 +236,13 @@
</update>
<update id="updateAllIndustryStepByBatchId" parameterType="IndustryStep">
update industry_step
<trim prefix="SET" suffixOverrides=",">
<if test="reduction != null">reduction = #{reduction},</if>
<if test="setValue != null">set_value = #{setValue},</if>
<if test="angle != null">angle = #{angle},</if>
<if test="operation != null">operation = #{operation},</if>
<if test="state != null and state !=1 ">state = #{state},</if>
<if test="state != null">state = #{state},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>