no message
parent
e1409df173
commit
4139044c55
|
|
@ -3,6 +3,8 @@ package com.youchain.appupdate.inputJson;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定容器入参
|
* 绑定容器入参
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,8 +14,12 @@ public class BindStock {
|
||||||
String stockCode;
|
String stockCode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "MO票")
|
@ApiModelProperty(value = "MO票")
|
||||||
String itemCode;
|
String mo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "点位编号")
|
@ApiModelProperty(value = "点位编号")
|
||||||
String pointCode;
|
String pointCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "箱号")
|
||||||
|
Set boxNumbers;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.youchain.appupdate.inputJson;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻包拣货入参
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FbPick {
|
||||||
|
@ApiModelProperty(value = "原托盘")
|
||||||
|
String srcStockCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "箱号")
|
||||||
|
String orderNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "目标托盘")
|
||||||
|
String dstStockCode;
|
||||||
|
}
|
||||||
|
|
@ -2,10 +2,7 @@ package com.youchain.appupdate.rest;
|
||||||
|
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.appupdate.inputJson.CallAssemblyLine;
|
import com.youchain.appupdate.inputJson.*;
|
||||||
import com.youchain.appupdate.inputJson.CallStock;
|
|
||||||
import com.youchain.appupdate.inputJson.ContainerIn;
|
|
||||||
import com.youchain.appupdate.inputJson.BindStock;
|
|
||||||
import com.youchain.basicdata.service.StockService;
|
import com.youchain.basicdata.service.StockService;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -17,6 +14,8 @@ import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
|
|
@ -29,6 +28,22 @@ public class BydAppController {
|
||||||
|
|
||||||
private final StockService stockService;
|
private final StockService stockService;
|
||||||
|
|
||||||
|
@PostMapping("/scanMo")
|
||||||
|
@Log("扫描Mo票")
|
||||||
|
@ApiOperation("扫描Mo票")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> scanMo(@RequestBody BindStock bindStock) {
|
||||||
|
try {
|
||||||
|
//二维码格式:P:A17A;V:148795;M:DP_001/PCS;B:240512JFET;Lot:20240427;S:124051200181131;PO:5913490946/00020;Q:36/20/32;D:2024-04-27;SN:;YX:2025-04-26;DN:D12405120005031AS
|
||||||
|
String QRCode = bindStock.getMo();//Mo票二维码
|
||||||
|
String stockCode = bindStock.getStockCode();//容器编号
|
||||||
|
String boxNumber = stockService.scanMo(stockCode, QRCode);
|
||||||
|
return successResponse("扫描成功!", boxNumber);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return badRequest("扫描失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/materialIn")
|
@PostMapping("/materialIn")
|
||||||
@Log("原材料入库")
|
@Log("原材料入库")
|
||||||
@ApiOperation("原材料入库")
|
@ApiOperation("原材料入库")
|
||||||
|
|
@ -36,14 +51,29 @@ public class BydAppController {
|
||||||
public ResponseEntity<Object> materialIn(@RequestBody BindStock bindStock) {
|
public ResponseEntity<Object> materialIn(@RequestBody BindStock bindStock) {
|
||||||
try {
|
try {
|
||||||
//二维码格式:P:A17A;V:148795;M:DP_001/PCS;B:240512JFET;Lot:20240427;S:124051200181131;PO:5913490946/00020;Q:36/20/32;D:2024-04-27;SN:;YX:2025-04-26;DN:D12405120005031AS
|
//二维码格式:P:A17A;V:148795;M:DP_001/PCS;B:240512JFET;Lot:20240427;S:124051200181131;PO:5913490946/00020;Q:36/20/32;D:2024-04-27;SN:;YX:2025-04-26;DN:D12405120005031AS
|
||||||
String QRCode = bindStock.getItemCode();//Mo票二维码
|
|
||||||
String stockCode = bindStock.getStockCode();//容器编号
|
String stockCode = bindStock.getStockCode();//容器编号
|
||||||
|
Set<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合
|
||||||
String pointCode = bindStock.getPointCode();//点位编号
|
String pointCode = bindStock.getPointCode();//点位编号
|
||||||
stockService.bindContainer(QRCode, stockCode, pointCode);
|
stockService.materialIn(stockCode, boxNumbers, pointCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest(e.getMessage());
|
return badRequest(e.getMessage());
|
||||||
}
|
}
|
||||||
return successRequest("入库成功!");
|
return successResponse("入库成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/fbPicking")
|
||||||
|
@Log("翻包拣货")
|
||||||
|
@ApiOperation("翻包拣货")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> fbPicking(@RequestBody FbPick fbPick) {
|
||||||
|
try {
|
||||||
|
String srcStockCode = fbPick.getSrcStockCode();//原托盘
|
||||||
|
String orderNumber = fbPick.getOrderNumber();//箱号
|
||||||
|
String dstStockCode = fbPick.getDstStockCode();//目标托盘
|
||||||
|
} catch (Exception e) {
|
||||||
|
return badRequest(e.getMessage());
|
||||||
|
}
|
||||||
|
return successResponse("拣货成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,7 +90,7 @@ public class BydAppController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest(e.getMessage());
|
return badRequest(e.getMessage());
|
||||||
}
|
}
|
||||||
return successRequest("入场成功!");
|
return successResponse("入场成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -75,7 +105,7 @@ public class BydAppController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest(e.getMessage());
|
return badRequest(e.getMessage());
|
||||||
}
|
}
|
||||||
return successRequest("出场成功!");
|
return successResponse("出场成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,7 +123,7 @@ public class BydAppController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest(e.getMessage());
|
return badRequest(e.getMessage());
|
||||||
}
|
}
|
||||||
return successRequest("入库成功!");
|
return successResponse("入库成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/callStock")
|
@PostMapping("/callStock")
|
||||||
|
|
@ -109,14 +139,18 @@ public class BydAppController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest(e.getMessage());
|
return badRequest(e.getMessage());
|
||||||
}
|
}
|
||||||
return successRequest("呼叫成功!");
|
return successResponse("呼叫成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResponseEntity<Object> badRequest(String message) {
|
private ResponseEntity<Object> badRequest(String message) {
|
||||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResponseEntity<Object> successRequest(String message) {
|
private ResponseEntity<Object> successResponse(String message) {
|
||||||
return new ResponseEntity<>(ApiResult.fail(OK.value(), message, ""), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.fail(OK.value(), message, ""), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ResponseEntity<Object> successResponse(String message, Object data) {
|
||||||
|
return new ResponseEntity<>(ApiResult.fail(OK.value(), message, data), HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,13 +173,21 @@ public interface StockService {
|
||||||
void callContainer(String itemCode, String pointCode, int scene);
|
void callContainer(String itemCode, String pointCode, int scene);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定容器
|
* 扫描Mo
|
||||||
*
|
* @param mo
|
||||||
* @param itemCode
|
|
||||||
* @param stockCode
|
* @param stockCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String scanMo(String stockCode,String mo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原材料入库
|
||||||
|
*
|
||||||
|
* @param stockCode
|
||||||
|
* @param boxNumbers
|
||||||
* @param pointCode
|
* @param pointCode
|
||||||
*/
|
*/
|
||||||
void bindContainer(String itemCode,String stockCode,String pointCode);
|
void materialIn(String stockCode,Set boxNumbers,String pointCode);
|
||||||
|
|
||||||
Map<String,Stock> findByCodes(Set stockCodes);
|
Map<String,Stock> findByCodes(Set stockCodes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.basicdata.service.ItemService;
|
import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.businessdata.domain.*;
|
import com.youchain.businessdata.domain.*;
|
||||||
|
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||||
import com.youchain.businessdata.service.*;
|
import com.youchain.businessdata.service.*;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -46,7 +47,6 @@ import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author liuxue
|
* @author liuxue
|
||||||
|
|
@ -60,6 +60,7 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
public class StockServiceImpl implements StockService {
|
public class StockServiceImpl implements StockService {
|
||||||
|
|
||||||
private final StockRepository stockRepository;
|
private final StockRepository stockRepository;
|
||||||
|
private final AsnDetailRepository asnDetailRepository;
|
||||||
private final StockMapper stockMapper;
|
private final StockMapper stockMapper;
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
private final AgvTaskService agvTaskService;
|
private final AgvTaskService agvTaskService;
|
||||||
|
|
@ -70,6 +71,8 @@ public class StockServiceImpl implements StockService {
|
||||||
private final ItemKeyService itemKeyService;
|
private final ItemKeyService itemKeyService;
|
||||||
private final PointService pointService;
|
private final PointService pointService;
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
|
private final StockTypeToAreaMap stockTypeToAreaMap;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(StockQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(StockQueryCriteria criteria, Pageable pageable) {
|
||||||
|
|
@ -272,9 +275,8 @@ public class StockServiceImpl implements StockService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
public String scanMo(String stockCode, String mo) {
|
||||||
public void bindContainer(String QRCode, String stockCode, String pointCode) {
|
Map<String, String> map = parseString(mo);//解析二维码
|
||||||
Map<String, String> map = parseString(QRCode);//解析二维码
|
|
||||||
String propC1 = map.get("Lot");//批次号
|
String propC1 = map.get("Lot");//批次号
|
||||||
String boxNumber = map.get("S");//箱号
|
String boxNumber = map.get("S");//箱号
|
||||||
String propC3 = map.get("P");//工厂
|
String propC3 = map.get("P");//工厂
|
||||||
|
|
@ -285,28 +287,35 @@ public class StockServiceImpl implements StockService {
|
||||||
}
|
}
|
||||||
Item item = validateItem(getStringCode(map.get("M")));//验证物料
|
Item item = validateItem(getStringCode(map.get("M")));//验证物料
|
||||||
Stock stock = validateStock(stockCode);//验证容器
|
Stock stock = validateStock(stockCode);//验证容器
|
||||||
validateStockStatus(stock);//验证容器状态
|
validateStockStatus(stock, item);//验证容器物料是否一致
|
||||||
validateStockAndItem(stock, item);//验证容器类型和物料类型是否匹配
|
validateStockAndItem(stock, item);//验证容器类型和物料类型是否匹配
|
||||||
|
//容器类型:小件入库则入小件缓存区、大件入库则入大件缓存区
|
||||||
|
if (!stockTypeToAreaMap.getStockTypeToAreaMap().containsKey(stock.getStockType())) {
|
||||||
|
throw new RuntimeException(stock.getStockType() + "容器类型错误!");
|
||||||
|
}
|
||||||
|
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, null, propC1, boxNumber, propC3, Timestamp.valueOf(DateUtil.formatDateTime(DateUtil.parse(propD1))), orderQty, mo);
|
||||||
|
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getOrderNumber());//生成Itemkey
|
||||||
|
createTask(item, itemKey, asnDetail, stock, null, null, null);//生成Task任务
|
||||||
|
return boxNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void materialIn(String stockCode, Set boxNumbers, String pointCode) {
|
||||||
|
Stock stock = validateStock(stockCode);//验证容器
|
||||||
|
|
||||||
Point srcPoint = validateSrcPoint(pointCode);//验证点位
|
Point srcPoint = validateSrcPoint(pointCode);//验证点位
|
||||||
String srcPointAreaName = srcPoint.getArea().getCode();
|
String srcPointAreaName = srcPoint.getArea().getCode();
|
||||||
if (!isValidMCArea(srcPointAreaName)) {
|
if (!isValidMCArea(srcPointAreaName)) {
|
||||||
throw new RuntimeException(srcPoint.getCode() + "为" + srcPointAreaName + "不能入库!");
|
throw new RuntimeException(srcPoint.getCode() + "为" + srcPointAreaName + "不能入库!");
|
||||||
}
|
}
|
||||||
//容器类型:小件入库则入小件缓存区、大件入库则入大件缓存区
|
|
||||||
Map<String, String> stockTypeToAreaMap = new HashMap<>();
|
|
||||||
stockTypeToAreaMap.put("小件入库", AreaNameDic.XJQ);
|
|
||||||
stockTypeToAreaMap.put("大件入库", AreaNameDic.DJQ);
|
|
||||||
if (!stockTypeToAreaMap.containsKey(stock.getStockType())) {
|
|
||||||
throw new RuntimeException(stock.getStockType() + "容器类型错误!");
|
|
||||||
}
|
|
||||||
String areaCode = stockTypeToAreaMap.get(stock.getStockType());
|
|
||||||
|
|
||||||
Point endPoint = validateEndPoint(item, areaCode);//验证目标点位
|
String areaCode = stockTypeToAreaMap.getValueByKey(stock.getStockType());
|
||||||
|
Point endPoint = validateEndPoint(null, areaCode);//验证目标点位
|
||||||
|
|
||||||
checkPointStatus(srcPoint);//验证源点位状态
|
checkPointStatus(srcPoint);//验证源点位状态
|
||||||
AgvTask agvTask = createAndSendAgvTask(BizStatus.ASN, stock, srcPoint, endPoint);//生成AGV任务
|
AgvTask agvTask = createAndSendAgvTask(BizStatus.ASN, stock, srcPoint, endPoint);//生成AGV任务
|
||||||
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, srcPoint, propC1, boxNumber, propC3, Timestamp.valueOf(DateUtil.formatDateTime(DateUtil.parse(propD1))), orderQty, QRCode);
|
|
||||||
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getOrderNumber());//生成Itemkey
|
|
||||||
createTask(item, itemKey, asnDetail, stock, srcPoint, endPoint, agvTask);//生成Task任务
|
|
||||||
updateStockAndPoints(stock, srcPoint, endPoint);//更新容器和点位状态
|
updateStockAndPoints(stock, srcPoint, endPoint);//更新容器和点位状态
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -375,9 +384,15 @@ public class StockServiceImpl implements StockService {
|
||||||
return stock;
|
return stock;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateStockStatus(Stock stock) {
|
private void validateStockStatus(Stock stock, Item item) {
|
||||||
if (BaseStatus.USED.equals(stock.getStatus())) {
|
if (BaseStatus.USED.equals(stock.getStatus())) {
|
||||||
throw new RuntimeException(stock.getCode() + "容器已占用,请更换容器!");
|
//查看容器放的是否是同一种物料
|
||||||
|
List<AsnDetail> asnDetails = asnDetailRepository.findByStockCode(stock.getCode());
|
||||||
|
for (AsnDetail asnDetail : asnDetails) {
|
||||||
|
if (!asnDetail.getItem().getCode().equals(item.getCode())) {
|
||||||
|
throw new RuntimeException(stock.getCode() + "托盘已装入" + asnDetail.getItem().getCode() + "物料,扫描物料" + item.getCode() + "不一致!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -444,7 +459,7 @@ public class StockServiceImpl implements StockService {
|
||||||
if (!isValidMCJLArea(endPointAreaCode)) {
|
if (!isValidMCJLArea(endPointAreaCode)) {
|
||||||
throw new RuntimeException(endPoint.getCode() + "点位不能叫满车!");
|
throw new RuntimeException(endPoint.getCode() + "点位不能叫满车!");
|
||||||
}
|
}
|
||||||
String areaCode = AreaNameDic.DJQ+","+AreaNameDic.XJQ;
|
String areaCode = AreaNameDic.DJQ + "," + AreaNameDic.XJQ;
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(item.getId(), areaCode);
|
List<Inventory> inventoryList = inventoryService.queryInventory(item.getId(), areaCode);
|
||||||
if (inventoryList.isEmpty()) {
|
if (inventoryList.isEmpty()) {
|
||||||
throw new RuntimeException(itemCode + "物料无库存,呼叫失败!");
|
throw new RuntimeException(itemCode + "物料无库存,呼叫失败!");
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,9 @@ public interface AgvTaskRepository extends JpaRepository<AgvTask, Integer>, JpaS
|
||||||
@Query(value = "select * from data_agv_task where line_slot_code=?1 and type='PICK' and `status`='OPEN' and line_slot_code is not null ORDER BY create_time ", nativeQuery = true)
|
@Query(value = "select * from data_agv_task where line_slot_code=?1 and type='PICK' and `status`='OPEN' and line_slot_code is not null ORDER BY create_time ", nativeQuery = true)
|
||||||
List<AgvTask> queryLineAgvTask(String line_slot_code);
|
List<AgvTask> queryLineAgvTask(String line_slot_code);
|
||||||
|
|
||||||
/** 去重*/
|
/**
|
||||||
@Query(value = "SELECT agv FROM AgvTask agv where agv.startSlotCode=?1 and agv.endSlotCode=?2 and agv.status in ('OPEN','ATCALL','ATWORK')", nativeQuery = false)
|
* 去重
|
||||||
|
*/
|
||||||
|
@Query(value = " FROM AgvTask agv where agv.startSlotCode=?1 and agv.endSlotCode=?2 and agv.status in ('OPEN','ATCALL','ATWORK')")
|
||||||
List<AgvTask> findRepeat(String startSlotCode, String endSlotCode);
|
List<AgvTask> findRepeat(String startSlotCode, String endSlotCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ package com.youchain.businessdata.repository;
|
||||||
import com.youchain.businessdata.domain.AsnDetail;
|
import com.youchain.businessdata.domain.AsnDetail;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -25,4 +28,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
* @date 2023-08-14
|
* @date 2023-08-14
|
||||||
**/
|
**/
|
||||||
public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> {
|
public interface AsnDetailRepository extends JpaRepository<AsnDetail, Long>, JpaSpecificationExecutor<AsnDetail> {
|
||||||
|
@Query(value = " FROM AsnDetail ad WHERE ad.stock.code =?1 and ad.status not in('RECEIVED') ")
|
||||||
|
List<AsnDetail> findByStockCode(String stockCode);
|
||||||
}
|
}
|
||||||
|
|
@ -58,6 +58,14 @@ public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, J
|
||||||
@Query(value = "SELECT p FROM PickDetail p WHERE p.pick.id=?1 and p.item.id=?2", nativeQuery = false)
|
@Query(value = "SELECT p FROM PickDetail p WHERE p.pick.id=?1 and p.item.id=?2", nativeQuery = false)
|
||||||
List<PickDetail> findRepeat(Long pickId, Long itemId);
|
List<PickDetail> findRepeat(Long pickId, Long itemId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询出库单的所有出库明细
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Query(value = " FROM PickDetail p WHERE p.pick.id=?1 ")
|
||||||
|
List<PickDetail> findByAllPickDetail(Long pickId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询已分配的出库明细
|
* 查询已分配的出库明细
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,14 @@ import java.util.Map;
|
||||||
* @date 2023-08-16
|
* @date 2023-08-16
|
||||||
**/
|
**/
|
||||||
public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificationExecutor<Task> {
|
public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificationExecutor<Task> {
|
||||||
@Query(value = "SELECT t FROM Task t WHERE t.pickDetail.pick.id=?1 and t.taskType='PICK'", nativeQuery = false)
|
/**
|
||||||
List<Task> findByPick(Long pickId);
|
* 根据pickId查询未拣货的任务
|
||||||
|
* @param pickId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Query(value = " FROM Task t WHERE t.pickDetail.pick.id=?1 and t.taskType='PICK' and t.planQty>t.moveQty ")
|
||||||
|
List<Task> findByNotPickTask(Long pickId);
|
||||||
|
|
||||||
|
@Query(value = " FROM Task t WHERE t.taskType='PICK' and t.taskStatus not in ('FINISH') and t.srcPoint.id=?1 ")
|
||||||
|
Boolean existsByTask(Long srcPointId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,53 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Zheng Jie
|
* Copyright 2019-2020 Zheng Jie
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service;
|
package com.youchain.businessdata.service;
|
||||||
|
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author baobinglin
|
||||||
* @description 服务接口
|
* @website https://eladmin.vip
|
||||||
* @author baobinglin
|
* @description 服务接口
|
||||||
* @date 2023-08-18
|
* @date 2023-08-18
|
||||||
**/
|
**/
|
||||||
public interface AgvTaskService {
|
public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
|
*
|
||||||
* @param criteria 条件
|
* @param criteria 条件
|
||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return Map<String,Object>
|
* @return Map<String, Object>
|
||||||
*/
|
*/
|
||||||
Map<String,Object> queryAll(AgvTaskQueryCriteria criteria, Pageable pageable);
|
Map<String, Object> queryAll(AgvTaskQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
* @param criteria 条件参数
|
* @param criteria 条件参数
|
||||||
* @return List<AgvTaskDto>
|
* @return List<AgvTaskDto>
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,6 +55,7 @@ public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return AgvTaskDto
|
* @return AgvTaskDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -58,6 +63,7 @@ public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
* @return AgvTaskDto
|
* @return AgvTaskDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -65,18 +71,21 @@ public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void update(AgvTask resources);
|
void update(AgvTask resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
|
*
|
||||||
* @param ids /
|
* @param ids /
|
||||||
*/
|
*/
|
||||||
void deleteAll(Integer[] ids);
|
void deleteAll(Integer[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出数据
|
* 导出数据
|
||||||
|
*
|
||||||
* @param all 待导出的数据
|
* @param all 待导出的数据
|
||||||
* @param response /
|
* @param response /
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
|
|
@ -85,6 +94,7 @@ public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送货架搬运接口任务
|
* 发送货架搬运接口任务
|
||||||
|
*
|
||||||
* @param agvTasks
|
* @param agvTasks
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -92,28 +102,24 @@ public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送料箱搬运接口任务
|
* 发送料箱搬运接口任务
|
||||||
|
*
|
||||||
* @param agvTasks
|
* @param agvTasks
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String sendAgvTaskLXImpl(List<AgvTask> agvTasks);
|
String sendAgvTaskLXImpl(List<AgvTask> agvTasks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送滚筒搬运接口任务
|
* 发送滚筒搬运接口任务
|
||||||
|
*
|
||||||
* @param agvTasks1-满箱任务
|
* @param agvTasks1-满箱任务
|
||||||
* @param agvTasks1-控销任务
|
* @param agvTasks1-控销任务
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String sendAgvTaskGTImpl(List<AgvTask> agvTasks1,List<AgvTask> agvTasks2);
|
String sendAgvTaskGTImpl(List<AgvTask> agvTasks1, List<AgvTask> agvTasks2);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询容器状态
|
|
||||||
* @param containerCode-容器编号
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String containerQuery(String containerCode);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询输送线上料箱总数
|
* 查询输送线上料箱总数
|
||||||
|
*
|
||||||
* @param taskCode-输送线编号
|
* @param taskCode-输送线编号
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -123,15 +129,21 @@ public interface AgvTaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务回报更新状态
|
* 任务回报更新状态
|
||||||
|
*
|
||||||
* @param agvTask
|
* @param agvTask
|
||||||
* @param status
|
* @param status
|
||||||
* @param containerCode
|
* @param containerCode
|
||||||
*/
|
*/
|
||||||
void agvTaskCallback(AgvTask agvTask,String status,String containerCode);
|
void agvTaskCallback(AgvTask agvTask, String status, String containerCode);
|
||||||
|
|
||||||
boolean findByendSlotCode(String endSlotCode,String type,String jobType);
|
boolean findByendSlotCode(String endSlotCode, String type, String jobType);
|
||||||
|
|
||||||
List<AgvTask> findById(List<Integer> ids);
|
List<AgvTask> findById(List<Integer> ids);
|
||||||
|
|
||||||
AgvTask addAgvTask(String pick, String srcStockCode, String srcPointCode, String dstPointCode, String open, String s);
|
/**
|
||||||
|
* 根据出库单备料
|
||||||
|
*
|
||||||
|
* @param pick->出库单
|
||||||
|
*/
|
||||||
|
void materialPick(Pick pick);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,6 @@ public interface AsnDetailService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean existsByboxNumber(String boxNumber);
|
boolean existsByboxNumber(String boxNumber);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public interface PickDetailService {
|
||||||
void createPickDetail(Pick pick, List<GdDetail> gdDetails);
|
void createPickDetail(Pick pick, List<GdDetail> gdDetails);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分配出库单
|
* 出库单分配
|
||||||
*
|
*
|
||||||
* @param pick->出库单
|
* @param pick->出库单
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.youchain.basicdata.repository.StockRepository;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.StockService;
|
import com.youchain.basicdata.service.StockService;
|
||||||
import com.youchain.businessdata.domain.*;
|
import com.youchain.businessdata.domain.*;
|
||||||
|
import com.youchain.businessdata.repository.PickRepository;
|
||||||
import com.youchain.businessdata.repository.TaskRepository;
|
import com.youchain.businessdata.repository.TaskRepository;
|
||||||
import com.youchain.businessdata.service.*;
|
import com.youchain.businessdata.service.*;
|
||||||
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||||
|
|
@ -66,6 +67,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
private final InventoryLogService inventoryLogService;
|
private final InventoryLogService inventoryLogService;
|
||||||
private final PointService pointService;
|
private final PointService pointService;
|
||||||
private final AsnDetailService asnDetailService;
|
private final AsnDetailService asnDetailService;
|
||||||
|
private final PickRepository pickRepository;
|
||||||
private final StockRepository stockRepository;
|
private final StockRepository stockRepository;
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
|
|
||||||
|
|
@ -157,7 +159,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
|
|
||||||
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
|
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
|
||||||
String viewBoardType = "";
|
String viewBoardType = "";
|
||||||
Point point = pointService.findByCode(agvTasks.getStartSlotCode(), null, null, null, null,null);
|
Point point = pointService.findByCode(agvTasks.getStartSlotCode(), null, null, null, null, null);
|
||||||
//到达上视自动识别
|
//到达上视自动识别
|
||||||
if (AreaNameDic.CPRKQ.equals(point.getArea().getCode())) {
|
if (AreaNameDic.CPRKQ.equals(point.getArea().getCode())) {
|
||||||
viewBoardType = "IDENTIFY_REQUIRE";
|
viewBoardType = "IDENTIFY_REQUIRE";
|
||||||
|
|
@ -217,8 +219,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
String code = "0";
|
String code = "0";
|
||||||
String message = "";
|
String message = "";
|
||||||
if (!"0".equals(code)) {
|
if (!"0".equals(code)) {
|
||||||
throw new RuntimeException("AGV返回消息:" + message);
|
agvTasks.setJobMessage(resultJson);
|
||||||
}
|
agvTasks.setReqMessage(jsonObject.toString());
|
||||||
|
update(agvTasks);
|
||||||
|
} else {
|
||||||
agvTasks.setJobForce(agvTasks.getId().toString());//任务组
|
agvTasks.setJobForce(agvTasks.getId().toString());//任务组
|
||||||
agvTasks.setJobForceAsc((1));
|
agvTasks.setJobForceAsc((1));
|
||||||
agvTasks.setStatus(BizStatus.ATCALL);
|
agvTasks.setStatus(BizStatus.ATCALL);
|
||||||
|
|
@ -226,6 +230,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
agvTasks.setReqMessage(jsonObject.toString());
|
agvTasks.setReqMessage(jsonObject.toString());
|
||||||
agvTasks.setStartTime(new Timestamp(new Date().getTime()));
|
agvTasks.setStartTime(new Timestamp(new Date().getTime()));
|
||||||
update(agvTasks);
|
update(agvTasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return resultJson;
|
return resultJson;
|
||||||
}
|
}
|
||||||
|
|
@ -383,17 +389,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
return resultJson;
|
return resultJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String containerQuery(String containerCode) {
|
|
||||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
|
||||||
jsonObject.put("nodeCode", "");//点位编码
|
|
||||||
jsonObject.put("containerModelCode", "");//容器模型编码
|
|
||||||
jsonObject.put("containerCode", containerCode);//容器编号
|
|
||||||
jsonObject.put("areaCode", "");//区域编码
|
|
||||||
jsonObject.put("emptyFullStatus", 2);//容器的空满状态 空 0 满 1 全部 2
|
|
||||||
return jsonObject.toJSONString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int QueryCount(String taskCode) {
|
public int QueryCount(String taskCode) {
|
||||||
|
|
||||||
|
|
@ -430,7 +425,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
|
|
||||||
private void handleUpContainer(AgvTask agvTask, String containerCode) {
|
private void handleUpContainer(AgvTask agvTask, String containerCode) {
|
||||||
//顶升释放起点位置状态及容器绑定的起点位置
|
//顶升释放起点位置状态及容器绑定的起点位置
|
||||||
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
|
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null, null);
|
||||||
startPoint.setStatus(BaseStatus.FREE);
|
startPoint.setStatus(BaseStatus.FREE);
|
||||||
pointService.update(startPoint);
|
pointService.update(startPoint);
|
||||||
|
|
||||||
|
|
@ -440,10 +435,12 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
this.update(agvTask);
|
this.update(agvTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 搬运任务完成*/
|
/**
|
||||||
|
* 搬运任务完成
|
||||||
|
*/
|
||||||
private void handleComContainer(AgvTask agvTask, String containerCode) {
|
private void handleComContainer(AgvTask agvTask, String containerCode) {
|
||||||
//任务完成;根据AGV任务的目标点位走对应流程
|
//任务完成;根据AGV任务的目标点位走对应流程
|
||||||
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null,null);
|
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null, null);
|
||||||
String endAreaName = endPoint.getArea().getCode();
|
String endAreaName = endPoint.getArea().getCode();
|
||||||
Stock stock = stockRepository.findByCode(containerCode, null);
|
Stock stock = stockRepository.findByCode(containerCode, null);
|
||||||
if (stock == null) {
|
if (stock == null) {
|
||||||
|
|
@ -451,22 +448,18 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
}
|
}
|
||||||
List<Task> taskList = taskService.getAgvTaskList(agvTask.getId());
|
List<Task> taskList = taskService.getAgvTaskList(agvTask.getId());
|
||||||
switch (endAreaName) {
|
switch (endAreaName) {
|
||||||
|
case AreaNameDic.XJQ:
|
||||||
|
case AreaNameDic.DJQ:
|
||||||
|
handleXJDJ(taskList, stock);//入库
|
||||||
|
break;
|
||||||
|
case AreaNameDic.FBQ:
|
||||||
|
handleFBQ(taskList, endPoint);//备料完成
|
||||||
case AreaNameDic.JLQ:
|
case AreaNameDic.JLQ:
|
||||||
// handleJL(taskList, endPoint, stock);//满车出库
|
// handleJL(taskList, endPoint, stock);//满车出库
|
||||||
break;
|
break;
|
||||||
case AreaNameDic.XJQ:
|
|
||||||
case AreaNameDic.DJQ:
|
|
||||||
handleFBFC(taskList, stock);//满车入库
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* 备料任务完成*/
|
|
||||||
if (agvTask.getType().equals(BizStatus.PICK)){
|
|
||||||
/* 更新Task任务状态*/
|
|
||||||
for(Task task:taskList){
|
|
||||||
task.setTaskStatus(BizStatus.PICKUP);
|
|
||||||
taskRepository.save(task);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
agvTask.setStatus(BizStatus.FINISH);
|
agvTask.setStatus(BizStatus.FINISH);
|
||||||
agvTask.setStockCode(containerCode);
|
agvTask.setStockCode(containerCode);
|
||||||
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
agvTask.setEndTime(new Timestamp(new Date().getTime()));
|
||||||
|
|
@ -554,7 +547,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
* @param taskList
|
* @param taskList
|
||||||
* @param stock
|
* @param stock
|
||||||
*/
|
*/
|
||||||
private void handleFBFC(List<Task> taskList, Stock stock) {
|
private void handleXJDJ(List<Task> taskList, Stock stock) {
|
||||||
//容器回存储区,新增库存、更新点位状态
|
//容器回存储区,新增库存、更新点位状态
|
||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
AsnDetail ad = task.getAsnDetail();
|
AsnDetail ad = task.getAsnDetail();
|
||||||
|
|
@ -573,6 +566,45 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备料
|
||||||
|
*
|
||||||
|
* @param taskList
|
||||||
|
*/
|
||||||
|
private void handleFBQ(List<Task> taskList, Point endPoint) {
|
||||||
|
/* 更新Task任务状态*/
|
||||||
|
for (Task task : taskList) {
|
||||||
|
/*Inventory inventory = task.getInventory();//原库存
|
||||||
|
if (inventory != null) {
|
||||||
|
double moveQty = task.getPlanQty();//要移位的数量
|
||||||
|
//原库存减去移位数量
|
||||||
|
inventory.setQueuedQty(inventory.getQueuedQty() - moveQty);
|
||||||
|
inventoryService.update(inventory);
|
||||||
|
|
||||||
|
//根据移位数量生成翻包区的库存
|
||||||
|
Inventory fbqInventory = new Inventory();
|
||||||
|
fbqInventory.setItemKey(inventory.getItemKey());
|
||||||
|
fbqInventory.setPoint(endPoint);
|
||||||
|
fbqInventory.setPointCode(endPoint.getCode());
|
||||||
|
fbqInventory.setStock(inventory.getStock());
|
||||||
|
fbqInventory.setStockCode(inventory.getStock().getCode());
|
||||||
|
fbqInventory.setQuantity(moveQty);
|
||||||
|
fbqInventory.setQueuedQty(0d);
|
||||||
|
fbqInventory.setDept(inventory.getDept());
|
||||||
|
inventoryService.create(fbqInventory);
|
||||||
|
|
||||||
|
if (inventory.getQuantity() <= 0) {
|
||||||
|
Long[] invIds = {inventory.getId()};
|
||||||
|
inventoryService.deleteAll(invIds);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//生成翻包区的库存
|
||||||
|
task.setTaskStatus(BizStatus.FINISH);
|
||||||
|
taskRepository.save(task);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 满车出库
|
* 满车出库
|
||||||
*
|
*
|
||||||
|
|
@ -636,7 +668,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
*/
|
*/
|
||||||
private void handleCanceledTask(AgvTask agvTask, String containerCode) {
|
private void handleCanceledTask(AgvTask agvTask, String containerCode) {
|
||||||
//任务取消完成
|
//任务取消完成
|
||||||
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null,null);
|
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null, null);
|
||||||
String endAreaName = endPoint.getArea().getCode();
|
String endAreaName = endPoint.getArea().getCode();
|
||||||
Stock stock = stockRepository.findByCode(containerCode, null);
|
Stock stock = stockRepository.findByCode(containerCode, null);
|
||||||
if (stock == null) {
|
if (stock == null) {
|
||||||
|
|
@ -660,7 +692,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
|
|
||||||
private void handleFKCancel(AgvTask agvTask, Point endPoint, Stock stock) {
|
private void handleFKCancel(AgvTask agvTask, Point endPoint, Stock stock) {
|
||||||
//回空车取消
|
//回空车取消
|
||||||
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
|
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null, null);
|
||||||
//起点点位释放
|
//起点点位释放
|
||||||
releasePoint(srcPoint);
|
releasePoint(srcPoint);
|
||||||
stock.setPoint(null);
|
stock.setPoint(null);
|
||||||
|
|
@ -705,7 +737,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
log.info(agvTask.getId() + "任务" + containerCode + "容器未移动!");
|
log.info(agvTask.getId() + "任务" + containerCode + "容器未移动!");
|
||||||
Stock stock = stockRepository.findByCode(containerCode, null);
|
Stock stock = stockRepository.findByCode(containerCode, null);
|
||||||
if (stock != null) {
|
if (stock != null) {
|
||||||
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
|
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null, null);
|
||||||
stock.setPoint(srcPoint);
|
stock.setPoint(srcPoint);
|
||||||
stockRepository.save(stock);
|
stockRepository.save(stock);
|
||||||
}
|
}
|
||||||
|
|
@ -784,7 +816,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
taskService.update(task);
|
taskService.update(task);
|
||||||
}
|
}
|
||||||
//起点点位释放
|
//起点点位释放
|
||||||
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
|
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null, null);
|
||||||
releasePoint(srcPoint);
|
releasePoint(srcPoint);
|
||||||
stock.setPoint(null);
|
stock.setPoint(null);
|
||||||
stock.setStatus(BaseStatus.FREE);
|
stock.setStatus(BaseStatus.FREE);
|
||||||
|
|
@ -828,17 +860,26 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AgvTask addAgvTask(String pick, String srcStockCode, String srcPointCode, String dstPointCode, String open, String s) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
AgvTask agvTask=new AgvTask();
|
public void materialPick(Pick pick) {
|
||||||
List<AgvTask> agvTaskList=agvTaskRepository.findRepeat(srcPointCode,dstPointCode);
|
AgvTask agvTask = null;
|
||||||
if (agvTaskList.size()>0){
|
List<Task> taskList = taskRepository.findByNotPickTask(pick.getId());
|
||||||
agvTask=agvTaskList.get(0);
|
for (Task task : taskList) {
|
||||||
}else {
|
/*生成搬运任务*/
|
||||||
agvTask =agvTaskRepository.save(
|
List<AgvTask> agvTaskList = agvTaskRepository.findRepeat(task.getSrcPointCode(), task.getDstPointCode());
|
||||||
new AgvTask(BizStatus.PICK, srcStockCode, srcPointCode, dstPointCode, BizStatus.OPEN, s)
|
if (agvTaskList.size() > 0) {
|
||||||
);
|
agvTask = agvTaskList.get(0);
|
||||||
|
} else {
|
||||||
|
agvTask = new AgvTask(BizStatus.PICK, task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode(), BizStatus.OPEN, "");
|
||||||
|
agvTaskRepository.save(agvTask);
|
||||||
}
|
}
|
||||||
return agvTask;
|
task.setAgvTask(agvTask);
|
||||||
|
taskRepository.save(task);
|
||||||
|
sendAgvTaskImpl(agvTask);
|
||||||
|
}
|
||||||
|
/*更新出库单状态*/
|
||||||
|
pick.setStatus(BizStatus.PICKUP);
|
||||||
|
pickRepository.save(pick);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.dto.ItemDto;
|
import com.youchain.basicdata.service.dto.ItemDto;
|
||||||
import com.youchain.businessdata.domain.*;
|
import com.youchain.businessdata.domain.*;
|
||||||
import com.youchain.businessdata.repository.*;
|
import com.youchain.businessdata.repository.*;
|
||||||
|
import com.youchain.businessdata.service.AgvTaskService;
|
||||||
import com.youchain.businessdata.service.InventoryService;
|
import com.youchain.businessdata.service.InventoryService;
|
||||||
import com.youchain.businessdata.service.TaskService;
|
import com.youchain.businessdata.service.TaskService;
|
||||||
import com.youchain.businessdata.service.dto.InventoryDto;
|
import com.youchain.businessdata.service.dto.InventoryDto;
|
||||||
|
|
@ -58,15 +59,15 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
public class PickDetailServiceImpl implements PickDetailService {
|
public class PickDetailServiceImpl implements PickDetailService {
|
||||||
private final PickDetailRepository pickDetailRepository;
|
private final PickDetailRepository pickDetailRepository;
|
||||||
private final PickRepository pickRepository;
|
private final PickRepository pickRepository;
|
||||||
private final GdDetailRepository gdDetailRepository;
|
|
||||||
private final PickDetailMapper pickDetailMapper;
|
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
|
private final TaskRepository taskRepository;
|
||||||
private final AgvTaskRepository agvTaskRepository;
|
private final AgvTaskRepository agvTaskRepository;
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
private final ItemService itemService;
|
private final ItemService itemService;
|
||||||
private final PointService pointService;
|
private final PointService pointService;
|
||||||
private final LogService logService;
|
private final LogService logService;
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
|
private final PickDetailMapper pickDetailMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(PickDetailQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(PickDetailQueryCriteria criteria, Pageable pageable) {
|
||||||
|
|
@ -153,7 +154,12 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
double allocateQty = 0;
|
double allocateQty = 0;
|
||||||
double unQty = quantity;//未分配数量
|
double unQty = quantity;//未分配数量
|
||||||
for (Inventory inv : Inventorys) {
|
for (Inventory inv : Inventorys) {
|
||||||
|
|
||||||
Point startPoint = inv.getPoint();//起始点位
|
Point startPoint = inv.getPoint();//起始点位
|
||||||
|
//判断任务起始点位是否有任务
|
||||||
|
if (taskRepository.existsByTask(startPoint.getId())) {
|
||||||
|
return pick.getCode() + "出库单;" + item.getCode() + "起始点位有任务,请先完成任务!";
|
||||||
|
}
|
||||||
if (unQty == 0) {
|
if (unQty == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +177,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
|
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
|
||||||
pickDetailRepository.save(pd);
|
pickDetailRepository.save(pd);
|
||||||
|
|
||||||
//生成Task
|
|
||||||
Task task = new Task();
|
Task task = new Task();
|
||||||
task.setTaskType(BizStatus.PICK);
|
task.setTaskType(BizStatus.PICK);
|
||||||
task.setItem(item);
|
task.setItem(item);
|
||||||
|
|
@ -290,15 +296,11 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
public List<Object[]> queryOut(String type, String date) {
|
public List<Object[]> queryOut(String type, String date) {
|
||||||
String hql = "";
|
String hql = "";
|
||||||
if (type.equals("Day")) {
|
if (type.equals("Day")) {
|
||||||
hql = "select sum(d.orderQty),sum(d.pickedQty) from PickDetail d " +
|
hql = "select sum(d.orderQty),sum(d.pickedQty) from PickDetail d " + " where DATE_FORMAT(d.createTime,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')";
|
||||||
" where DATE_FORMAT(d.createTime,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')";
|
|
||||||
} else if (type.equals("Month")) {
|
} else if (type.equals("Month")) {
|
||||||
hql = "select sum(d.orderQty),sum(d.pickedQty) from PickDetail d " +
|
hql = "select sum(d.orderQty),sum(d.pickedQty) from PickDetail d " + " where DATE_FORMAT(d.createTime,'%Y-%m')=DATE_FORMAT(now(),'%Y-%m')";
|
||||||
" where DATE_FORMAT(d.createTime,'%Y-%m')=DATE_FORMAT(now(),'%Y-%m')";
|
|
||||||
} else if (type.equals("InOutDay")) {
|
} else if (type.equals("InOutDay")) {
|
||||||
hql = "select DATE_FORMAT(d.createTime,'%Y-%m-%d'),sum(d.pickedQty) from PickDetail d " +
|
hql = "select DATE_FORMAT(d.createTime,'%Y-%m-%d'),sum(d.pickedQty) from PickDetail d " + " where DATE_FORMAT(d.createTime,'%Y-%m-%d')>='" + date + "' " + " group by DATE_FORMAT(d.createTime,'%Y-%m-%d')";
|
||||||
" where DATE_FORMAT(d.createTime,'%Y-%m-%d')>='" + date + "' " +
|
|
||||||
" group by DATE_FORMAT(d.createTime,'%Y-%m-%d')";
|
|
||||||
}
|
}
|
||||||
Query query = entityMapper.createQuery(hql);
|
Query query = entityMapper.createQuery(hql);
|
||||||
List<Object[]> ts = query.getResultList();
|
List<Object[]> ts = query.getResultList();
|
||||||
|
|
@ -361,34 +363,48 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
|
|
||||||
List<String> MsgList = new ArrayList<>();//存放提示信息
|
List<String> MsgList = new ArrayList<>();//存放提示信息
|
||||||
//查询出待分配的pickDetail
|
//查询出待分配的pickDetail
|
||||||
String areaCode=AreaNameDic.XJQ+","+AreaNameDic.DJQ;
|
String areaCode = AreaNameDic.XJQ + "," + AreaNameDic.DJQ;
|
||||||
List<PickDetail> pickDetails = pickDetailRepository.findByPickDetailNoAllocate(pick.getId());
|
List<PickDetail> pickDetails = pickDetailRepository.findByPickDetailNoAllocate(pick.getId());
|
||||||
for (PickDetail pickDetail : pickDetails) {
|
for (PickDetail pickDetail : pickDetails) {
|
||||||
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), areaCode, endPoint));
|
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), areaCode, endPoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 更新出库单状态并写入目标点位*/
|
/* 更新出库单状态并写入目标点位*/
|
||||||
refreshPickStatus(pick, endPoint, pickDetails);
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshPickStatus(Pick pick, Point endPoint, List<PickDetail> openPickDetails) {
|
/**
|
||||||
List<PickDetail> allocatePickDetailList = pickDetailRepository.findByAllocate(pick.getId());
|
* 刷新出库单状态
|
||||||
if (allocatePickDetailList.size() == openPickDetails.size()) {
|
*
|
||||||
pick.setStatus(BizStatus.ALLOCATE);
|
* @param pick
|
||||||
pick.setPoint(endPoint);
|
* @param endPoint
|
||||||
pickRepository.save(pick);
|
*/
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
private void refreshPickStatus(Pick pick, Point endPoint) {
|
||||||
pointService.update(endPoint);
|
//查询出库单的所有明细
|
||||||
} else if (allocatePickDetailList.size() > 0) {
|
List<PickDetail> allocatePickDetailList = pickDetailRepository.findByAllPickDetail(pick.getId());
|
||||||
pick.setStatus(BizStatus.ASSIGN);
|
//判断是否全部分配完
|
||||||
pick.setPoint(endPoint);
|
boolean allAllocated = allocatePickDetailList.stream().allMatch(detail -> detail.getOrderQty().equals(detail.getAllocatedQty()));
|
||||||
pickRepository.save(pick);
|
//判断是否有部分分配完
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
boolean assAllocated = allocatePickDetailList.stream().anyMatch(detail -> detail.getOrderQty().equals(detail.getAllocatedQty()));
|
||||||
pointService.update(endPoint);
|
// 当前状态
|
||||||
|
String status = pick.getStatus();
|
||||||
|
|
||||||
|
//更新状态且点位占用
|
||||||
|
if (allAllocated) {
|
||||||
|
status = BizStatus.ALLOCATE;
|
||||||
|
} else if (assAllocated) {
|
||||||
|
status = BizStatus.ASSIGN;
|
||||||
}
|
}
|
||||||
|
// 更新pick状态和点位状态
|
||||||
|
pick.setStatus(status);
|
||||||
|
pick.setPoint(endPoint);
|
||||||
|
pickRepository.save(pick);
|
||||||
|
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointService.update(endPoint);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,15 @@
|
||||||
package com.youchain.modules.quartz.task;
|
package com.youchain.modules.quartz.task;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
|
||||||
import com.youchain.businessdata.domain.Pick;
|
import com.youchain.businessdata.domain.Pick;
|
||||||
import com.youchain.businessdata.domain.PickDetail;
|
|
||||||
import com.youchain.businessdata.domain.Task;
|
|
||||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
|
||||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
|
||||||
import com.youchain.businessdata.repository.PickRepository;
|
import com.youchain.businessdata.repository.PickRepository;
|
||||||
import com.youchain.businessdata.repository.TaskRepository;
|
|
||||||
import com.youchain.businessdata.service.AgvTaskService;
|
import com.youchain.businessdata.service.AgvTaskService;
|
||||||
import com.youchain.businessdata.service.PickDetailService;
|
import com.youchain.businessdata.service.PickDetailService;
|
||||||
import com.youchain.exception.BadRequestException;
|
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 料箱出库任务下发
|
* 料箱出库任务下发
|
||||||
|
|
@ -29,62 +18,47 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@Service
|
@Service
|
||||||
public class pickTask {
|
public class pickTask {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public PickDetailService pickDetailService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public PickDetailRepository pickDetailRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PickRepository pickRepository;
|
public PickRepository pickRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public TaskRepository taskRepository;
|
public PickDetailService pickDetailService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public AgvTaskRepository agvTaskRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public AgvTaskService agvTaskService;
|
public AgvTaskService agvTaskService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时检测出库单,分配库存
|
* 定时检测打开和分配中的出库单,分配库存
|
||||||
*/
|
*/
|
||||||
public void allocatePick() {
|
public void allocatePick() {
|
||||||
List<String> statuses = Arrays.asList(BizStatus.OPEN, BizStatus.ASSIGN);
|
List<String> statuses = Arrays.asList(BizStatus.OPEN, BizStatus.ASSIGN);
|
||||||
List<Pick> pickList = pickRepository.findByPickStatus(statuses);
|
List<Pick> pickList = pickRepository.findByPickStatus(statuses);
|
||||||
if (pickList.isEmpty()) {
|
if (pickList.isEmpty()) {
|
||||||
throw new RuntimeException("无待分配的出库单!");
|
throw new RuntimeException("无待分配的出库单,分配失败!");
|
||||||
} else {
|
} else {
|
||||||
for (Pick pick : pickList) {
|
for (Pick pick : pickList) {
|
||||||
pickDetailService.allocatePick(pick);
|
pickDetailService.allocatePick(pick);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时检测出库单,生成《备料》搬运任务
|
* 定时检测已分配的出库单,生成《备料》搬运任务
|
||||||
*/
|
*/
|
||||||
public void pickAgvTask() {
|
public void pickAgvTask() {
|
||||||
/*查询分配完成的出库单*/
|
/*查询分配完成的出库单*/
|
||||||
List<Pick> pickList = null;//pickRepository.findByPickStatus(BizStatus.ALLOCATE);
|
List<String> statuses = Arrays.asList(BizStatus.ALLOCATE);
|
||||||
|
List<Pick> pickList = pickRepository.findByPickStatus(statuses);
|
||||||
|
if (pickList.isEmpty()) {
|
||||||
|
throw new RuntimeException("无已分配的出库单,下发任务失败!");
|
||||||
|
} else {
|
||||||
for (Pick pick : pickList) {
|
for (Pick pick : pickList) {
|
||||||
List<Task> taskList = taskRepository.findByPick(pick.getId());
|
agvTaskService.materialPick(pick);
|
||||||
for (Task task : taskList) {
|
|
||||||
/*生成搬运任务*/
|
|
||||||
AgvTask agvTask = agvTaskService.addAgvTask(BizStatus.PICK, task.getSrcStockCode(), task.getSrcPointCode(), task.getDstPointCode(), BizStatus.OPEN, "01");
|
|
||||||
/*更新Task任务*/
|
|
||||||
task.setTaskStatus(BizStatus.ATWORK);
|
|
||||||
task.setAgvTask(agvTask);
|
|
||||||
taskRepository.save(task);
|
|
||||||
}
|
}
|
||||||
/*更新出库单状态*/
|
|
||||||
pick.setStatus(BizStatus.PICKUP);
|
|
||||||
pickRepository.save(pick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public interface BizStatus {
|
||||||
*/
|
*/
|
||||||
public static String ALLOCATE = "ALLOCATE";
|
public static String ALLOCATE = "ALLOCATE";
|
||||||
/**
|
/**
|
||||||
* 出库状态-拣货
|
* 出库状态-拣货中
|
||||||
*/
|
*/
|
||||||
public static String PICKUP = "PICKUP";
|
public static String PICKUP = "PICKUP";
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.youchain.utils;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class StockTypeToAreaMap {
|
||||||
|
public static final Map<String, String> stockTypeToAreaMap;
|
||||||
|
|
||||||
|
static {
|
||||||
|
stockTypeToAreaMap = new HashMap<>();
|
||||||
|
// 初始化Map
|
||||||
|
stockTypeToAreaMap.put("小件入库", AreaNameDic.XJQ);
|
||||||
|
stockTypeToAreaMap.put("大件入库", AreaNameDic.DJQ);
|
||||||
|
// 更多的初始化操作...
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getStockTypeToAreaMap() {
|
||||||
|
return stockTypeToAreaMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValueByKey(String key) {
|
||||||
|
return stockTypeToAreaMap.get(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,9 +2,12 @@ package com.youchain;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
|
import com.youchain.businessdata.domain.AsnDetail;
|
||||||
import com.youchain.businessdata.domain.GdDetail;
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
|
import com.youchain.businessdata.domain.PickDetail;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -23,10 +26,36 @@ public class EladminSystemApplicationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Map<String, List<String>> concurrentMapMsg = new ConcurrentHashMap<>();
|
PickDetail pickDetail1 = new PickDetail();
|
||||||
List<String> list1 = Arrays.asList("001库存不足!","002库存不足!", "003分配成功");
|
pickDetail1.setId(1L);
|
||||||
concurrentMapMsg.put("GD202406261053", list1);
|
pickDetail1.setOrderQty(2d);
|
||||||
System.out.println(list1);
|
pickDetail1.setAllocatedQty(2d);
|
||||||
|
|
||||||
|
PickDetail pickDetail2 = new PickDetail();
|
||||||
|
pickDetail2.setId(2L);
|
||||||
|
pickDetail2.setOrderQty(2d);
|
||||||
|
pickDetail2.setAllocatedQty(2d);
|
||||||
|
|
||||||
|
PickDetail pickDetail3 = new PickDetail();
|
||||||
|
pickDetail3.setId(2L);
|
||||||
|
pickDetail3.setOrderQty(2d);
|
||||||
|
pickDetail3.setAllocatedQty(0d);
|
||||||
|
|
||||||
|
List<PickDetail> pickDetails = new ArrayList<>();
|
||||||
|
pickDetails.add(pickDetail1);
|
||||||
|
pickDetails.add(pickDetail2);
|
||||||
|
pickDetails.add(pickDetail3);
|
||||||
|
|
||||||
|
boolean allAllocated = pickDetails.stream()
|
||||||
|
.allMatch(detail -> detail.getOrderQty().equals(detail.getAllocatedQty()));
|
||||||
|
boolean anyAllocated = pickDetails.stream()
|
||||||
|
.anyMatch(detail -> detail.getOrderQty().equals(detail.getAllocatedQty()));
|
||||||
|
if (allAllocated){
|
||||||
|
System.out.println("全部已分配");
|
||||||
|
}else if(anyAllocated){
|
||||||
|
System.out.println("部分已分配");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int MAX_TASK_COUNT = 4;
|
private static final int MAX_TASK_COUNT = 4;
|
||||||
|
|
@ -34,7 +63,7 @@ public class EladminSystemApplicationTests {
|
||||||
private long lastTaskTime = System.currentTimeMillis();
|
private long lastTaskTime = System.currentTimeMillis();
|
||||||
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
||||||
|
|
||||||
void aa(){
|
void aa() {
|
||||||
List<Integer> list1 = Arrays.asList();
|
List<Integer> list1 = Arrays.asList();
|
||||||
List<Integer> list2 = Arrays.asList();
|
List<Integer> list2 = Arrays.asList();
|
||||||
|
|
||||||
|
|
@ -48,47 +77,47 @@ public class EladminSystemApplicationTests {
|
||||||
double ckdQty=Math.ceil(xTaoQty/taoQty);//生成出库单数量
|
double ckdQty=Math.ceil(xTaoQty/taoQty);//生成出库单数量
|
||||||
System.out.println(ckdQty);*/
|
System.out.println(ckdQty);*/
|
||||||
|
|
||||||
GdDetail gdDetail=new GdDetail();
|
GdDetail gdDetail = new GdDetail();
|
||||||
gdDetail.setBigItem(null);
|
gdDetail.setBigItem(null);
|
||||||
gdDetail.setOrderType("DP");
|
gdDetail.setOrderType("DP");
|
||||||
|
|
||||||
GdDetail gdDetail2=new GdDetail();
|
GdDetail gdDetail2 = new GdDetail();
|
||||||
BigItem bigItem2=new BigItem();
|
BigItem bigItem2 = new BigItem();
|
||||||
bigItem2.setCode("CT_001");
|
bigItem2.setCode("CT_001");
|
||||||
gdDetail2.setBigItem(bigItem2);
|
gdDetail2.setBigItem(bigItem2);
|
||||||
gdDetail2.setOrderType("CP");
|
gdDetail2.setOrderType("CP");
|
||||||
gdDetail2.setBigItemQty(1d);
|
gdDetail2.setBigItemQty(1d);
|
||||||
|
|
||||||
GdDetail gdDetail3=new GdDetail();
|
GdDetail gdDetail3 = new GdDetail();
|
||||||
BigItem bigItem3=new BigItem();
|
BigItem bigItem3 = new BigItem();
|
||||||
bigItem3.setCode("CT_001");
|
bigItem3.setCode("CT_001");
|
||||||
gdDetail3.setBigItem(bigItem3);
|
gdDetail3.setBigItem(bigItem3);
|
||||||
gdDetail3.setOrderType("CP");
|
gdDetail3.setOrderType("CP");
|
||||||
gdDetail3.setBigItemQty(2d);
|
gdDetail3.setBigItemQty(2d);
|
||||||
|
|
||||||
GdDetail gdDetail4=new GdDetail();
|
GdDetail gdDetail4 = new GdDetail();
|
||||||
BigItem bigItem4=new BigItem();
|
BigItem bigItem4 = new BigItem();
|
||||||
bigItem4.setCode("CT_002");
|
bigItem4.setCode("CT_002");
|
||||||
gdDetail4.setBigItem(bigItem4);
|
gdDetail4.setBigItem(bigItem4);
|
||||||
gdDetail4.setOrderType("CP");
|
gdDetail4.setOrderType("CP");
|
||||||
gdDetail4.setBigItemQty(3d);
|
gdDetail4.setBigItemQty(3d);
|
||||||
|
|
||||||
GdDetail gdDetail5=new GdDetail();
|
GdDetail gdDetail5 = new GdDetail();
|
||||||
BigItem bigItem5=new BigItem();
|
BigItem bigItem5 = new BigItem();
|
||||||
bigItem5.setCode("CT_002");
|
bigItem5.setCode("CT_002");
|
||||||
gdDetail5.setBigItem(bigItem5);
|
gdDetail5.setBigItem(bigItem5);
|
||||||
gdDetail5.setOrderType("CP");
|
gdDetail5.setOrderType("CP");
|
||||||
gdDetail5.setBigItemQty(4d);
|
gdDetail5.setBigItemQty(4d);
|
||||||
|
|
||||||
List<GdDetail> list=new ArrayList<>();
|
List<GdDetail> list = new ArrayList<>();
|
||||||
list.add(gdDetail);
|
list.add(gdDetail);
|
||||||
list.add(gdDetail2);
|
list.add(gdDetail2);
|
||||||
list.add(gdDetail3);
|
list.add(gdDetail3);
|
||||||
list.add(gdDetail4);
|
list.add(gdDetail4);
|
||||||
list.add(gdDetail5);
|
list.add(gdDetail5);
|
||||||
|
|
||||||
for(GdDetail gd:list){
|
for (GdDetail gd : list) {
|
||||||
System.out.println("总集合:"+gd);
|
System.out.println("总集合:" + gd);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GdDetail> cpList = list.stream()
|
List<GdDetail> cpList = list.stream()
|
||||||
|
|
@ -98,11 +127,11 @@ public class EladminSystemApplicationTests {
|
||||||
List<GdDetail> dpList = list.stream()
|
List<GdDetail> dpList = list.stream()
|
||||||
.filter(gd -> "DP".equals(gd.getOrderType()))
|
.filter(gd -> "DP".equals(gd.getOrderType()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
for(GdDetail gd:cpList){
|
for (GdDetail gd : cpList) {
|
||||||
System.out.println("成品集合:"+gd);
|
System.out.println("成品集合:" + gd);
|
||||||
}
|
}
|
||||||
for(GdDetail gd:dpList){
|
for (GdDetail gd : dpList) {
|
||||||
System.out.println("单品集合:"+gd);
|
System.out.println("单品集合:" + gd);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, List<GdDetail>> groupedByCode = cpList.stream()
|
Map<String, List<GdDetail>> groupedByCode = cpList.stream()
|
||||||
|
|
@ -114,8 +143,8 @@ public class EladminSystemApplicationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test(){
|
public void test() {
|
||||||
List<Integer> taskLists=new ArrayList<>();
|
List<Integer> taskLists = new ArrayList<>();
|
||||||
taskLists.add(1);
|
taskLists.add(1);
|
||||||
taskLists.add(2);
|
taskLists.add(2);
|
||||||
taskLists.add(3);
|
taskLists.add(3);
|
||||||
|
|
@ -123,7 +152,7 @@ public class EladminSystemApplicationTests {
|
||||||
taskLists.add(5);
|
taskLists.add(5);
|
||||||
taskLists.add(6);
|
taskLists.add(6);
|
||||||
|
|
||||||
for(Integer id:taskLists) {
|
for (Integer id : taskLists) {
|
||||||
try {
|
try {
|
||||||
taskQueue.add(id);
|
taskQueue.add(id);
|
||||||
if (taskQueue.size() >= MAX_TASK_COUNT) {
|
if (taskQueue.size() >= MAX_TASK_COUNT) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue