Browse Source

现场新需求提交

master
psh 6 months ago
parent
commit
4f4ee3f59d
  1. 38
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/controller/MaterialDataController.java
  2. 28
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/MaterialDataService.java
  3. 13
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/dao/mapper/MaterialDataMapper.java
  4. 48
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/dto/MaterialDataDto.java
  5. 70
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/dto/MaterialDataQuery.java
  6. 44
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/impl/MaterialDataServiceImpl.java
  7. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/material/service/dao/Material.java
  8. 50
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLCKTask.java
  9. 46
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLRKTask.java

38
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/controller/MaterialDataController.java

@ -0,0 +1,38 @@
package org.nl.wms.sch.data.controller;
import org.nl.wms.sch.data.service.MaterialDataService;
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* @author psh
* @date 2024-05-17
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "data管理")
@RequestMapping("/api/materialData")
@Slf4j
public class MaterialDataController {
private final MaterialDataService materialDataService;
@GetMapping
@ApiOperation("查询data")
//@PreAuthorize("@el.check('materialData:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(materialDataService.queryAll(whereJson,page),HttpStatus.OK);
}
}

28
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/MaterialDataService.java

@ -0,0 +1,28 @@
package org.nl.wms.sch.data.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
import org.nl.wms.sch.material.service.dao.Material;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @description 服务接口
* @author psh
* @date 2024-05-17
**/
public interface MaterialDataService extends IService<MaterialDataDto> {
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
}

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

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

48
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/dto/MaterialDataDto.java

@ -0,0 +1,48 @@
package org.nl.wms.sch.data.service.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @description /
* @author psh
* @date 2024-05-17
**/
@Data
public class MaterialDataDto implements Serializable {
/** 客户编码 */
private String supplierCode;
/** 客户名称 */
private String supplierName;
/** 物料编码 */
private String productName;
/** 规格 */
private String specification;
/** 来料批次 */
private String batch;
/** 棒源等级 */
private String barLevel;
/** 领料批次 */
private String pickingBatch;
/** 长度 */
private BigDecimal length;
/** 重量 */
private BigDecimal weight;
/** 日期 */
private Timestamp createTime;
/** 操作类型,1-来料,2-领料 */
private Integer type;
}

70
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/dto/MaterialDataQuery.java

@ -0,0 +1,70 @@
package org.nl.wms.sch.data.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
* @description /
* @author psh
* @date 2024-05-17
**/
@Data
public class MaterialDataQuery implements Serializable {
/** 客户编码 */
private String supplierCode;
/** 客户名称 */
private String supplierName;
/** 物料编码 */
private String productName;
/** 规格 */
private String specification;
/** 来料批次 */
private String batch;
/** 棒源等级 */
private String barLevel;
/** 领料批次 */
private String pickingBatch;
/** 长度 */
private BigDecimal length;
/** 重量 */
private BigDecimal weight;
/** 日期 */
private Timestamp createTime;
/** 上月长度 */
private BigDecimal sy_length;
/** 上月重量 */
private BigDecimal sy_weight;
/** 来料长度 */
private BigDecimal ll_length;
/** 来料重量 */
private BigDecimal ll_weight;
/** 生产长度 */
private BigDecimal sc_length;
/** 生产重量 */
private BigDecimal sc_weight;
/** 结存长度 */
private BigDecimal jc_length;
/** 结存重量 */
private BigDecimal jc_weight;
}

44
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/impl/MaterialDataServiceImpl.java

@ -0,0 +1,44 @@
package org.nl.wms.sch.data.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.sch.data.service.MaterialDataService;
import org.nl.wms.sch.data.service.dao.mapper.MaterialDataMapper;
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
import org.nl.wms.sch.material.service.dao.Material;
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Pageable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import cn.hutool.core.util.ObjectUtil;
/**
* @description 服务实现
* @author psh
* @date 2024-05-17
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class MaterialDataServiceImpl extends ServiceImpl<MaterialDataMapper, MaterialDataDto> implements MaterialDataService {
@Override
public Map<String,Object> queryAll(Map whereJson, Pageable page){
//todo
return new HashMap<>();
}
}

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

@ -56,6 +56,9 @@ public class Material implements Serializable {
private String incomingchipping;
@ApiModelProperty(value = "绑定状态")
private String group_bind_material_status;
@ApiModelProperty(value = "棒源等级")
private String barLevel;
public void copyFrom(QPMES060RequestBody source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));

50
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLCKTask.java

@ -1,5 +1,6 @@
package org.nl.wms.sch.task_manage.task.tasks;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
@ -17,6 +18,8 @@ import org.nl.wms.mes.domain.QPMES065Request;
import org.nl.wms.mes.domain.QPMES065RequestBody;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.data.service.dao.mapper.MaterialDataMapper;
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.material.service.dao.Material;
@ -40,9 +43,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -74,6 +75,8 @@ public class YCLCKTask extends AbstractTask {
private PointMapper pointMapper;
@Autowired
private MaterialMapper materialMapper;
@Autowired
private MaterialDataMapper materialDataMapper;
@Override
@ -228,11 +231,10 @@ public class YCLCKTask extends AbstractTask {
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setGroup_id(ObjectUtil.isNotEmpty(one)?one.getGroup_id():null);
taskObj.setRemark("任务完成");
List<Material> materialList = materialMapper.selectList(new LambdaQueryWrapper<Material>()
.eq(Material::getPalletSN, taskObj.getVehicle_code2())
.eq(Material::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue()));
try {
//todo 待确认具体传值
List<Material> materialList = materialMapper.selectList(new LambdaQueryWrapper<Material>()
.eq(Material::getPalletSN, taskObj.getVehicle_code2())
.eq(Material::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue()));
if (ObjectUtil.isNotEmpty(materialList)) {
String url = "http://192.168.9.124/sitAppWebApi/PDSToWMS/Api/QPMES065";
QPMES065Request qpmes065Request = new QPMES065Request();
@ -246,7 +248,6 @@ public class YCLCKTask extends AbstractTask {
QPMES065RequestBody qpmes065RequestBody=new QPMES065RequestBody();
double qty=0;
for(Material material:materialList) {
qpmes065RequestBody.setMoname(extGroupData.getString("workorder_code"));
qpmes065RequestBody.setLotSN(material.getPalletSN());
qty+=Double.parseDouble(material.getQty());
@ -268,6 +269,39 @@ public class YCLCKTask extends AbstractTask {
} catch (Exception e) {
log.error("原材料出库上报MES失败{}", e.getMessage(), e);
}
try{
Map<String, List<Material>> groupedBy = materialList.stream()
.collect(Collectors.groupingBy(Material::getProductName));
if(ObjectUtil.isNotEmpty(groupedBy)) {
Iterator<Map.Entry<String, List<Material>>> iterator = groupedBy.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, List<Material>> next = iterator.next();
List<Material> tempList = next.getValue();
Material material = tempList.get(0);
double length = 0.0;
double weight = 0.0;
for (Material temp : tempList) {
length += Double.parseDouble(temp.getIncomingLength());
weight += Double.parseDouble(temp.getIncomingWeight());
}
MaterialDataDto materialDataDto = new MaterialDataDto();
materialDataDto.setSupplierCode(material.getSupplierCode());
materialDataDto.setSupplierName(material.getSupplierName());
materialDataDto.setProductName(material.getProductName());
materialDataDto.setSpecification(material.getSpecification());
materialDataDto.setPickingBatch(extGroupData.getString("batch"));
materialDataDto.setBarLevel(material.getBarLevel());
materialDataDto.setLength(BigDecimal.valueOf(length));
materialDataDto.setWeight(BigDecimal.valueOf(weight));
materialDataDto.setCreateTime(new DateTime().toTimestamp());
materialDataDto.setType(2);
materialDataMapper.insert(materialDataDto);
}
}
}catch (Exception e){
log.error("原材料入库暂存入库数据失败{}",e.getMessage(),e);
}
}
if (status.equals(TaskStatus.CANCELED)) { // 取消
// 终点解锁

46
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLRKTask.java

@ -1,5 +1,6 @@
package org.nl.wms.sch.task_manage.task.tasks;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
@ -15,6 +16,8 @@ import org.nl.wms.mes.domain.QPMES062Request;
import org.nl.wms.mes.domain.QPMES062RequestBody;
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.data.service.dao.mapper.MaterialDataMapper;
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.material.service.dao.Material;
@ -38,11 +41,9 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: psh
@ -73,6 +74,8 @@ public class YCLRKTask extends AbstractTask {
private PointMapper pointMapper;
@Autowired
private MaterialMapper materialMapper;
@Autowired
private MaterialDataMapper materialDataMapper;
@Override
// @Transactional(rollbackFor = Exception.class)
@ -239,6 +242,39 @@ public class YCLRKTask extends AbstractTask {
}catch (Exception e){
log.error("原材料入库上报MES失败{}",e.getMessage(),e);
}
try{
Map<String, List<Material>> groupedBy = materialList.stream()
.collect(Collectors.groupingBy(Material::getProductName));
if(ObjectUtil.isNotEmpty(groupedBy)) {
Iterator<Map.Entry<String, List<Material>>> iterator = groupedBy.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, List<Material>> next = iterator.next();
List<Material> tempList=next.getValue();
Material material = tempList.get(0);
double length = 0.0;
double weight = 0.0;
for (Material temp : tempList) {
length += Double.parseDouble(temp.getIncomingLength());
weight += Double.parseDouble(temp.getIncomingWeight());
}
MaterialDataDto materialDataDto = new MaterialDataDto();
materialDataDto.setSupplierCode(material.getSupplierCode());
materialDataDto.setSupplierName(material.getSupplierName());
materialDataDto.setProductName(material.getProductName());
materialDataDto.setSpecification(material.getSpecification());
materialDataDto.setBatch(material.getBatch());
materialDataDto.setBarLevel(material.getBarLevel());
materialDataDto.setLength(BigDecimal.valueOf(length));
materialDataDto.setWeight(BigDecimal.valueOf(weight));
materialDataDto.setCreateTime(new DateTime().toTimestamp());
materialDataDto.setType(1);
materialDataMapper.insert(materialDataDto);
}
}
}catch (Exception e){
log.error("原材料入库暂存入库数据失败{}",e.getMessage(),e);
}
}
if (status.equals(TaskStatus.CANCELED)) { // 取消
// 终点解锁

Loading…
Cancel
Save