Browse Source

opt:优化 入库信息导入

master
zds 1 month ago
parent
commit
a2693e15a3
  1. 44
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java
  2. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialService.java
  3. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialServiceProc.java
  4. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/Material.java
  5. 75
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/MaterialProc.java
  6. 13
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/mapper/MaterialProcMapper.java
  7. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/impl/MaterialServiceProcImpl.java

44
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java

@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -17,10 +16,8 @@ import org.nl.wms.mes.domain.*;
import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.pdm.service.dao.PdmBdWorkorderDetail; import org.nl.wms.pdm.service.dao.PdmBdWorkorderDetail;
import org.nl.wms.sch.material.service.IMaterialService; import org.nl.wms.sch.material.service.IMaterialServiceProc;
import org.nl.wms.sch.material.service.dao.Material; import org.nl.wms.sch.material.service.dao.MaterialProc;
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper;
import org.nl.wms.sch.workorder.service.IWorkorderService; import org.nl.wms.sch.workorder.service.IWorkorderService;
import org.nl.wms.sch.workorder.service.dao.Workorder; import org.nl.wms.sch.workorder.service.dao.Workorder;
@ -33,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -47,10 +45,7 @@ public class MesController {
private PointMapper pointMapper; private PointMapper pointMapper;
@Autowired @Autowired
private MaterialMapper materialMapper; private IMaterialServiceProc IMaterialServiceProc;
@Autowired
private IMaterialService materialService;
@Autowired @Autowired
private IPdmBdWorkorderService pdmBdWorkorderService; private IPdmBdWorkorderService pdmBdWorkorderService;
@ -79,34 +74,27 @@ public class MesController {
head.setSRC_MSGID(IdUtil.simpleUUID()); head.setSRC_MSGID(IdUtil.simpleUUID());
head.setSRC_SYSTEM("AGV"); head.setSRC_SYSTEM("AGV");
qpmes060Response.setHEAD(head); qpmes060Response.setHEAD(head);
QPMES060Request qpmes060request = notice.toJavaObject(QPMES060Request.class);
log.info(qpmes060request.toString());
Collection<MaterialProc> materlist = new ArrayList();
try { try {
for(QPMES060RequestBody QPMES060RequestBody:notice.toJavaObject(QPMES060Request.class).getBODY()) { for(QPMES060RequestBody temp : qpmes060request.getBODY()) {
Material material = new Material(); MaterialProc material = new MaterialProc();
//实体类 //实体类
material.copyFrom(QPMES060RequestBody); material.copyFrom(temp);
String lotSN = material.getLotSN(); String lotSN = material.getLotSN();
if(ObjectUtil.isNotEmpty(lotSN)){ if(ObjectUtil.isNotEmpty(lotSN)){
Material entity = materialService.getOne(new LambdaQueryWrapper<Material>()
.eq(Material::getLotSN, lotSN));
if (ObjectUtil.isEmpty(entity)){
//新增
material.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue());
material.setReturn_status("0");
material.setCreate_time(DateUtil.now()); material.setCreate_time(DateUtil.now());
materialMapper.insert(material); materlist.add(material);
}else{
LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(Material::getLotSN,lotSN);
//更新
material.setGroup_bind_material_status(entity.getGroup_bind_material_status());
material.setReturn_status(entity.getReturn_status());
material.setCreate_time(DateUtil.now());
materialService.update(material,updateWrapper);
}
}else{ }else{
log.error("原材料入库晶棒号为空,{}", material.toString()); log.error("原材料入库晶棒号为空,{}", material.toString());
} }
} }
boolean flag = IMaterialServiceProc.saveOrUpdateBatch(materlist,materlist.size());
log.info("QPMES060服务被调用IMaterialServiceProc.saveOrUpdateBatch:" + flag);
qpmes060ResponseBody.setMESSAGE("原材料入库成功"); qpmes060ResponseBody.setMESSAGE("原材料入库成功");
qpmes060ResponseBody.setSTATUS("S"); qpmes060ResponseBody.setSTATUS("S");
qpmes060ResponseBodyArrayList.add(qpmes060ResponseBody); qpmes060ResponseBodyArrayList.add(qpmes060ResponseBody);

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialService.java

@ -1,13 +1,10 @@
package org.nl.wms.sch.material.service; package org.nl.wms.sch.material.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery; import org.nl.common.domain.query.PageQuery;
import org.nl.wms.sch.material.service.dao.Material; import org.nl.wms.sch.material.service.dao.Material;
import org.nl.wms.sch.material.service.dto.MaterialQuery; import org.nl.wms.sch.material.service.dto.MaterialQuery;
import org.nl.wms.sch.report.service.dto.ReportQuery;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialServiceProc.java

@ -0,0 +1,9 @@
package org.nl.wms.sch.material.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.sch.material.service.dao.MaterialProc;
public interface IMaterialServiceProc extends IService<MaterialProc> {
}

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/Material.java

@ -20,6 +20,10 @@ import java.math.BigDecimal;
@TableName("sch_base_material") @TableName("sch_base_material")
public class Material implements Serializable { public class Material implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(value = "lotSN", type = IdType.NONE)
@ApiModelProperty(value = "物料条码号")
private String lotSN;
@ApiModelProperty(value = "入库单号") @ApiModelProperty(value = "入库单号")
private String SimtOrderNo; private String SimtOrderNo;
@ApiModelProperty(value = "场地") @ApiModelProperty(value = "场地")
@ -32,8 +36,6 @@ public class Material implements Serializable {
private String whlCode; private String whlCode;
@ApiModelProperty(value = "托盘号") @ApiModelProperty(value = "托盘号")
private String PalletSN; private String PalletSN;
@ApiModelProperty(value = "物料条码号")
private String lotSN;
@ApiModelProperty(value = "物料编码") @ApiModelProperty(value = "物料编码")
private String productName; private String productName;
@ApiModelProperty(value = "物料名称") @ApiModelProperty(value = "物料名称")

75
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/MaterialProc.java

@ -0,0 +1,75 @@
package org.nl.wms.sch.material.service.dao;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nl.wms.mes.domain.QPMES060RequestBody;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sch_base_material")
public class MaterialProc implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "lotSN", type = IdType.NONE)
@ApiModelProperty(value = "物料条码号")
private String lotSN;
@ApiModelProperty(value = "入库单号")
private String SimtOrderNo;
@ApiModelProperty(value = "场地")
private String locationCode;
@ApiModelProperty(value = "入库类型")
private String simtType;
@ApiModelProperty(value = "到货单号")
private String deliveryNo;
@ApiModelProperty(value = "扫描库位")
private String whlCode;
@ApiModelProperty(value = "托盘号")
private String PalletSN;
@ApiModelProperty(value = "物料编码")
private String productName;
@ApiModelProperty(value = "物料名称")
private String productDescription;
@ApiModelProperty(value = "供应商编码")
private String supplierCode;
@ApiModelProperty(value = "供应商名称")
private String supplierName;
@ApiModelProperty(value = "规格")
private String specification;
@ApiModelProperty(value = "批次号")
private String batch;
@ApiModelProperty(value = "数量")
private String qty;
@ApiModelProperty(value = "来料长度")
private String incomingLength;
@ApiModelProperty(value = "来料重量")
private String incomingWeight;
@ApiModelProperty(value = "来料缺陷长度")
private String incomingchipping;
@ApiModelProperty(value = "拼棒类型")
private String planZBNum;
@ApiModelProperty(value = "客户来料批次号")
private String ingotBatch;
@ApiModelProperty(value = "晶棒等级")
private String siliconGrade;
@ApiModelProperty(value = "极性")
private String siliconPolarity;
@ApiModelProperty(value = "重量折算系数")
private String weightCoefficientValue;
@ApiModelProperty(value = "线径")
private String lineDiameter;
@ApiModelProperty(value = "操作时间")
private String create_time;
public void copyFrom(QPMES060RequestBody source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

13
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/mapper/MaterialProcMapper.java

@ -0,0 +1,13 @@
package org.nl.wms.sch.material.service.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.sch.material.service.dao.Material;
import org.nl.wms.sch.material.service.dao.MaterialProc;
/**
* @author lyd
* @date 2023-05-16
**/
public interface MaterialProcMapper extends BaseMapper<MaterialProc> {
}

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/impl/MaterialServiceProcImpl.java

@ -0,0 +1,15 @@
package org.nl.wms.sch.material.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.sch.material.service.IMaterialServiceProc;
import org.nl.wms.sch.material.service.dao.MaterialProc;
import org.nl.wms.sch.material.service.dao.mapper.MaterialProcMapper;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class MaterialServiceProcImpl extends ServiceImpl<MaterialProcMapper, MaterialProc> implements IMaterialServiceProc {
}
Loading…
Cancel
Save