diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java index 8982946..2f704a9 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java +++ b/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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.ApiOperation; 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.dao.PdmBdWorkorder; import org.nl.wms.pdm.service.dao.PdmBdWorkorderDetail; -import org.nl.wms.sch.material.service.IMaterialService; -import org.nl.wms.sch.material.service.dao.Material; -import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper; -import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; +import org.nl.wms.sch.material.service.IMaterialServiceProc; +import org.nl.wms.sch.material.service.dao.MaterialProc; 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.dao.Workorder; @@ -33,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Collection; import java.util.List; @Slf4j @@ -47,10 +45,7 @@ public class MesController { private PointMapper pointMapper; @Autowired - private MaterialMapper materialMapper; - - @Autowired - private IMaterialService materialService; + private IMaterialServiceProc IMaterialServiceProc; @Autowired private IPdmBdWorkorderService pdmBdWorkorderService; @@ -79,34 +74,27 @@ public class MesController { head.setSRC_MSGID(IdUtil.simpleUUID()); head.setSRC_SYSTEM("AGV"); qpmes060Response.setHEAD(head); + + QPMES060Request qpmes060request = notice.toJavaObject(QPMES060Request.class); + log.info(qpmes060request.toString()); + + Collection materlist = new ArrayList(); try { - for(QPMES060RequestBody QPMES060RequestBody:notice.toJavaObject(QPMES060Request.class).getBODY()) { - Material material = new Material(); + for(QPMES060RequestBody temp : qpmes060request.getBODY()) { + MaterialProc material = new MaterialProc(); //实体类 - material.copyFrom(QPMES060RequestBody); + material.copyFrom(temp); String lotSN = material.getLotSN(); if(ObjectUtil.isNotEmpty(lotSN)){ - Material entity = materialService.getOne(new LambdaQueryWrapper() - .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()); - materialMapper.insert(material); - }else{ - LambdaUpdateWrapper 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); - } + material.setCreate_time(DateUtil.now()); + materlist.add(material); }else{ log.error("原材料入库晶棒号为空,{}", material.toString()); } } + boolean flag = IMaterialServiceProc.saveOrUpdateBatch(materlist,materlist.size()); + log.info("QPMES060服务被调用IMaterialServiceProc.saveOrUpdateBatch:" + flag); + qpmes060ResponseBody.setMESSAGE("原材料入库成功"); qpmes060ResponseBody.setSTATUS("S"); qpmes060ResponseBodyArrayList.add(qpmes060ResponseBody); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialService.java index 89c00ad..0eb8f6d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialService.java +++ b/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; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.nl.common.domain.query.PageQuery; import org.nl.wms.sch.material.service.dao.Material; import org.nl.wms.sch.material.service.dto.MaterialQuery; -import org.nl.wms.sch.report.service.dto.ReportQuery; - import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Set; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialServiceProc.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/IMaterialServiceProc.java new file mode 100644 index 0000000..722d72d --- /dev/null +++ b/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 { + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/Material.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/Material.java index 5fcb462..a6d1195 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/Material.java +++ b/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") public class Material 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 = "场地") @@ -32,8 +36,6 @@ public class Material implements Serializable { private String whlCode; @ApiModelProperty(value = "托盘号") private String PalletSN; - @ApiModelProperty(value = "物料条码号") - private String lotSN; @ApiModelProperty(value = "物料编码") private String productName; @ApiModelProperty(value = "物料名称") diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/MaterialProc.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/MaterialProc.java new file mode 100644 index 0000000..f0aa6ae --- /dev/null +++ b/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)); + } +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/mapper/MaterialProcMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/mapper/MaterialProcMapper.java new file mode 100644 index 0000000..0d44ae3 --- /dev/null +++ b/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 { + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/impl/MaterialServiceProcImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/impl/MaterialServiceProcImpl.java new file mode 100644 index 0000000..294a4cc --- /dev/null +++ b/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 implements IMaterialServiceProc { + + +}