no message

main
HUOJIN\92525 2024-06-11 17:04:57 +08:00
parent 385522812a
commit 8b03f5df37
15 changed files with 120 additions and 88 deletions

View File

@ -65,10 +65,11 @@ public class BydAppController {
@AnonymousAccess
public ResponseEntity<Object> bindStock(@RequestBody BindStock bindStock) {
try {
String itemCode = bindStock.getItemCode();//物料编号
//二维码格式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 pointCode = bindStock.getPointCode();//点位编号
stockService.bindContainer(itemCode, stockCode, pointCode);
stockService.bindContainer(QRCode, stockCode, pointCode);
} catch (Exception e) {
return badRequest(e.getMessage());
}

View File

@ -45,7 +45,7 @@ public class ContainerServiceImpl implements ContainerService {
log.error("请扫描正确容器,操作失败!");
return false;
}
Point point = pointService.findByCode(position, null, null, null, null);
Point point = pointService.findByCode(position, null, null, null, null,null);
if (point == null) {
log.error("请扫描正确点位,操作失败!");
return false;
@ -105,7 +105,7 @@ public class ContainerServiceImpl implements ContainerService {
log.error("请扫描正确容器,操作失败!");
return false;
}
Point point = pointService.findByCode(position, null, null, null, null);
Point point = pointService.findByCode(position, null, null, null, null,null);
if (point == null) {
log.error("请扫描正确点位,操作失败!");
return false;

View File

@ -145,11 +145,11 @@ public class Item extends BaseEntity implements Serializable {
@Column(name = "`extend_d1`")
@ApiModelProperty(value = "默认容器装载数")
private Double extendD1=1d;
private Double extendD1=0d;
@Column(name = "`extend_d2`")
@ApiModelProperty(value = "冷却时长")
private Double extendD2=4d;
@ApiModelProperty(value = "整托高度")
private Double extendD2=0d;
@Column(name = "`extend_d3`")
@ApiModelProperty(value = "扩展小数3")
@ -184,7 +184,7 @@ public class Item extends BaseEntity implements Serializable {
private Long extendNum5;
@Column(name = "`extend_str1`")
@ApiModelProperty(value = "扩展字符1")
@ApiModelProperty(value = "翻包类型")
private String extendStr1;
@Column(name = "`extend_str2`")

View File

@ -1,18 +1,18 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.youchain.basicdata.domain;
import com.youchain.base.BaseEntity;
@ -22,18 +22,17 @@ import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author liuxue
* @date 2023-07-26
**/
* @author liuxue
* @website https://eladmin.vip
* @description /
* @date 2023-07-26
**/
@Entity
@Data
@Table(name="base_point")
@Table(name = "base_point")
public class Point extends BaseEntity implements Serializable {
@Id
@ -81,15 +80,15 @@ public class Point extends BaseEntity implements Serializable {
@Column(name = "`pos_x`")
@ApiModelProperty(value = "坐标X")
private Double posX=0d;
private Double posX = 0d;
@Column(name = "`pos_y`")
@ApiModelProperty(value = "坐标Y")
private Double posY=0d;
private Double posY = 0d;
@Column(name = "`pos_z`")
@ApiModelProperty(value = "坐标Z")
private Double posZ=0d;
private Double posZ = 0d;
@Column(name = "`type`")
@ApiModelProperty(value = "类型")
@ -101,17 +100,21 @@ public class Point extends BaseEntity implements Serializable {
@Column(name = "`rows`")
@ApiModelProperty(value = "层")
private int rows=0;
private int rows = 0;
@Column(name = "`col`")
@ApiModelProperty(value = "列")
private int col=0;
private int col = 0;
@Column(name = "`line`")
@ApiModelProperty(value = "排")
private int line=0;
private int line = 0;
public void copy(Point source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
@Column(name = "`item_height`")
@ApiModelProperty(value = "高度")
private Double itemHeight;
public void copy(Point source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -122,7 +122,7 @@ public class PointController {
if (existingPoint.containsKey(pointCode)) {
Point point = existingPoint.get(pointCode);
//更新点位
pointsToUpdate.add(updatePoint(point, area, dept, record));
pointsToUpdate.add(updatePoints(point, area, dept, record));
} else {
//新增点位
pointsToCreate.add(createPoint(area, dept, record));
@ -151,7 +151,7 @@ public class PointController {
}
private Point updatePoint(Point point, Area area, Dept dept, Map<String, Object> record) {
private Point updatePoints(Point point, Area area, Dept dept, Map<String, Object> record) {
point.setArea(area);
point.setDept(dept);
point.setDescription(record.get("存储类型") == null ? "" : record.get("存储类型").toString().trim());
@ -228,15 +228,6 @@ public class PointController {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PutMapping("/updatePoint")
@Log("修改point")
@ApiOperation("修改point")
@PreAuthorize("@el.check('point:edit')")
public ResponseEntity<Object> updatePointOK(@Validated @RequestBody Point resources) {
pointService.update(resources);
return new ResponseEntity<>(HttpStatus.OK);
}
@DeleteMapping
@Log("删除point")
@ApiOperation("删除point")

View File

@ -123,7 +123,7 @@ public interface PointService {
* @param goodType-
* @return
*/
Point findByCode(String code,String status,String type,String areaName,String goodType);
Point findByCode(String code,String status,String type,String areaName,String goodType,Double itemHeight);
/**
*

View File

@ -79,6 +79,9 @@ public class PointDto implements Serializable {
/** 层 */
private int rows;
/** 高度 */
private Double itemHeight;
/** 创建人 */
private String createBy;
@ -90,4 +93,4 @@ public class PointDto implements Serializable {
/** 修改时间 */
private Timestamp updateTime;
}
}

View File

@ -206,7 +206,7 @@ public class PointServiceImpl implements PointService {
}
@Override
public Point findByCode(String code, String status, String type, String areaName, String goodType) {
public Point findByCode(String code, String status, String type, String areaName, String goodType,Double itemHeight) {
StringBuilder hql = new StringBuilder("from Point point where point.enabled = true");
Map<String, Object> params = new HashMap<>();
if (code != null && !code.isEmpty()) {
@ -229,6 +229,10 @@ public class PointServiceImpl implements PointService {
hql.append(" and point.area.name = :areaName");
params.put("areaName", areaName);
}
if(itemHeight!= null ){
hql.append(" and point.itemHeight = :itemHeight");
params.put("itemHeight", itemHeight);
}
Query query = entityMapper.createQuery(hql.toString());
params.forEach(query::setParameter);
Optional<Point> pointList = query.getResultStream().findFirst();

View File

@ -18,7 +18,6 @@ package com.youchain.basicdata.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.youchain.basicdata.domain.Area;
import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
@ -40,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.sql.Timestamp;
import java.util.*;
import java.io.IOException;
import javax.persistence.EntityManager;
@ -273,8 +273,14 @@ public class StockServiceImpl implements StockService {
@Override
@Transactional(rollbackFor = Exception.class)
public void bindContainer(String itemCode, String stockCode, String pointCode) {
Item item = validateItem(itemCode);//验证物料
public void bindContainer(String QRCode, String stockCode, String pointCode) {
Map<String, String> map = parseString(QRCode);
String propC1 = map.get("Lot");//批次号
String gdh = map.get("S");//工单号
String propC3 = map.get("P");//工厂
String propD1 = map.get("D");//生产日期
double orderQty = Double.parseDouble(getStringCode(map.get("Q")));
Item item = validateItem(getStringCode(map.get("M")));//验证物料
Stock stock = validateStock(stockCode);//验证容器
validateStockStatus(stock);//验证容器状态
Point srcPoint = validateSrcPoint(pointCode);//验证点位
@ -291,15 +297,40 @@ public class StockServiceImpl implements StockService {
}
String areaName = stockTypeToAreaMap.get(stock.getStockType());
Point endPoint = validateEndPoint(areaName);//验证目标点位
Point endPoint = validateEndPoint(item,areaName);//验证目标点位
checkPointStatus(srcPoint);//验证源点位状态
AgvTask agvTask = createAndSendAgvTask(BizStatus.ASN, stock, srcPoint, endPoint);//生成AGV任务
AsnDetail asnDetail = createAsnDetail(item, stock, srcPoint);//生成ASN明细
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, srcPoint, propC1, gdh, 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);
}
private Map<String, String> parseString(String QRCode) {
//P:工厂;V:客户编号;M:物料编号/PCS;B:BYD批次;Lot:供应商批次号;S:工单编号;PO:采购订单/箱号;Q:数量;D:生产日期;YX:有效天数;
// 使用分号分隔字符串
String[] pairs = QRCode.split(";");
Map<String, String> resultMap = new HashMap<>();
for (String pair : pairs) {
// 使用冒号分隔键和值
String[] keyValue = pair.split(":");
if (keyValue.length == 2) {
String key = keyValue[0].trim();
String value = keyValue[1].trim();
resultMap.put(key, value);
}
}
for (String key : resultMap.keySet()) {
log.info("key:{" + key + "},value:{" + resultMap.get(key) + "}");
}
return resultMap;
}
private String getStringCode(String str) {
int index = str.indexOf('/');
return str.substring(0, index);
}
private boolean isValidMCArea(String areaName) {
return AreaNameDic.DXJRKQ.equals(areaName);
}
@ -340,15 +371,19 @@ public class StockServiceImpl implements StockService {
}
private Point validateSrcPoint(String pointCode) {
Point srcPoint = pointService.findByCode(pointCode, null, null, null, null);
Point srcPoint = pointService.findByCode(pointCode, null, null, null, null,null);
if (srcPoint == null) {
throw new RuntimeException("请扫描正确点位!");
}
return srcPoint;
}
private Point validateEndPoint(String areaName) {
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaName, null);
private Point validateEndPoint(Item item,String areaName) {
Double itemHeight = null;
if("小件存储区".equals(areaName)){
itemHeight=item.getExtendD2();//整托高度
}
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaName, null,itemHeight);
if (endPoint == null) {
throw new RuntimeException(areaName + "没有空闲点位!");
}
@ -373,17 +408,6 @@ public class StockServiceImpl implements StockService {
agvTaskService.sendAgvTaskImpl(agvTask);
}
private AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint) {
Date date = cn.hutool.core.date.DateUtil.date();
String propC1 = DateUtil.format(date, "yyyyMMdd");
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, srcPoint, propC1, null);
asnDetail.setOrderQty(item.getExtendD1());
asnDetail.setPo(null);
asnDetail.setPropC3(null);
asnDetailService.update(asnDetail);
return asnDetail;
}
private Task createTask(Item item, ItemKey itemKey, AsnDetail asnDetail, Stock stock, Point srcPoint, Point endPoint, AgvTask agvTask) {
Task task = new Task(item, itemKey, asnDetail.getOrderNumber(), BizStatus.ASN, asnDetail, null, null, null, stock, stock, srcPoint, endPoint, stock.getCode(), stock.getCode(), srcPoint.getCode(), endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept(), agvTask);
taskService.create(task);

View File

@ -58,7 +58,7 @@ public class AsnDetail extends BaseEntity implements Serializable {
private Item item;
@OneToOne
@JoinColumn(name = "`stock_id`")
@JoinColumn(name = "`stock_id`",nullable = false)
@ApiModelProperty(value = "容器")
private Stock stock;
@ -71,11 +71,11 @@ public class AsnDetail extends BaseEntity implements Serializable {
@ApiModelProperty(value = "行号")
private Long lineNo;
@Column(name = "`po`")
@Column(name = "`po`",nullable = false)
@ApiModelProperty(value = "Mo票")
private String po;
@Column(name = "`status`")
@Column(name = "`status`",nullable = false)
@ApiModelProperty(value = "状态")
private String status;
@ -140,7 +140,7 @@ public class AsnDetail extends BaseEntity implements Serializable {
private Timestamp propD2;
@OneToOne
@JoinColumn(name = "dept_id")
@JoinColumn(name = "dept_id",nullable = false)
@ApiModelProperty(value = "仓库")
private Dept dept;
@ -152,7 +152,7 @@ public class AsnDetail extends BaseEntity implements Serializable {
@ApiModelProperty(value = "来源序号")
private Long sourceId;
@Column(name = "`order_number`")
@Column(name = "`order_number`",nullable = false)
@ApiModelProperty(value = "工单号")
private String orderNumber;

View File

@ -423,7 +423,7 @@ public class AsnDetailController {
@AnonymousAccess
public ResponseEntity<Object> putawaySrcPoint(@RequestBody IRkInv rk) {
String srcPointCode = rk.getSrcPointCode();
Point srcPoint = pointService.findByCode(srcPointCode, null, null, null, null);
Point srcPoint = pointService.findByCode(srcPointCode, null, null, null, null,null);
if (srcPoint == null) {
ApiError apiError = ApiError.errorJosn(HttpStatus.BAD_REQUEST.value(), srcPointCode + "找不到起点");
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
@ -461,7 +461,7 @@ public class AsnDetailController {
// if (srcPoint == null) {
// return ApiResult.result(400,srcPointCode+"找不到起点",obj);
// }
Point dstPoint = pointService.findByCode(dstPointCode, BaseStatus.FREE, BaseStatus.STORAGE, "", null);
Point dstPoint = pointService.findByCode(dstPointCode, BaseStatus.FREE, BaseStatus.STORAGE, "", null,null);
if (dstPoint == null) {
return ApiResult.result(400, dstPoint + "找不到终点或状态不对", obj);
}

View File

@ -23,6 +23,8 @@ import com.youchain.businessdata.domain.AsnDetail;
import com.youchain.businessdata.service.dto.AsnDetailDto;
import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.sql.Timestamp;
import java.util.Map;
import java.util.List;
import java.io.IOException;
@ -106,7 +108,7 @@ public interface AsnDetailService {
* @param item
* @return
*/
AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint,String propC1,String gdh);
AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint, String propC1, String gdh, String propC3, Timestamp propD1,Double orderQty,String Po);
/**
* AsnDetail

View File

@ -155,7 +155,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
String viewBoardType = "";
Point point = pointService.findByCode(agvTasks.getStartSlotCode(), null, null, null, null);
Point point = pointService.findByCode(agvTasks.getStartSlotCode(), null, null, null, null,null);
//到达上视自动识别
if (AreaNameDic.CPRKQ.equals(point.getArea().getName())) {
viewBoardType = "IDENTIFY_REQUIRE";
@ -428,7 +428,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
private void handleUpContainer(AgvTask agvTask, String containerCode) {
//顶升释放起点位置状态及容器绑定的起点位置
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
Point startPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
startPoint.setStatus(BaseStatus.FREE);
pointService.update(startPoint);
@ -440,7 +440,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
private void handleComContainer(AgvTask agvTask, String containerCode) {
//任务完成根据AGV任务的目标点位走对应流程
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null);
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null,null);
String endAreaName = endPoint.getArea().getName();
Stock stock = stockRepository.findByCode(containerCode, null);
if (stock == null) {
@ -625,7 +625,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
*/
private void handleCanceledTask(AgvTask agvTask, String containerCode) {
//任务取消完成
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null);
Point endPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null,null);
String endAreaName = endPoint.getArea().getName();
Stock stock = stockRepository.findByCode(containerCode, null);
if (stock == null) {
@ -649,7 +649,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
private void handleFKCancel(AgvTask agvTask, Point endPoint, Stock stock) {
//回空车取消
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
//起点点位释放
releasePoint(srcPoint);
stock.setPoint(null);
@ -694,7 +694,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
log.info(agvTask.getId() + "任务" + containerCode + "容器未移动!");
Stock stock = stockRepository.findByCode(containerCode, null);
if (stock != null) {
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
stock.setPoint(srcPoint);
stockRepository.save(stock);
}
@ -773,7 +773,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
taskService.update(task);
}
//起点点位释放
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null);
Point srcPoint = pointService.findByCode(agvTask.getStartSlotCode(), null, null, null, null,null);
releasePoint(srcPoint);
stock.setPoint(null);
stock.setStatus(BaseStatus.FREE);

View File

@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
import java.io.IOException;
@ -196,17 +197,20 @@ public class AsnDetailServiceImpl implements AsnDetailService {
@Override
public AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint, String propC1, String gdh) {
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(item.getExtendD1());
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;
}

View File

@ -53,7 +53,7 @@ public class gtcTask {
for (AgvTask agvTask : agvTaskList1) {
try {
//满箱任务的终点是线边空箱的起点;获取线边点位
Point startPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null);
Point startPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null,null);
String taskCode = startPoint.getName() + "2";//线边名称2代表空箱输送线
//出库缓存出库缓存滚筒输送线满箱接驳口为终点