no message
parent
2278bae506
commit
11cd78db71
|
|
@ -2,6 +2,9 @@ package com.youchain.appupdate.ReturnJson;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class RLocLayout {
|
||||
String id;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.youchain.appupdate.ReturnJson;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class ReturnTaskVo {
|
||||
private Long taskId;//任务id
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 绑定容器入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class BindStock {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 装配线叫料入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class CallAssemblyLine {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
/**
|
||||
* 呼叫容器的入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class CallStock {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 容器入场
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class ContainerIn {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.youchain.appupdate.inputJson;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class CurrentPage {
|
||||
@ApiModelProperty(value = "当前页")
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 翻包拣货入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class FbPick {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 满车入库
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class FullStockIn {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 满车出库
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class FullStockOut {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 线边返空的入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class LineReturn {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.youchain.appupdate.inputJson;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class LineScanStock {
|
||||
@ApiModelProperty(value = "容器编号")
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* KMReS接口回调的入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class MissionStateCallback {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
/**
|
||||
* 扫描物料接口
|
||||
* 入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class PointCallStock {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
/**
|
||||
* 扫描物料接口
|
||||
* 入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class ScanItemCode {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
/**
|
||||
* 小件-满料出库入参
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class SmallCallStock {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.youchain.appupdate.inputJson;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class ZCBindingMaterial {
|
||||
@ApiModelProperty(value = "机械臂的机台号")
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "大屏数据显示")
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ import java.io.Serializable;
|
|||
@Data
|
||||
public class SysNewAppUpdateDto implements Serializable {
|
||||
|
||||
private String Code;
|
||||
private String code;
|
||||
|
||||
private String Msg;
|
||||
private String msg;
|
||||
|
||||
/** 项目名称 */
|
||||
private String appName;
|
||||
|
|
|
|||
|
|
@ -97,8 +97,6 @@ public class SysAppUpdateServiceImpl implements SysAppUpdateService {
|
|||
if(ObjectUtil.isNull(file)){
|
||||
throw new BadRequestException("上传失败");
|
||||
}
|
||||
//name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;
|
||||
|
||||
|
||||
Long size=multipartFile.getSize()/1024;
|
||||
SysAppUpdate resources=new SysAppUpdate();
|
||||
|
|
|
|||
|
|
@ -29,6 +29,5 @@ import java.util.List;
|
|||
* @date 2024-02-21
|
||||
**/
|
||||
public interface BigBomRepository extends JpaRepository<BigBom, Long>, JpaSpecificationExecutor<BigBom> {
|
||||
@Query(value = "SELECT b FROM BigBom b WHERE b.bigItem.id = ?1 and b.item.id=?2", nativeQuery = false)
|
||||
List<BigBom> findRepeat(Long bigItemId, Long itemId);
|
||||
|
||||
}
|
||||
|
|
@ -29,6 +29,5 @@ import java.util.List;
|
|||
* @date 2024-02-21
|
||||
**/
|
||||
public interface BigItemRepository extends JpaRepository<BigItem, Long>, JpaSpecificationExecutor<BigItem> {
|
||||
@Query(value = "SELECT i FROM BigItem i WHERE i.code = ?1 ")
|
||||
BigItem findByBigItemCode(String completeCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,16 +31,12 @@ import java.util.List;
|
|||
* @date 2023-08-17
|
||||
**/
|
||||
public interface BoxRepository extends JpaRepository<Box, Long>, JpaSpecificationExecutor<Box> {
|
||||
@Query(value = "SELECT * FROM base_box b WHERE b.item_id = ?1 ", nativeQuery = true)
|
||||
Box getBoxByItem(long itemId);
|
||||
|
||||
@Query(value = "SELECT * FROM base_box b WHERE b.code = ?1 ", nativeQuery = true)
|
||||
Box getBoxByCode(String code);
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "update base_box b set b.lamp_status = :lamp_status WHERE b.IP = :ip and b.lamp_code =:lamp_code ", nativeQuery = true)
|
||||
@Query(value = "update base_box b set b.lamp_status = :lamp_status where b.IP = :ip and b.lamp_code =:lamp_code ", nativeQuery = true)
|
||||
void updateBoxLampStatus(@Param("ip") String ip,@Param("lamp_code")String lamp_code,@Param("lamp_status")String lamp_status);
|
||||
|
||||
@Query(value = "SELECT * FROM base_box", nativeQuery = true)
|
||||
@Query(value = "select * from base_box", nativeQuery = true)
|
||||
List<Box> getBoxAllData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,6 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
|
|||
@Query(" from Point p where p.code in :pointCodes")
|
||||
List<Point> findByCodes(Set pointCodes);
|
||||
|
||||
@Query(" from Point p where p.beatCode = :beat_code")
|
||||
List<Point> findByByBeat_code(String beat_code);
|
||||
@Query(" from Point p where p.beatCode = :beatCode")
|
||||
List<Point> findByByBeatCode(String beatCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,5 @@ import javax.transaction.Transactional;
|
|||
* @date 2023-12-15
|
||||
**/
|
||||
public interface ZcjxbRepository extends JpaRepository<Zcjxb, Long>, JpaSpecificationExecutor<Zcjxb> {
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "UPDATE base_zcjxb zc SET zc.modbus_tcp_item = :modbusTcpItem WHERE zc.communication_type = 'MODBUSTCP' AND zc.code = :code", nativeQuery = true)
|
||||
void updateZCJItem(@Param("modbusTcpItem") String modbusTcpItem, @Param("code") String code);
|
||||
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ public class PointController {
|
|||
}
|
||||
|
||||
|
||||
Map<String, Area> existingArea = areaList.stream().collect(Collectors.toMap(Area::getName, Area -> Area));
|
||||
Map<String, Area> existingArea = areaList.stream().collect(Collectors.toMap(Area::getName, area -> area));
|
||||
|
||||
List<Point> pointsToCreate = new ArrayList<>();//新增点位集合
|
||||
List<Point> pointsToUpdate = new ArrayList<>();//修改点位集合
|
||||
|
|
@ -262,7 +262,7 @@ public class PointController {
|
|||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "存储类型和库区只能选择一项!", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
List<Point> pointList = pointService.findByByBeat_code(smallArea);
|
||||
List<Point> pointList = pointService.findByByBeatCode(smallArea);
|
||||
if (pointList.size() <= 0) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), smallArea + "没有小库区对应的点位,请维护!", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,15 +176,6 @@ public class StockController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/updateStockOK")
|
||||
@Log("修改stock")
|
||||
@ApiOperation("修改stock")
|
||||
@PreAuthorize("@el.check('stock:edit')")
|
||||
public ResponseEntity<Object> updateStockOK(@Validated @RequestBody Stock resources) {
|
||||
stockService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/updateStockStatus")
|
||||
@Log("批量修改stock的状态")
|
||||
@ApiOperation("批量修改stock的状态")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
* Copyright 2019-2020 Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
/**
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @website https://elAdmin.vip
|
||||
* @description 服务接口
|
||||
* @date 2023-07-26
|
||||
**/
|
||||
|
|
@ -125,6 +125,6 @@ public interface PointService {
|
|||
* @param beat_code
|
||||
* @return
|
||||
*/
|
||||
List<Point> findByByBeat_code(String beat_code);
|
||||
List<Point> findByByBeatCode(String beatCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
/**
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @website https://elAdmin.vip
|
||||
* @description 服务接口
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
* Copyright 2019-2020 Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -25,7 +25,7 @@ import java.io.IOException;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @website https://elAdmin.vip
|
||||
* @description 服务接口
|
||||
* @author liuxue
|
||||
* @date 2023-07-28
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
* Copyright 2019-2020 Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -25,7 +25,7 @@ import java.io.IOException;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @website https://elAdmin.vip
|
||||
* @description 服务接口
|
||||
* @author LiuXue
|
||||
* @date 2023-08-28
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.io.IOException;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @website https://elAdmin.vip
|
||||
* @description 服务接口
|
||||
* @author dengjiangkun
|
||||
* @date 2023-12-15
|
||||
|
|
@ -43,21 +43,18 @@ public interface ZcjxbService {
|
|||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<ZcjxbDto>
|
||||
*/
|
||||
List<ZcjxbDto> queryAll(ZcjxbQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return ZcjxbDto
|
||||
*/
|
||||
ZcjxbDto findById(Long id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return ZcjxbDto
|
||||
*/
|
||||
ZcjxbDto create(Zcjxb resources);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@ public class StockQueryCriteria{
|
|||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String code;
|
||||
|
||||
/** 等于 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String eq_code;
|
||||
|
||||
/** 等于 */
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private String status;
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ public class BoxServiceImpl implements BoxService {
|
|||
* @param index 对应的盒子
|
||||
* @return
|
||||
*/
|
||||
public Boolean executeLampStatus(String lamp_status, String ip, String index) {
|
||||
switch (lamp_status) {
|
||||
public Boolean executeLampStatus(String lampStatus, String ip, String index) {
|
||||
switch (lampStatus) {
|
||||
case "0":
|
||||
NettyUtils.light_off(ip, index, null);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ public class PointServiceImpl implements PointService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Point> findByByBeat_code(String beat_code) {
|
||||
return pointRepository.findByByBeat_code(beat_code);
|
||||
public List<Point> findByByBeatCode(String beatCode) {
|
||||
return pointRepository.findByByBeatCode(beatCode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ public class StockServiceImpl implements StockService {
|
|||
double moveQty = task.getPlanQty();
|
||||
|
||||
if (pick.getStock() == null) {
|
||||
List<Inventory> inventoryList = inventoryRepository.fingByStock(dstStock.getId());
|
||||
List<Inventory> inventoryList = inventoryRepository.findByStock(dstStock.getId());
|
||||
if (!inventoryList.isEmpty()) {
|
||||
throw new RuntimeException(dstStock + "目标托盘已绑定其他出库单,请更换其它的托盘!");
|
||||
}
|
||||
|
|
@ -888,7 +888,7 @@ public class StockServiceImpl implements StockService {
|
|||
* @param stock
|
||||
*/
|
||||
private void clearInventory(Stock stock) {
|
||||
List<Inventory> inventoryList = inventoryRepository.fingByStock(stock.getId());
|
||||
List<Inventory> inventoryList = inventoryRepository.findByStock(stock.getId());
|
||||
inventoryRepository.deleteAll(inventoryList);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.youchain.basicdata.vo;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class BarCodeVo {
|
||||
public String mo;//箱条码全部内容
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class RPTaskList {
|
||||
Long pickDetailId;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class RRkMo {
|
||||
Long itemId;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.youchain.businessdata.inputJson;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class IPPickDetail {
|
||||
Long pickDetailId;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.youchain.businessdata.inputJson;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class IPTask {
|
||||
String itemCode;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class IRkConfirm {
|
||||
String mo;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.youchain.businessdata.inputJson;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class IRkInv {
|
||||
/**物料*/
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class IRkStockCode {
|
||||
/**物料*/
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Data
|
||||
public class IScanPut {
|
||||
String scanCode;
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
"and (:pointId is null or inv.point.id = :pointId) " +
|
||||
"and (:stockId is null or inv.stock.id = :stockId) " +
|
||||
"and (:deptId is null or inv.dept.id = :deptId)")
|
||||
List<Inventory> fingByInventory(Long itemKeyId, Long pointId, Long stockId, Long deptId);
|
||||
List<Inventory> findByInventory(Long itemKeyId, Long pointId, Long stockId, Long deptId);
|
||||
|
||||
@Query("from Inventory inv where inv.stock.id=:stockId and inv.quantity>0")
|
||||
List<Inventory> fingByStock(Long stockId);
|
||||
List<Inventory> findByStock(Long stockId);
|
||||
|
||||
@Query("from Inventory inv where inv.queuedQty <= 0 and inv.quantity >= 0 " +
|
||||
"and (:areaId is null or inv.point.area.id = :areaId) " +
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, J
|
|||
* @param status PICK_ALL 已完成 ALLOCATE 待执行
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select a.* from data_pick_detail a INNER JOIN base_item b on a.item_id = b.id " +
|
||||
"WHERE b.name = '后桶' and a.create_time > :time and a.`status` = :status " +
|
||||
"UNION select a.* from data_pick_detail a INNER JOIN base_item b on a.item_id = b.id " +
|
||||
"WHERE b.name = '前桶' and a.create_time > :time and a.`status` = :status ", nativeQuery = true)
|
||||
@Query(value = "select a.* from data_pick_detail a inner join base_item b on a.item_id = b.id " +
|
||||
"where b.name = '后桶' and a.create_time > :time and a.`status` = :status " +
|
||||
"union select a.* from data_pick_detail a inner join base_item b on a.item_id = b.id " +
|
||||
"where b.name = '前桶' and a.create_time > :time and a.`status` = :status ", nativeQuery = true)
|
||||
List<PickDetail> queryOutQHData(String time, String status);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ public interface TaskLogRepository extends JpaRepository<TaskLog, Long>, JpaSpec
|
|||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "SELECT * FROM data_task_log log WHERE log.task_id=?1 ", nativeQuery = true)
|
||||
@Query(value = "select * from data_task_log log where log.task_id=?1 ", nativeQuery = true)
|
||||
TaskLog getTaskLogbyTaskId(long taskId);
|
||||
}
|
||||
|
|
@ -20,6 +20,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "KMReS")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "mes接口管理")
|
||||
|
|
@ -34,7 +37,7 @@ public class MesController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> yclbl(@Validated @RequestBody Yclbl yclbl) {
|
||||
try {
|
||||
pickService.materialBL(yclbl);
|
||||
pickService.materialBl(yclbl);
|
||||
return successResponse("备料成功!");
|
||||
} catch (Exception e) {
|
||||
return badResponse("备料失败:" + e.getMessage());
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public class PickDetailController {
|
|||
@PreAuthorize("@el.check('pickDetail:pickingApp')")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> pickingApp(@RequestBody IPPickDetail d) throws Exception{
|
||||
return pick_in(d.getPickDetailId());
|
||||
return pickIn(d.getPickDetailId());
|
||||
}
|
||||
|
||||
@PostMapping("/picking")
|
||||
|
|
@ -156,15 +156,15 @@ public class PickDetailController {
|
|||
@ApiOperation("拣货确认")
|
||||
@AnonymousAccess
|
||||
public synchronized ResponseEntity<Object> picking(@RequestBody Long pickDetailId) throws Exception {
|
||||
return pick_in(pickDetailId);
|
||||
return pickIn(pickDetailId);
|
||||
}
|
||||
|
||||
public ResponseEntity<Object> pick_in(Long pickDetailId){
|
||||
public ResponseEntity<Object> pickIn(Long pickDetailId){
|
||||
//查询未完成的拣货任务
|
||||
List<Task> Tasks = taskService.findByPickNotAllTask(pickDetailId);
|
||||
if (Tasks.size() > 0) {
|
||||
List<Task> tasks = taskService.findByPickNotAllTask(pickDetailId);
|
||||
if (tasks.size() > 0) {
|
||||
try {
|
||||
for (Task task : Tasks) {
|
||||
for (Task task : tasks) {
|
||||
log.error("正在拣货-----");
|
||||
taskService.pickConfirm(task.getId(), task.getPlanQty());
|
||||
}
|
||||
|
|
@ -187,10 +187,10 @@ public class PickDetailController {
|
|||
@AnonymousAccess
|
||||
public synchronized ResponseEntity<Object> pickBarBack(@RequestBody Long pickDetailId) throws Exception {
|
||||
//查询已完成的拣货任务
|
||||
List<Task> Tasks = taskService.findByPickAllTask(pickDetailId);
|
||||
if (Tasks.size() > 0) {
|
||||
List<Task> tasks = taskService.findByPickAllTask(pickDetailId);
|
||||
if (tasks.size() > 0) {
|
||||
try {
|
||||
for (Task task : Tasks) {
|
||||
for (Task task : tasks) {
|
||||
taskService.pickBarBack(task.getId(), task.getMoveQty());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -102,30 +102,6 @@ public interface AsnDetailService {
|
|||
*/
|
||||
AsnDetail toEntity(AsnDetailDto detailDto);
|
||||
|
||||
/**
|
||||
* 根据code查找容器
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
AsnDetail findByStock(String code, String status);
|
||||
|
||||
/**
|
||||
* 自动生成AsnDetail
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint, String propC1, String gdh, String propC3, Timestamp propD1, Double orderQty, String Po);
|
||||
|
||||
/**
|
||||
* 容器入场自动生成AsnDetail
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
AsnDetail createAsnDetail(Item item, Stock stock);
|
||||
|
||||
/**
|
||||
* 根据Mo查找AsnDetail
|
||||
*
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ public interface InventoryService {
|
|||
|
||||
Inventory toEntity(InventoryDto inventoryDto);
|
||||
|
||||
List<Inventory> findByItemIdAndAreaCode(long itemId, String areaCode);
|
||||
|
||||
Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type);
|
||||
|
||||
|
|
@ -109,5 +108,4 @@ public interface InventoryService {
|
|||
|
||||
List<Inventory> getInvForPlan(String type, Long areaId, Long itemId, Long deptId);
|
||||
|
||||
Inventory updateInventory(Task task, Stock stock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,10 +97,6 @@ public interface PickDetailService {
|
|||
*/
|
||||
String allocate(long id, double quantity, Point endPoint);
|
||||
|
||||
/**
|
||||
* 整出分配
|
||||
*/
|
||||
void allocateAll(long id, Point endPoint, String areaCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 取消分配
|
||||
|
|
@ -122,8 +118,6 @@ public interface PickDetailService {
|
|||
*/
|
||||
PickDetail toEntity(PickDetailDto pickDetailDto);
|
||||
|
||||
PickDetail createPickDetail(Item item, String po);
|
||||
|
||||
/**
|
||||
* 出库单分配
|
||||
*
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public interface PickService {
|
|||
*
|
||||
* @param yclbl 原材料备料
|
||||
*/
|
||||
void materialBL(Yclbl yclbl) ;
|
||||
void materialBl(Yclbl yclbl) ;
|
||||
|
||||
/**
|
||||
* 根据出库单备料
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
agvTask.setStockCode(containerCode);
|
||||
agvTask.setStatus(BizStatus.UP_CONTAINER);
|
||||
agvTask.setStartTime(new Timestamp(new Date().getTime()));
|
||||
this.update(agvTask);
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -435,10 +435,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
switch (endAreaName) {
|
||||
case AreaNameDic.XJFBQ:
|
||||
case AreaNameDic.DJFBQ:
|
||||
handleFBQ(taskList, stock, endPoint);//备料完成
|
||||
handleFbq(taskList, stock, endPoint);//备料完成
|
||||
break;
|
||||
case AreaNameDic.JLQ:
|
||||
handleJL(stock, endPoint,agvTask);//叫料完成
|
||||
handleJl(stock, endPoint,agvTask);//叫料完成
|
||||
break;
|
||||
case AreaNameDic.CPXXQ:
|
||||
case AreaNameDic.CPRKQ:
|
||||
|
|
@ -449,7 +449,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
agvTask.setStatus(BizStatus.FINISH);
|
||||
agvTask.setStockCode(containerCode);
|
||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
||||
update(agvTask);
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
private void handleForkDownContainer(AgvTask agvTask, String containerCode) {
|
||||
|
|
@ -471,7 +471,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
agvTask.setStatus(BizStatus.FINISH);
|
||||
agvTask.setStockCode(containerCode);
|
||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
||||
update(agvTask);
|
||||
agvTaskRepository.save(agvTask);
|
||||
}
|
||||
|
||||
private synchronized void handleResendTask(AgvTask agvTask) {
|
||||
|
|
@ -560,7 +560,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
*
|
||||
* @param taskList
|
||||
*/
|
||||
private void handleFBQ(List<Task> taskList, Stock stock, Point endPoint) {
|
||||
private void handleFbq(List<Task> taskList, Stock stock, Point endPoint) {
|
||||
//将托盘的物料移动到备料库位
|
||||
stock.setPoint(endPoint);
|
||||
stockRepository.save(stock);
|
||||
|
|
@ -582,7 +582,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
*
|
||||
* @param stock
|
||||
*/
|
||||
private void handleJL(Stock stock, Point endPoint,AgvTask agvTask) {
|
||||
private void handleJl(Stock stock, Point endPoint,AgvTask agvTask) {
|
||||
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
|
||||
if (!inventoryList.isEmpty()) {
|
||||
inventoryService.deleteAll(inventoryList.stream().map(Inventory::getId).toArray(Long[]::new));
|
||||
|
|
@ -649,7 +649,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
agvTask.setStatus(BizStatus.CANCEL);
|
||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
||||
this.update(agvTask);
|
||||
agvTaskRepository.save(agvTask);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,46 +137,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
|||
return asnDetailMapper.toEntity(detailDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsnDetail findByStock(String code, String status) {
|
||||
return asnDetailRepository.findByStock(code, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint, String propC1, String gdh, String propC3, Timestamp propD1, Double orderQty, String Po) {
|
||||
AsnDetail asnDetail = new AsnDetail();
|
||||
asnDetail.setItem(item);
|
||||
asnDetail.setLineNo(1L);
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
asnDetail.setOrderQty(orderQty);
|
||||
asnDetail.setDept(item.getDept());
|
||||
asnDetail.setStock(stock);
|
||||
asnDetail.setPoint(srcPoint);
|
||||
asnDetail.setPropC1(propC1);
|
||||
asnDetail.setOrderNumber(gdh);
|
||||
asnDetail.setPropC3(propC3);
|
||||
asnDetail.setPropD1(propD1);
|
||||
asnDetail.setPo(Po);
|
||||
create(asnDetail);
|
||||
return asnDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsnDetail createAsnDetail(Item item, Stock stock) {
|
||||
AsnDetail asnDetail = new AsnDetail();
|
||||
asnDetail.setItem(item);
|
||||
asnDetail.setLineNo(1L);
|
||||
asnDetail.setStatus(BizStatus.RECEIVED);
|
||||
asnDetail.setOrderQty(item.getExtendD1());
|
||||
asnDetail.setReceivedQty(item.getExtendD1());
|
||||
asnDetail.setDept(item.getDept());
|
||||
String propC1 = DateUtil.format(cn.hutool.core.date.DateUtil.date(), "yyyyMMdd");
|
||||
asnDetail.setPropC1(propC1);
|
||||
asnDetail.setStock(stock);
|
||||
asnDetail.setPo(TimeNumberUtils.getRCCode());
|
||||
create(asnDetail);
|
||||
return asnDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AsnDetail> existsByboxNumber(Set boxNumber) {
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ public class InventoryLogServiceImpl implements InventoryLogService {
|
|||
log.setRefObjId(refObjId);
|
||||
log.setInvId(invId);
|
||||
log.setDescription(description);
|
||||
create(log);
|
||||
inventoryLogRepository.save(log);
|
||||
return log;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,16 +135,10 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
return inventoryMapper.toEntity(inventoryDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Inventory> findByItemIdAndAreaCode(long itemId, String areaCode) {
|
||||
return inventoryRepository.findByItemIdAndAreaCode(itemId, areaCode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type) {
|
||||
List<Inventory> inventoryList = inventoryRepository.fingByInventory(itemKey.getId(), point.getId(), stock.getId(), dept.getId());
|
||||
List<Inventory> inventoryList = inventoryRepository.findByInventory(itemKey.getId(), point.getId(), stock.getId(), dept.getId());
|
||||
Inventory inventory = null;
|
||||
if (inventoryList.size() > 0) {
|
||||
inventory = inventoryList.get(0);
|
||||
|
|
@ -166,7 +160,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
|
||||
@Override
|
||||
public List<Inventory> queryInventory(Stock stock) {
|
||||
return inventoryRepository.fingByStock(stock.getId());
|
||||
return inventoryRepository.findByStock(stock.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -174,15 +168,6 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
return inventoryRepository.getInvForPlan(type, areaId, itemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory updateInventory(Task task, Stock stock) {
|
||||
Inventory inventory = getInventory(task.getItemKey(), task.getDstPoint(),
|
||||
task.getSrcStock(), task.getDept(), BizStatus.RECEIVING_UP);
|
||||
inventory.addQty(inventory, task.getPlanQty());
|
||||
update(inventory);
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public List<Object[]> queryItemStock() {
|
||||
String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " +
|
||||
" from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code";
|
||||
|
|
|
|||
|
|
@ -213,50 +213,15 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
taskRepository.save(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public synchronized void allocateAll(long id, Point endPoint, String areaCode) throws Exception {
|
||||
PickDetailDto pickDetailDto = findById(id);
|
||||
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
|
||||
ItemDto itemDto = pickDetailDto.getItem();
|
||||
Item item = itemMapper.toEntity(itemDto);
|
||||
Dept dept = item.getDept();//仓库
|
||||
List<Inventory> Inventorys = inventoryRepository.findByItemIdAndAreaCode(item.getId(), item.getGoodType());
|
||||
if (Inventorys.size() > 0) {
|
||||
Inventory inv = Inventorys.get(0);
|
||||
//库存冻结状态不允许出库
|
||||
if (inv.getBeLock()) {
|
||||
throw new RuntimeException("库存锁定,不允许出库!");
|
||||
}
|
||||
Stock stock = inv.getStock();//容器
|
||||
Point startPoint = inv.getPoint();//起始点位
|
||||
inv.setQueuedQty(inv.getQuantity());
|
||||
inventoryRepository.save(inv);
|
||||
pd.setAllocatedQty(inv.getQuantity());
|
||||
pd.setOrderQty(pd.getAllocatedQty());
|
||||
if (pd.getOrderQty().equals(pd.getAllocatedQty())) {
|
||||
pd.setStatus(BizStatus.ALLOCATE);
|
||||
}
|
||||
pickDetailRepository.save(pd);
|
||||
|
||||
//生成搬运任务
|
||||
AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "");
|
||||
agvTaskRepository.save(agvTask);
|
||||
|
||||
//生成Task任务
|
||||
createTask(inv, pd, inv.getQuantity(), item, startPoint, endPoint, dept);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public synchronized void cancelAllocate(long id, double quantity) throws Exception {
|
||||
|
||||
PickDetailDto pickDetailDto = findById(id);
|
||||
PickDetail pd = toEntity(pickDetailDto);
|
||||
List<Task> Tasks = taskRepository.findByPickNotAllTask(id);
|
||||
for (Task task : Tasks) {
|
||||
//根据Taskz找到对应的库存
|
||||
List<Task> tasks = taskRepository.findByPickNotAllTask(id);
|
||||
for (Task task : tasks) {
|
||||
//根据task找到对应的库存
|
||||
Inventory inv = inventoryRepository.findById(task.getInvId()).get();
|
||||
inv.setQueuedQty(inv.getQueuedQty() - pd.getAllocatedQty());
|
||||
inventoryRepository.save(inv);
|
||||
|
|
@ -298,22 +263,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
return ts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PickDetail createPickDetail(Item item, String po) {
|
||||
PickDetail d = new PickDetail();
|
||||
d.setItem(item);
|
||||
d.setLineNo(1);
|
||||
d.setStatus(BizStatus.OPEN);
|
||||
d.setOrderQty(item.getExtendD1());
|
||||
d.setDept(item.getDept());
|
||||
if (StringUtils.isEmpty(po)) {
|
||||
po = TimeNumberUtils.getCKCode();
|
||||
}
|
||||
d.setPo(po);
|
||||
pickDetailRepository.save(d);
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void allocatePick(Pick pick) {
|
||||
|
|
@ -338,21 +287,21 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
}
|
||||
|
||||
|
||||
List<String> MsgList = new ArrayList<>();//存放提示信息
|
||||
List<String> msgList = new ArrayList<>();//存放提示信息
|
||||
//查询出待分配的pickDetail
|
||||
List<PickDetail> pickDetails = pickDetailRepository.findByPickDetailNoAllocate(pick.getId());
|
||||
for (PickDetail pickDetail : pickDetails) {
|
||||
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), endPoint));
|
||||
msgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), endPoint));
|
||||
}
|
||||
|
||||
boolean containsSuccess = MsgList.stream().anyMatch(s -> s.contains("分配成功"));
|
||||
boolean containsSuccess = msgList.stream().anyMatch(s -> s.contains("分配成功"));
|
||||
if (containsSuccess) {
|
||||
/* 更新出库单状态并写入目标点位*/
|
||||
refreshPickStatus(pick, endPoint);
|
||||
}
|
||||
|
||||
//保存日志
|
||||
logService.saveLogInfo(pick.getCode(), pick.getCode(), "/pick/allocatePick", MsgList.toString(), "出库单分配", 200, "info");
|
||||
logService.saveLogInfo(pick.getCode(), pick.getCode(), "/pick/allocatePick", msgList.toString(), "出库单分配", 200, "info");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ public class PickServiceImpl implements PickService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void materialBL(Yclbl yclbl) {
|
||||
public void materialBl(Yclbl yclbl) {
|
||||
|
||||
/** 验证参数有效性 */
|
||||
validatePick(yclbl);
|
||||
|
|
|
|||
|
|
@ -37,15 +37,15 @@ import java.util.List;
|
|||
public class ScreenMdServiceImpl implements ScreenMdService {
|
||||
private final EntityManager entityMapper;
|
||||
public List<Object[]> queryLayout(String zoneType) {
|
||||
String sql="SELECT ls.id,ls.code,ls.X,ls.Y,i.BAR_CODE,ik.LOT,ls.DISABLED ,inv.`STATUS` inv_status,ls.`STATUS` loc_status\n" +
|
||||
"FROM mdwms.`location_storage` `ls` \n" +
|
||||
"LEFT JOIN mdwms.`stock` `sto` ON `sto`.`LocationStorage_id` = `ls`.`ID` \n" +
|
||||
"LEFT JOIN mdwms.`location` `loc` ON `loc`.`STOCK_ID` = `sto`.`ID` \n" +
|
||||
"LEFT JOIN mdwms.`inventory` `inv` ON `inv`.`LOCATION_ID` = `loc`.`ID` \n" +
|
||||
"LEFT JOIN mdwms.`item_key` `ik` ON `inv`.`ITEM_KEY_ID` = `ik`.`ID` \n" +
|
||||
"LEFT JOIN mdwms.`item` `i` ON `i`.`ID` = `ik`.`ITEM_ID` \t\t\n" +
|
||||
"WHERE `ls`.`TYPE` = '05' and ls.X is not null and ls.Y is not null and ls.x!=0 and ls.y!=0 \n" +
|
||||
"ORDER By `ls`.`CODE`";
|
||||
String sql="select ls.id,ls.code,ls.X,ls.Y,i.BAR_CODE,ik.LOT,ls.DISABLED ,inv.`STATUS` inv_status,ls.`STATUS` loc_status\n" +
|
||||
"from mdwms.`location_storage` `ls` \n" +
|
||||
"left join mdwms.`stock` `sto` on `sto`.`LocationStorage_id` = `ls`.`ID` \n" +
|
||||
"left JOIN mdwms.`location` `loc` on `loc`.`STOCK_ID` = `sto`.`ID` \n" +
|
||||
"left JOIN mdwms.`inventory` `inv` on `inv`.`LOCATION_ID` = `loc`.`ID` \n" +
|
||||
"left JOIN mdwms.`item_key` `ik` on `inv`.`ITEM_KEY_ID` = `ik`.`ID` \n" +
|
||||
"left JOIN mdwms.`item` `i` on `i`.`ID` = `ik`.`ITEM_ID` \t\t\n" +
|
||||
"where `ls`.`TYPE` = '05' and ls.X is not null and ls.Y is not null and ls.x!=0 and ls.y!=0 \n" +
|
||||
"order by `ls`.`CODE`";
|
||||
List<Object[]> ts= entityMapper.createNativeQuery(sql).getResultList();
|
||||
return ts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Component
|
||||
public class BaseComponent {
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ package com.youchain.modules.license;
|
|||
import com.youchain.modules.license.domain.LicenseCheck;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class AGxServerInfos {
|
||||
|
||||
|
|
@ -16,7 +19,7 @@ public abstract class AGxServerInfos {
|
|||
|
||||
LicenseCheck result = new LicenseCheck();
|
||||
try {
|
||||
result.setCpuSerial(this.getCPUSerial());
|
||||
result.setCpuSerial(this.getCpuSerial());
|
||||
result.setMainBoardSerial(this.getMainBoardSerial());
|
||||
}catch (Exception e){
|
||||
log.error("获取服务器硬件信息失败",e);
|
||||
|
|
@ -30,7 +33,7 @@ public abstract class AGxServerInfos {
|
|||
/**
|
||||
* <p>获取CPU序列号</p>
|
||||
*/
|
||||
protected abstract String getCPUSerial() throws Exception;
|
||||
protected abstract String getCpuSerial() throws Exception;
|
||||
|
||||
/**
|
||||
* <p>获取主板序列号</p>
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@ import java.nio.file.attribute.BasicFileAttributes;
|
|||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
@Slf4j
|
||||
public class LicenseValidate {
|
||||
|
||||
public static LicenseCheck getKey_price() throws Exception{
|
||||
public static LicenseCheck getKeyPrice() throws Exception{
|
||||
//读取本地文件
|
||||
FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
String result="";
|
||||
|
|
@ -41,28 +44,28 @@ public class LicenseValidate {
|
|||
}
|
||||
|
||||
String rsaResult= RsaUtils.decryptByPublicKey(RsaProperties.licenseKey,result);
|
||||
LicenseCheck key_price = JSONUtil.toBean(rsaResult, LicenseCheck.class);
|
||||
return key_price;
|
||||
LicenseCheck keyPrice = JSONUtil.toBean(rsaResult, LicenseCheck.class);
|
||||
return keyPrice;
|
||||
}
|
||||
|
||||
|
||||
public static LicenseCheck getSystem_price(){
|
||||
public static LicenseCheck getSystemPrice(){
|
||||
|
||||
FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
String device_path=properties.getPath().getPath()+"key/"+"device.key";
|
||||
String deviceInfo_json=ReadDeviceFile();
|
||||
if(StringUtils.isNotBlank(deviceInfo_json)){
|
||||
String devicePath =properties.getPath().getPath()+"key/"+"device.key";
|
||||
String deviceInfoJson =readDeviceFile();
|
||||
if(StringUtils.isNotBlank(deviceInfoJson)){
|
||||
try{
|
||||
LicenseCheck licenseCheck =JSONUtil.toBean(deviceInfo_json,LicenseCheck.class);
|
||||
BasicFileAttributes attributes = Files.readAttributes(Paths.get(device_path), BasicFileAttributes.class);
|
||||
LicenseCheck licenseCheck =JSONUtil.toBean(deviceInfoJson,LicenseCheck.class);
|
||||
BasicFileAttributes attributes = Files.readAttributes(Paths.get(devicePath), BasicFileAttributes.class);
|
||||
String creationTime = attributes.creationTime().toString();
|
||||
String lastModifiedTime = attributes.lastModifiedTime().toString();
|
||||
Date licenseCheck_date = DateUtil.parse(licenseCheck.getCreateTime(), "yyyy-MM-dd");
|
||||
Date F_creationTime = DateUtil.parse(creationTime, "yyyy-MM-dd");
|
||||
Date F_lastModifiedTime = DateUtil.parse(lastModifiedTime, "yyyy-MM-dd");
|
||||
Date licenseCheckDate = DateUtil.parse(licenseCheck.getCreateTime(), "yyyy-MM-dd");
|
||||
Date fCreationTime = DateUtil.parse(creationTime, "yyyy-MM-dd");
|
||||
Date fLastModifiedTime = DateUtil.parse(lastModifiedTime, "yyyy-MM-dd");
|
||||
|
||||
long betweenDay = DateUtil.between(licenseCheck_date, F_creationTime, DateUnit.DAY);
|
||||
long betweenDay2 = DateUtil.between(licenseCheck_date, F_lastModifiedTime, DateUnit.DAY);
|
||||
long betweenDay = DateUtil.between(licenseCheckDate, fCreationTime, DateUnit.DAY);
|
||||
long betweenDay2 = DateUtil.between(licenseCheckDate, fLastModifiedTime, DateUnit.DAY);
|
||||
if(betweenDay==0&&betweenDay2==0){
|
||||
//文件时间校验通过,不需要重新生成
|
||||
return licenseCheck;
|
||||
|
|
@ -74,26 +77,26 @@ public class LicenseValidate {
|
|||
|
||||
}
|
||||
}
|
||||
CreateDeviceFileOrRead();
|
||||
createDeviceFileOrRead();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void validate() throws Exception{
|
||||
|
||||
LicenseCheck key_price=getKey_price();
|
||||
LicenseCheck keyPrice =getKeyPrice();
|
||||
|
||||
LicenseCheck system_price = getSystem_price();
|
||||
if(system_price==null){
|
||||
LicenseCheck systemPrice = getSystemPrice();
|
||||
if(systemPrice==null){
|
||||
throw new BadRequestException("设备码异常");
|
||||
}
|
||||
|
||||
if(key_price.getMainBoardSerial().equals(system_price.getMainBoardSerial())){
|
||||
if(keyPrice.getMainBoardSerial().equals(systemPrice.getMainBoardSerial())){
|
||||
|
||||
}else{
|
||||
log.error("主板匹配失败");
|
||||
throw new BadRequestException("主板匹配失败");
|
||||
}
|
||||
if(key_price.getCpuSerial().equals(system_price.getCpuSerial())){
|
||||
if(keyPrice.getCpuSerial().equals(systemPrice.getCpuSerial())){
|
||||
|
||||
}else{
|
||||
log.error("CPU匹配失败");
|
||||
|
|
@ -101,10 +104,10 @@ public class LicenseValidate {
|
|||
}
|
||||
|
||||
try{
|
||||
Date end_date = DateUtil.parse(key_price.getEndTime());
|
||||
Date now_date = DateUtil.date();
|
||||
Date endDate = DateUtil.parse(keyPrice.getEndTime());
|
||||
Date nowDate = DateUtil.date();
|
||||
|
||||
if(end_date.before(now_date)){
|
||||
if(endDate.before(nowDate)){
|
||||
throw new BadRequestException("过期的License,请重新生成");
|
||||
}else{
|
||||
|
||||
|
|
@ -115,31 +118,31 @@ public class LicenseValidate {
|
|||
}
|
||||
|
||||
|
||||
public static void saveCode(String license_code) throws Exception{
|
||||
public static void saveCode(String licenseCode) throws Exception{
|
||||
//读取本地文件
|
||||
log.error(license_code);
|
||||
log.error(licenseCode);
|
||||
String rsaResult="";
|
||||
try{
|
||||
rsaResult= RsaUtils.decryptByPublicKey(RsaProperties.licenseKey,license_code);
|
||||
rsaResult= RsaUtils.decryptByPublicKey(RsaProperties.licenseKey,licenseCode);
|
||||
}catch (Exception e){
|
||||
throw new BadRequestException("License无效,请重新生成");
|
||||
}
|
||||
|
||||
//log.error(rsaResult);
|
||||
|
||||
LicenseCheck key_price = JSONUtil.toBean(rsaResult, LicenseCheck.class);
|
||||
LicenseCheck keyPrice = JSONUtil.toBean(rsaResult, LicenseCheck.class);
|
||||
|
||||
|
||||
LicenseCheck system_price =getSystem_price();
|
||||
LicenseCheck systemPrice =getSystemPrice();
|
||||
|
||||
|
||||
if(key_price.getMainBoardSerial().equals(system_price.getMainBoardSerial())){
|
||||
if(keyPrice.getMainBoardSerial().equals(systemPrice.getMainBoardSerial())){
|
||||
log.error("主板匹配成功");
|
||||
}else{
|
||||
log.error("主板匹配失败");
|
||||
throw new BadRequestException("主板匹配失败");
|
||||
}
|
||||
if(key_price.getCpuSerial().equals(system_price.getCpuSerial())){
|
||||
if(keyPrice.getCpuSerial().equals(systemPrice.getCpuSerial())){
|
||||
log.error("CPU匹配成功");
|
||||
}else{
|
||||
log.error("CPU匹配失败");
|
||||
|
|
@ -147,10 +150,10 @@ public class LicenseValidate {
|
|||
}
|
||||
|
||||
try{
|
||||
Date end_date = DateUtil.parse(key_price.getEndTime());
|
||||
Date now_date = DateUtil.date();
|
||||
Date endDate = DateUtil.parse(keyPrice.getEndTime());
|
||||
Date nowDate = DateUtil.date();
|
||||
|
||||
if(end_date.before(now_date)){
|
||||
if(endDate.before(nowDate)){
|
||||
throw new BadRequestException("过期的License,请重新生成");
|
||||
}else{
|
||||
log.error("有效期验证通过");
|
||||
|
|
@ -162,7 +165,7 @@ public class LicenseValidate {
|
|||
FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
|
||||
FileWriter writer = new FileWriter(properties.getPath().getPath()+"key/"+"license.key");
|
||||
writer.write(license_code);
|
||||
writer.write(licenseCode);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -186,39 +189,39 @@ public class LicenseValidate {
|
|||
|
||||
|
||||
|
||||
public static String ReadDeviceFile(){
|
||||
public static String readDeviceFile(){
|
||||
FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
String path=properties.getPath().getPath()+"key/"+"device.key";
|
||||
try{
|
||||
FileReader fileReader=new FileReader(path);
|
||||
String jiami_content=fileReader.readString();
|
||||
String jiemi1= new String(Base64.decodeBase64(jiami_content));
|
||||
String jiemi2= new String(Base64.decodeBase64(jiemi1));
|
||||
return jiemi2;
|
||||
String jiaMiContent =fileReader.readString();
|
||||
String jieMi1= new String(Base64.decodeBase64(jiaMiContent));
|
||||
String jieMi2= new String(Base64.decodeBase64(jieMi1));
|
||||
return jieMi2;
|
||||
}catch (Exception e){
|
||||
log.error("设备码文件不存在");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateDeviceFileOrRead(){
|
||||
public static void createDeviceFileOrRead(){
|
||||
FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
String device_path=properties.getPath().getPath()+"key/"+"device.key";
|
||||
System.out.println("获取配置文件路径:"+device_path);
|
||||
String deviceInfo_json=ReadDeviceFile();
|
||||
if(StringUtils.isNotBlank(deviceInfo_json)){
|
||||
String devicePath =properties.getPath().getPath()+"key/"+"device.key";
|
||||
System.out.println("获取配置文件路径:"+devicePath);
|
||||
String deviceInfoJson =readDeviceFile();
|
||||
if(StringUtils.isNotBlank(deviceInfoJson)){
|
||||
try{
|
||||
LicenseCheck licenseCheck =JSONUtil.toBean(deviceInfo_json,LicenseCheck.class);
|
||||
BasicFileAttributes attributes = Files.readAttributes(Paths.get(device_path), BasicFileAttributes.class);
|
||||
LicenseCheck licenseCheck =JSONUtil.toBean(deviceInfoJson,LicenseCheck.class);
|
||||
BasicFileAttributes attributes = Files.readAttributes(Paths.get(devicePath), BasicFileAttributes.class);
|
||||
String creationTime = attributes.creationTime().toString();
|
||||
String lastModifiedTime = attributes.lastModifiedTime().toString();
|
||||
System.out.println(creationTime+"-------------"+lastModifiedTime);
|
||||
Date licenseCheck_date = DateUtil.parse(licenseCheck.getCreateTime(), "yyyy-MM-dd");
|
||||
Date F_creationTime = DateUtil.parse(creationTime, "yyyy-MM-dd");
|
||||
Date F_lastModifiedTime = DateUtil.parse(lastModifiedTime, "yyyy-MM-dd");
|
||||
Date licenseCheckDate = DateUtil.parse(licenseCheck.getCreateTime(), "yyyy-MM-dd");
|
||||
Date fCreationTime = DateUtil.parse(creationTime, "yyyy-MM-dd");
|
||||
Date fLastModifiedTime = DateUtil.parse(lastModifiedTime, "yyyy-MM-dd");
|
||||
|
||||
long betweenDay = DateUtil.between(licenseCheck_date, F_creationTime, DateUnit.DAY);
|
||||
long betweenDay2 = DateUtil.between(licenseCheck_date, F_lastModifiedTime, DateUnit.DAY);
|
||||
long betweenDay = DateUtil.between(licenseCheckDate, fCreationTime, DateUnit.DAY);
|
||||
long betweenDay2 = DateUtil.between(licenseCheckDate, fLastModifiedTime, DateUnit.DAY);
|
||||
if(betweenDay==0&&betweenDay2==0){
|
||||
//文件时间校验通过,不需要重新生成
|
||||
System.out.println("------------------------文件时间校验通过,不需要重新生成-----------------------");
|
||||
|
|
@ -233,7 +236,7 @@ public class LicenseValidate {
|
|||
}
|
||||
System.out.println("文件不存在,或者文件校验失败,删除文件,重新生成");
|
||||
//文件不存在,或者文件校验失败,删除文件,重新生成
|
||||
FileUtil.del(new File(device_path));
|
||||
FileUtil.del(new File(devicePath));
|
||||
System.out.println("文件不存在,或者文件校验失败,删除文件,重新生成2");
|
||||
|
||||
LicenseCheck licenseCheck=getDeviceInfo();
|
||||
|
|
@ -250,59 +253,12 @@ public class LicenseValidate {
|
|||
String rest= JSONUtil.toJsonStr(licenseCheck).trim();
|
||||
|
||||
|
||||
String jiami_1= Base64.encodeBase64String(rest.getBytes());
|
||||
String jiami_2= Base64.encodeBase64String(jiami_1.getBytes());
|
||||
String jiaMi1 = Base64.encodeBase64String(rest.getBytes());
|
||||
String jiaMi2= Base64.encodeBase64String(jiaMi1.getBytes());
|
||||
|
||||
FileWriter writer = new FileWriter(properties.getPath().getPath()+"key/"+"device.key");
|
||||
writer.write(jiami_2);
|
||||
|
||||
|
||||
|
||||
writer.write(jiaMi2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void CreateDeviceFileTT(){
|
||||
|
||||
|
||||
|
||||
/* FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
|
||||
LicenseCheck licenseCheck=getDeviceInfo();
|
||||
if(!StringUtils.isNotBlank(licenseCheck.getCpuSerial())){
|
||||
licenseCheck.setCpuSerial("");
|
||||
}
|
||||
if(!StringUtils.isNotBlank(licenseCheck.getMainBoardSerial())){
|
||||
licenseCheck.setMainBoardSerial("");
|
||||
}
|
||||
licenseCheck.setCreateTime(DateUtil.today());
|
||||
|
||||
String rest= JSONUtil.toJsonStr(licenseCheck).trim();
|
||||
log.error("------------------------初始化完成-----------------------");
|
||||
log.error(rest);
|
||||
|
||||
String jiami_1= Base64.encodeBase64String(rest.getBytes());
|
||||
String jiami_2= Base64.encodeBase64String(jiami_1.getBytes());
|
||||
|
||||
log.error("------------------------加密完成-----------------------");
|
||||
log.error(jiami_2);
|
||||
|
||||
FileWriter writer = new FileWriter(properties.getPath().getPath()+"key/"+"device.key");
|
||||
writer.write(jiami_2);
|
||||
|
||||
FileReader fileReader=new FileReader(properties.getPath().getPath()+"key/"+"device.key");
|
||||
String jiami_content=fileReader.readString();
|
||||
|
||||
String jiemi1= new String(Base64.decodeBase64(jiami_content));
|
||||
String jiemi2= new String(Base64.decodeBase64(jiemi1));
|
||||
log.error("------------------------解密完成-----------------------");
|
||||
log.error(jiemi2);*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@ import java.io.InputStreamReader;
|
|||
|
||||
/**
|
||||
* <p>用于获取客户Linux服务器的基本信息</p>
|
||||
* @author 92525
|
||||
*/
|
||||
public class LinuxServerInfos extends AGxServerInfos {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String getCPUSerial() throws Exception {
|
||||
protected String getCpuSerial() throws Exception {
|
||||
//序列号
|
||||
String serialNumber = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ import java.util.Scanner;
|
|||
|
||||
/**
|
||||
* <p>用于获取客户Windows服务器的基本信息</p>
|
||||
* @author 92525
|
||||
*/
|
||||
public class WindowsServerInfos extends AGxServerInfos {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String getCPUSerial() throws Exception {
|
||||
protected String getCpuSerial() throws Exception {
|
||||
//序列号
|
||||
String serialNumber = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.youchain.modules.license.domain;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 92525
|
||||
*/
|
||||
public class LicenseCheck implements Serializable {
|
||||
|
||||
|
||||
|
|
@ -20,14 +23,14 @@ public class LicenseCheck implements Serializable {
|
|||
/**
|
||||
* 文件创建时间
|
||||
*/
|
||||
private String CreateTime;
|
||||
private String createTime;
|
||||
|
||||
public String getCreateTime() {
|
||||
return CreateTime;
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
CreateTime = createTime;
|
||||
createTime = createTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import java.util.*;
|
|||
|
||||
/**
|
||||
* 料箱出库任务下发
|
||||
* @author 92525
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ public class AuthorizationController {
|
|||
@Log("App用户登录")
|
||||
@ApiOperation("App登录授权")
|
||||
@AnonymousPostMapping(value = "/app_login")
|
||||
public ResponseEntity<Object> app_login(@Validated @RequestBody AuthAppUserDto authUser, HttpServletRequest request) throws Exception {
|
||||
public ResponseEntity<Object> appLogin(@Validated @RequestBody AuthAppUserDto authUser, HttpServletRequest request) throws Exception {
|
||||
//验证Licens 是否有效
|
||||
LicenseValidate.validate();
|
||||
// 密码解密
|
||||
|
|
@ -202,7 +202,7 @@ public class AuthorizationController {
|
|||
@ApiOperation("获取服务器信息")
|
||||
@AnonymousGetMapping(value = "/deviceinfo")
|
||||
public ResponseEntity<Object> getDeviceInfo() {
|
||||
LicenseCheck licenseCheck= LicenseValidate.getSystem_price();
|
||||
LicenseCheck licenseCheck= LicenseValidate.getSystemPrice();
|
||||
String rest= Base64.encodeBase64String(JSONUtil.toJsonStr(licenseCheck).trim().getBytes());
|
||||
return ResponseEntity.ok(rest);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue