no message

main
HUOJIN\92525 2024-06-28 13:41:53 +08:00
parent 4139044c55
commit 9efba159b6
20 changed files with 261 additions and 192 deletions

View File

@ -5,12 +5,18 @@ import lombok.Data;
@Data @Data
public class ItemDate { public class ItemDate {
@ApiModelProperty(value ="行号",required = true,example = "行号") @ApiModelProperty(value = "行号", required = true, example = "行号")
int lineNo; int lineNo;
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
@ApiModelProperty(value = "需求工位", required = true)
String station;
@ApiModelProperty(value = "物料代码", required = true, example = "物料代码")
String itemCode; String itemCode;
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
@ApiModelProperty(value = "物料名称", required = true, example = "物料名称")
String itemName; String itemName;
@ApiModelProperty(value ="物料数量",required = true,example = "1")
Double itemQty=0d; @ApiModelProperty(value = "物料数量", required = true, example = "1")
Double itemQty = 0d;
} }

View File

@ -8,18 +8,21 @@ import java.util.Set;
@Data @Data
public class Yclbl { public class Yclbl {
@ApiModelProperty(value ="任务号",required = true,example = "任务号") @ApiModelProperty(value = "任务号", required = true, example = "任务号")
String taskCode; String taskCode;
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
@ApiModelProperty(value = "工单号", required = true, example = "工单号")
String orderNo; String orderNo;
@ApiModelProperty(value ="工单时间",required = true,example = "2023-07-03 00:00:00")
@ApiModelProperty(value = "工单时间", required = true, example = "2023-07-03 00:00:00")
String orderTime; String orderTime;
@ApiModelProperty(value ="需求工位",required = true)
String station; @ApiModelProperty(value = "下发时间", required = true, example = "2023-07-03 00:00:00")
@ApiModelProperty(value ="下发时间",required = true,example = "2023-07-03 00:00:00")
String createTime; String createTime;
@ApiModelProperty(value ="总成明细",required = true)
@ApiModelProperty(value = "总成明细", required = true)
Set<ZcData> blzc; Set<ZcData> blzc;
@ApiModelProperty(value ="单品明细",required = true)
@ApiModelProperty(value = "单品明细", required = true)
Set<ItemDate> blzcmx; Set<ItemDate> blzcmx;
} }

View File

@ -8,16 +8,22 @@ import java.util.Set;
@Data @Data
public class ZcData { public class ZcData {
@ApiModelProperty(value ="行号",required = true,example = "行号") @ApiModelProperty(value = "行号", required = true, example = "行号")
int lineNo; int lineNo;
@ApiModelProperty(value ="总成代码",required = true,example = "总成代码")
String completeCode;
@ApiModelProperty(value ="总成名称",required = true,example = "总成名称")
String completeName;
@ApiModelProperty(value ="总成套数",required = true,example = "总成套数")
double completeQty=0d;
@ApiModelProperty(value ="总成明细",required = true) @ApiModelProperty(value = "总成代码", required = true, example = "总成代码")
String completeCode;
@ApiModelProperty(value = "总成名称", required = true, example = "总成名称")
String completeName;
@ApiModelProperty(value = "总成套数", required = true, example = "总成套数")
double completeQty = 0d;
@ApiModelProperty(value = "总成明细", required = true)
Set<ItemDate> blzcmx; Set<ItemDate> blzcmx;
@ApiModelProperty(value = "需求工位", required = true)
String station;
} }

View File

@ -35,9 +35,9 @@ public class BydAppController {
public ResponseEntity<Object> scanMo(@RequestBody BindStock bindStock) { public ResponseEntity<Object> scanMo(@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.getMo();//Mo票二维码
String stockCode = bindStock.getStockCode();//容器编号 String stockCode = bindStock.getStockCode();//容器编号
String boxNumber = stockService.scanMo(stockCode, QRCode); String mo = bindStock.getMo();//Mo票二维码
String boxNumber = stockService.scanMo(stockCode, mo);
return successResponse("扫描成功!", boxNumber); return successResponse("扫描成功!", boxNumber);
} catch (Exception e) { } catch (Exception e) {
return badRequest("扫描失败:" + e.getMessage()); return badRequest("扫描失败:" + e.getMessage());
@ -50,15 +50,15 @@ public class BydAppController {
@AnonymousAccess @AnonymousAccess
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
String stockCode = bindStock.getStockCode();//容器编号 String stockCode = bindStock.getStockCode();//容器编号
Set<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合 Set<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合
String pointCode = bindStock.getPointCode();//点位编号 String pointCode = bindStock.getPointCode();//点位编号
stockService.materialIn(stockCode, boxNumbers, pointCode); stockService.materialIn(stockCode, boxNumbers, pointCode);
return successResponse("入库成功!");
} catch (Exception e) { } catch (Exception e) {
return badRequest(e.getMessage()); return badRequest("入库失败:" + e.getMessage());
} }
return successResponse("入库成功!");
} }
@PostMapping("/fbPicking") @PostMapping("/fbPicking")

View File

@ -25,6 +25,7 @@ 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.repository.AsnDetailRepository;
import com.youchain.businessdata.repository.TaskRepository;
import com.youchain.businessdata.service.*; import com.youchain.businessdata.service.*;
import com.youchain.utils.*; import com.youchain.utils.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -43,6 +44,7 @@ import org.springframework.data.domain.Pageable;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.*;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Collectors;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.Query; import javax.persistence.Query;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -61,8 +63,7 @@ public class StockServiceImpl implements StockService {
private final StockRepository stockRepository; private final StockRepository stockRepository;
private final AsnDetailRepository asnDetailRepository; private final AsnDetailRepository asnDetailRepository;
private final StockMapper stockMapper; private final TaskRepository taskRepository;
private final EntityManager entityMapper;
private final AgvTaskService agvTaskService; private final AgvTaskService agvTaskService;
private final ItemService itemService; private final ItemService itemService;
private final InventoryService inventoryService; private final InventoryService inventoryService;
@ -72,7 +73,8 @@ public class StockServiceImpl implements StockService {
private final PointService pointService; private final PointService pointService;
private final TaskService taskService; private final TaskService taskService;
private final StockTypeToAreaMap stockTypeToAreaMap; private final StockTypeToAreaMap stockTypeToAreaMap;
private final StockMapper stockMapper;
private final EntityManager entityMapper;
@Override @Override
public Map<String, Object> queryAll(StockQueryCriteria criteria, Pageable pageable) { public Map<String, Object> queryAll(StockQueryCriteria criteria, Pageable pageable) {
@ -275,6 +277,7 @@ public class StockServiceImpl implements StockService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public String scanMo(String stockCode, String mo) { public String scanMo(String stockCode, String mo) {
Map<String, String> map = parseString(mo);//解析二维码 Map<String, String> map = parseString(mo);//解析二维码
String propC1 = map.get("Lot");//批次号 String propC1 = map.get("Lot");//批次号
@ -296,6 +299,8 @@ public class StockServiceImpl implements StockService {
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, null, propC1, boxNumber, propC3, Timestamp.valueOf(DateUtil.formatDateTime(DateUtil.parse(propD1))), orderQty, mo); 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 ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getOrderNumber());//生成Itemkey
createTask(item, itemKey, asnDetail, stock, null, null, null);//生成Task任务 createTask(item, itemKey, asnDetail, stock, null, null, null);//生成Task任务
stock.setStatus(BaseStatus.USED);
update(stock);
return boxNumber; return boxNumber;
} }
@ -303,19 +308,39 @@ public class StockServiceImpl implements StockService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void materialIn(String stockCode, Set boxNumbers, String pointCode) { public void materialIn(String stockCode, Set boxNumbers, String pointCode) {
Stock stock = validateStock(stockCode);//验证容器 Stock stock = validateStock(stockCode);//验证容器
if (boxNumbers.isEmpty()) {
throw new RuntimeException("请扫描箱号!");
}
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 + "不能入库!");
} }
List<AsnDetail> asnDetailList = asnDetailRepository.fingByAsnDetail(boxNumbers);
if (asnDetailList.isEmpty()) {
throw new RuntimeException(boxNumbers + "箱号无入库明细记录!");
}
String areaCode = stockTypeToAreaMap.getValueByKey(stock.getStockType()); String areaCode = stockTypeToAreaMap.getValueByKey(stock.getStockType());
Point endPoint = validateEndPoint(null, areaCode);//验证目标点位 Point endPoint = validateEndPoint(asnDetailList.get(0).getItem(), areaCode);//验证目标点位
checkPointStatus(srcPoint);//验证源点位状态 checkPointStatus(srcPoint);//验证源点位状态
AgvTask agvTask = createAndSendAgvTask(BizStatus.ASN, stock, srcPoint, endPoint);//生成AGV任务
AgvTask agvTask = createAndSendAgvTask(BizStatus.ASN, stock, srcPoint, endPoint);//生成AGV任务
for (AsnDetail asnDetail : asnDetailList) {
asnDetail.setPoint(srcPoint);
asnDetailRepository.save(asnDetail);
}
Set asnDetailIds = asnDetailList.stream().map(AsnDetail::getId).collect(Collectors.toSet());
List<Task> taskList = taskRepository.findByAsnDetailTask(asnDetailIds);
for (Task task : taskList) {
task.setSrcPoint(srcPoint);
task.setSrcPointCode(srcPoint.getCode());
task.setDstPoint(endPoint);
task.setDstPointCode(endPoint.getCode());
task.setAgvTask(agvTask);
taskService.update(task);
}
updateStockAndPoints(stock, srcPoint, endPoint);//更新容器和点位状态 updateStockAndPoints(stock, srcPoint, endPoint);//更新容器和点位状态
} }
@ -385,15 +410,24 @@ public class StockServiceImpl implements StockService {
} }
private void validateStockStatus(Stock stock, Item item) { private void validateStockStatus(Stock stock, Item item) {
if (BaseStatus.USED.equals(stock.getStatus())) { //查看容器放的是否是同一种物料
//查看容器放的是否是同一种物料 List<AsnDetail> asnDetails = asnDetailRepository.findByStockCode(stock.getCode());
List<AsnDetail> asnDetails = asnDetailRepository.findByStockCode(stock.getCode()); if (asnDetails.isEmpty()) {
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
for (Inventory inventory : inventoryList) {
if (!inventory.getItemKey().getItem().getCode().equals(item.getCode())) {
throw new RuntimeException(stock.getCode() + "托盘已装入" + inventory.getItemKey().getItem().getCode() + "物料,扫描物料" + item.getCode() + "不一致!");
}
}
} else {
for (AsnDetail asnDetail : asnDetails) { for (AsnDetail asnDetail : asnDetails) {
if (!asnDetail.getItem().getCode().equals(item.getCode())) { if (!asnDetail.getItem().getCode().equals(item.getCode())) {
throw new RuntimeException(stock.getCode() + "托盘已装入" + asnDetail.getItem().getCode() + "物料,扫描物料" + item.getCode() + "不一致!"); throw new RuntimeException(stock.getCode() + "托盘已装入" + asnDetail.getItem().getCode() + "物料,扫描物料" + item.getCode() + "不一致!");
} }
} }
} }
} }
private Point validateSrcPoint(String pointCode) { private Point validateSrcPoint(String pointCode) {
@ -434,8 +468,9 @@ public class StockServiceImpl implements StockService {
agvTaskService.sendAgvTaskImpl(agvTask); agvTaskService.sendAgvTaskImpl(agvTask);
} }
private Task createTask(Item item, ItemKey itemKey, AsnDetail asnDetail, Stock stock, Point srcPoint, Point endPoint, AgvTask agvTask) { private Task createTask(Item item, ItemKey itemKey, AsnDetail asnDetail, Stock stock, Point srcPoint, Point
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); 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 == null ? null : srcPoint.getCode(), endPoint == null ? null : endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept(), agvTask);
taskService.create(task); taskService.create(task);
return task; return task;
} }

View File

@ -56,10 +56,6 @@ public class Gd extends BaseEntity implements Serializable {
@ApiModelProperty(value = "工单状态") @ApiModelProperty(value = "工单状态")
private String status; private String status;
@Column(name = "`station`",nullable = false)
@ApiModelProperty(value = "需求工位")
private String station;
@OneToOne @OneToOne
@JoinColumn(name = "`dept_id`",nullable = false) @JoinColumn(name = "`dept_id`",nullable = false)
@ApiModelProperty(value = "仓库") @ApiModelProperty(value = "仓库")

View File

@ -84,6 +84,11 @@ public class GdDetail extends BaseEntity implements Serializable {
@ApiModelProperty(value = "仓库") @ApiModelProperty(value = "仓库")
private Dept dept; private Dept dept;
@Column(name = "`station`",nullable = false)
@ApiModelProperty(value = "需求工位")
private String station;
public void copy(GdDetail source) { public void copy(GdDetail source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
} }

View File

@ -1,18 +1,18 @@
/* /*
* 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.repository; package com.youchain.businessdata.repository;
import com.youchain.businessdata.domain.AsnDetail; import com.youchain.businessdata.domain.AsnDetail;
@ -21,13 +21,17 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @website https://eladmin.vip * @author hjl
* @author hjl * @website https://eladmin.vip
* @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') ") @Query(value = " FROM AsnDetail ad WHERE ad.stock.code =?1 and ad.status not in('RECEIVED') ")
List<AsnDetail> findByStockCode(String stockCode); List<AsnDetail> findByStockCode(String stockCode);
@Query(value = " FROM AsnDetail ad WHERE ad.orderNumber in :boxNumbers and ad.status not in('RECEIVED') ")
List<AsnDetail> fingByAsnDetail(Set boxNumbers);
} }

View File

@ -32,9 +32,8 @@ public interface GdRepository extends JpaRepository<Gd, Long>, JpaSpecificationE
* gd * gd
* @param code * @param code
* @param name * @param name
* @param station
* @return * @return
*/ */
@Query(value = " FROM Gd g WHERE g.code=?1 and g.name=?2 and g.station=?3 ") @Query(value = " FROM Gd g WHERE g.code=?1 and g.name=?2 ")
Gd findByGdList(String code, String name, String station); Gd findByGdList(String code, String name);
} }

View File

@ -23,6 +23,7 @@ import org.springframework.data.jpa.repository.Query;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* @author houjianlan * @author houjianlan
@ -30,14 +31,24 @@ 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> {
/**
* asnDetailIds
*
* @param asnDetailIds
* @return
*/
@Query(value = " FROM Task t WHERE t.asnDetail.id in :asnDetailIds ")
List<Task> findByAsnDetailTask(Set asnDetailIds);
/** /**
* pickId * pickId
*
* @param pickId * @param pickId
* @return * @return
*/ */
@Query(value = " FROM Task t WHERE t.pickDetail.pick.id=?1 and t.taskType='PICK' and t.planQty>t.moveQty ") @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); 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 ") @Query(value = " select count(t.id) FROM Task t WHERE t.taskType='PICK' and t.taskStatus not in ('FINISH') and t.srcPoint.id=?1 ")
Boolean existsByTask(Long srcPointId); int existsByTask(Long srcPointId);
} }

View File

@ -96,10 +96,9 @@ public interface GdService {
* *
* @param orderNo * @param orderNo
* @param taskCode * @param taskCode
* @param station
* @return Gd * @return Gd
*/ */
Gd createGd(String orderNo, String taskCode, String station); Gd createGd(String orderNo, String taskCode);
/** /**
* *

View File

@ -1,18 +1,18 @@
/* /*
* 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.basicdata.domain.Point; import com.youchain.basicdata.domain.Point;
@ -22,93 +22,105 @@ import com.youchain.businessdata.domain.Pick;
import com.youchain.businessdata.service.dto.PickDto; import com.youchain.businessdata.service.dto.PickDto;
import com.youchain.businessdata.service.dto.PickQueryCriteria; import com.youchain.businessdata.service.dto.PickQueryCriteria;
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 huojin
* @description * @website https://eladmin.vip
* @author huojin * @description
* @date 2024-06-11 * @date 2024-06-11
**/ **/
public interface PickService { public interface PickService {
/** /**
* *
* @param criteria *
* @param pageable * @param criteria
* @return Map<String,Object> * @param pageable
*/ * @return Map<String, Object>
Map<String,Object> queryAll(PickQueryCriteria criteria, Pageable pageable); */
Map<String, Object> queryAll(PickQueryCriteria criteria, Pageable pageable);
/** /**
* *
* @param criteria *
* @return List<PickDto> * @param criteria
*/ * @return List<PickDto>
*/
List<PickDto> queryAll(PickQueryCriteria criteria); List<PickDto> queryAll(PickQueryCriteria criteria);
/** /**
* ID * ID
*
* @param id ID * @param id ID
* @return PickDto * @return PickDto
*/ */
PickDto findById(Long id); PickDto findById(Long id);
/** /**
* *
* @param resources / *
* @return PickDto * @param resources /
*/ * @return PickDto
*/
PickDto create(Pick resources); PickDto create(Pick resources);
/** /**
* *
* @param resources / *
*/ * @param resources /
*/
void update(Pick resources); void update(Pick resources);
/** /**
* *
* @param ids / *
*/ * @param ids /
*/
void deleteAll(Long[] ids); void deleteAll(Long[] ids);
/** /**
* *
* @param all *
* @param response / * @param all
* @throws IOException / * @param response /
*/ * @throws IOException /
*/
void download(List<PickDto> all, HttpServletResponse response) throws IOException; void download(List<PickDto> all, HttpServletResponse response) throws IOException;
Pick save(GdDetail gdDetail, int no); Pick save(GdDetail gdDetail, int no);
/** /**
* *
*
* @param gdNo-> * @param gdNo->
* @param completeCode-> * @param completeCode->
* @param station-> * @param station->
* @param pointCode-> * @param pointCode->
*/ */
void bigItemCall(String gdNo,String completeCode,String station,String pointCode); void bigItemCall(String gdNo, String completeCode, String station, String pointCode);
/** /**
* *
*
* @param gdNo-> * @param gdNo->
* @param itemCode-> * @param itemCode->
* @param station-> * @param station->
* @param pointCode-> * @param pointCode->
*/ */
void itemCall(String gdNo,String itemCode,String station,String pointCode); void itemCall(String gdNo, String itemCode, String station, String pointCode);
/** /**
* *
*
* @param gd-> * @param gd->
* @param lineNo-> * @param lineNo->
* @param cpCodeOrpCode-> * @param cpCodeOrpCode->
* @param station->
*/ */
Pick createPick(Gd gd, int lineNo, String cpCodeOrpCode); Pick createPick(Gd gd, int lineNo, String cpCodeOrpCode, String station);
} }

View File

@ -19,52 +19,80 @@ import com.youchain.basicdata.domain.BigItem;
import com.youchain.basicdata.domain.Item; import com.youchain.basicdata.domain.Item;
import com.youchain.businessdata.domain.Gd; import com.youchain.businessdata.domain.Gd;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.io.Serializable; import java.io.Serializable;
/** /**
* @author huojin
* @website https://eladmin.vip * @website https://eladmin.vip
* @description / * @description /
* @author huojin
* @date 2024-06-06 * @date 2024-06-06
**/ **/
@Data @Data
public class GdDetailDto implements Serializable { public class GdDetailDto implements Serializable {
/** ID */ /**
* ID
*/
private Long id; private Long id;
/** 创建人 */ /**
*
*/
private String createBy; private String createBy;
/** 修改人 */ /**
*
*/
private String updateBy; private String updateBy;
/** 创建时间 */ /**
*
*/
private Timestamp createTime; private Timestamp createTime;
/** 修改时间 */ /**
*
*/
private Timestamp updateTime; private Timestamp updateTime;
/** 行号 */ /**
*
*/
private int lineNo; private int lineNo;
/** 关联物料 */ /**
*
*/
private Long itemId; private Long itemId;
private Item item; private Item item;
/** 订单数量 */ /**
*
*/
private Long itemQty; private Long itemQty;
/** 总成代码 */ /**
*
*/
private Long bigItemId; private Long bigItemId;
private BigItem bigItem; private BigItem bigItem;
/** 总成套数 */ /**
*
*/
private Long bigItemQty; private Long bigItemQty;
private Gd gd; private Gd gd;
private Double orderQty; private Double orderQty;
/** 单据类型 */ /**
*
*/
private String orderType; private String orderType;
/**
*
*/
private String station;
} }

View File

@ -52,4 +52,10 @@ public class GdDetailQueryCriteria {
*/ */
@Query @Query
private String orderType; private String orderType;
/**
*
*/
@Query
private String station;
} }

View File

@ -51,7 +51,4 @@ public class GdDto implements Serializable {
/** 工单状态 */ /** 工单状态 */
private String status; private String status;
}
/** 需求工位 */
private String station;
}

View File

@ -39,7 +39,4 @@ public class GdQueryCriteria{
@Query @Query
private String status; private String status;
/** 模糊 */ }
@Query(type = Query.Type.INNER_LIKE)
private String station;
}

View File

@ -453,7 +453,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
handleXJDJ(taskList, stock);//入库 handleXJDJ(taskList, stock);//入库
break; break;
case AreaNameDic.FBQ: case AreaNameDic.FBQ:
handleFBQ(taskList, endPoint);//备料完成 handleFBQ(taskList, stock, endPoint);//备料完成
case AreaNameDic.JLQ: case AreaNameDic.JLQ:
// handleJL(taskList, endPoint, stock);//满车出库 // handleJL(taskList, endPoint, stock);//满车出库
break; break;
@ -571,37 +571,17 @@ public class AgvTaskServiceImpl implements AgvTaskService {
* *
* @param taskList * @param taskList
*/ */
private void handleFBQ(List<Task> taskList, Point endPoint) { private void handleFBQ(List<Task> taskList, Stock stock, Point endPoint) {
//将托盘的物料移动到备料库位
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
for (Inventory inventory : inventoryList) {
inventory.setPoint(endPoint);
inventoryService.update(inventory);
}
/* 更新Task任务状态*/ /* 更新Task任务状态*/
for (Task task : taskList) { for (Task task : taskList) {
/*Inventory inventory = task.getInventory();//原库存 task.setTaskStatus(BizStatus.FINISH);
if (inventory != null) { taskRepository.save(task);
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);
} }
} }
@ -634,16 +614,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
* @param ad * @param ad
*/ */
private void updateInventory(Stock stock, Task task, AsnDetail ad) { private void updateInventory(Stock stock, Task task, AsnDetail ad) {
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
if (inventoryList.size() > 0) {
Long[] ids = new Long[inventoryList.size()];
for (int i = 0; i < inventoryList.size(); i++) {
ids[i] = inventoryList.get(i).getId();
}
if (ids.length > 0) {
inventoryService.deleteAll(ids);
}
}
Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), stock, task.getDept(), BizStatus.RECEIVING_UP); Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), stock, task.getDept(), BizStatus.RECEIVING_UP);
inventory.setQuantity(inventory.getQuantity() + task.getPlanQty()); inventory.setQuantity(inventory.getQuantity() + task.getPlanQty());

View File

@ -131,7 +131,6 @@ public class GdServiceImpl implements GdService {
map.put("工单编号", gd.getCode()); map.put("工单编号", gd.getCode());
map.put("任务编号", gd.getName()); map.put("任务编号", gd.getName());
map.put("工单状态", gd.getStatus()); map.put("工单状态", gd.getStatus());
map.put("需求工位", gd.getStation());
list.add(map); list.add(map);
} }
FileUtil.downloadExcel(list, response); FileUtil.downloadExcel(list, response);
@ -139,11 +138,10 @@ public class GdServiceImpl implements GdService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Gd createGd(String orderNo, String taskCode, String station) { public Gd createGd(String orderNo, String taskCode) {
Gd gd = new Gd(); Gd gd = new Gd();
gd.setCode(orderNo); gd.setCode(orderNo);
gd.setName(taskCode); gd.setName(taskCode);
gd.setStation(station);
gd.setStatus(BizStatus.OPEN); gd.setStatus(BizStatus.OPEN);
gd.setDept(deptService.getDefaultDept()); gd.setDept(deptService.getDefaultDept());
gdRepository.save(gd); gdRepository.save(gd);
@ -151,7 +149,6 @@ public class GdServiceImpl implements GdService {
} }
/** /**
* *
* *
@ -167,7 +164,7 @@ public class GdServiceImpl implements GdService {
checkIfGdExists(yclbl); checkIfGdExists(yclbl);
/** 创建工单 */ /** 创建工单 */
Gd gd = createGd(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation()); Gd gd = createGd(yclbl.getOrderNo(), yclbl.getTaskCode());
/** 创建工单明细 */ /** 创建工单明细 */
List<GdDetail> gdDetailList = createGdDetailsCPAndDP(gd, yclbl); List<GdDetail> gdDetailList = createGdDetailsCPAndDP(gd, yclbl);
@ -183,7 +180,7 @@ public class GdServiceImpl implements GdService {
* @param yclbl -> * @param yclbl ->
*/ */
private void checkIfGdExists(Yclbl yclbl) { private void checkIfGdExists(Yclbl yclbl) {
Gd gd = gdRepository.findByGdList(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation()); Gd gd = gdRepository.findByGdList(yclbl.getOrderNo(), yclbl.getTaskCode());
if (gd != null) { if (gd != null) {
throw new IllegalArgumentException(yclbl.getOrderNo() + "备料工单已存在!"); throw new IllegalArgumentException(yclbl.getOrderNo() + "备料工单已存在!");
} }
@ -218,7 +215,8 @@ public class GdServiceImpl implements GdService {
bigItem, bigItem,
completeQty, completeQty,
orderType, orderType,
dept dept,
zcData.getStation()
); );
}); });
}) })
@ -250,7 +248,8 @@ public class GdServiceImpl implements GdService {
null, null,
null, null,
orderType, orderType,
dept dept,
itemDate.getStation()
); );
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -296,7 +295,7 @@ public class GdServiceImpl implements GdService {
* @param dept -> * @param dept ->
* @return * @return
*/ */
private GdDetail createGdDetail(Gd gd, int lineNo, Item item, Double itemQty, BigItem bigItem, Double bigItemQty, String orderType, Dept dept) { private GdDetail createGdDetail(Gd gd, int lineNo, Item item, Double itemQty, BigItem bigItem, Double bigItemQty, String orderType, Dept dept, String station) {
GdDetail gdDetail = new GdDetail(); GdDetail gdDetail = new GdDetail();
gdDetail.setGd(gd); gdDetail.setGd(gd);
gdDetail.setLineNo(lineNo); gdDetail.setLineNo(lineNo);
@ -306,6 +305,7 @@ public class GdServiceImpl implements GdService {
gdDetail.setBigItemQty(bigItemQty); gdDetail.setBigItemQty(bigItemQty);
gdDetail.setOrderType(orderType); gdDetail.setOrderType(orderType);
gdDetail.setDept(dept); gdDetail.setDept(dept);
gdDetail.setStation(station);
return gdDetail; return gdDetail;
} }
@ -321,9 +321,7 @@ public class GdServiceImpl implements GdService {
if (StringUtils.isEmpty(yclbl.getTaskCode())) { if (StringUtils.isEmpty(yclbl.getTaskCode())) {
throw new IllegalArgumentException("任务号不能为空!"); throw new IllegalArgumentException("任务号不能为空!");
} }
if (StringUtils.isEmpty(yclbl.getStation())) {
throw new IllegalArgumentException("需求工位不能为空!");
}
if (yclbl.getBlzc().isEmpty() && yclbl.getBlzcmx().isEmpty()) { if (yclbl.getBlzc().isEmpty() && yclbl.getBlzcmx().isEmpty()) {
throw new IllegalArgumentException("成品明细和单品明细不能为空!"); throw new IllegalArgumentException("成品明细和单品明细不能为空!");
} }
@ -427,7 +425,7 @@ public class GdServiceImpl implements GdService {
double fbTaoQty = packageCheck.getQuantity();//翻包套数 double fbTaoQty = packageCheck.getQuantity();//翻包套数
double chkQty = Math.ceil(xqTaoQty / fbTaoQty);//生成出库单数量 double chkQty = Math.ceil(xqTaoQty / fbTaoQty);//生成出库单数量
for (int i = 0; i < chkQty; i++) { for (int i = 0; i < chkQty; i++) {
Pick pick = pickService.createPick(gd, lineNo.getAndIncrement(), code); Pick pick = pickService.createPick(gd, lineNo.getAndIncrement(), code, gdDetails.get(0).getStation());
pickDetailService.createPickDetail(pick, gdDetails); pickDetailService.createPickDetail(pick, gdDetails);
} }
}); });

View File

@ -157,7 +157,7 @@ public class PickDetailServiceImpl implements PickDetailService {
Point startPoint = inv.getPoint();//起始点位 Point startPoint = inv.getPoint();//起始点位
//判断任务起始点位是否有任务 //判断任务起始点位是否有任务
if (taskRepository.existsByTask(startPoint.getId())) { if (taskRepository.existsByTask(startPoint.getId())>=1) {
return pick.getCode() + "出库单;" + item.getCode() + "起始点位有任务,请先完成任务!"; return pick.getCode() + "出库单;" + item.getCode() + "起始点位有任务,请先完成任务!";
} }
if (unQty == 0) { if (unQty == 0) {

View File

@ -15,11 +15,9 @@
*/ */
package com.youchain.businessdata.service.impl; package com.youchain.businessdata.service.impl;
import com.youchain.basicdata.domain.Point;
import com.youchain.businessdata.domain.Gd; import com.youchain.businessdata.domain.Gd;
import com.youchain.businessdata.domain.GdDetail; import com.youchain.businessdata.domain.GdDetail;
import com.youchain.businessdata.domain.Pick; import com.youchain.businessdata.domain.Pick;
import com.youchain.businessdata.domain.PickDetail;
import com.youchain.utils.*; import com.youchain.utils.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import com.youchain.businessdata.repository.PickRepository; import com.youchain.businessdata.repository.PickRepository;
@ -38,7 +36,6 @@ import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* @author huojin * @author huojin
@ -157,12 +154,12 @@ public class PickServiceImpl implements PickService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Pick createPick(Gd gd, int lineNo, String cpCodeOrpCode) { public Pick createPick(Gd gd, int lineNo, String cpCodeOrpCode, String station) {
Pick pick = new Pick(); Pick pick = new Pick();
pick.setLineNo(lineNo); pick.setLineNo(lineNo);
pick.setCode(gd.getCode() + "_" + lineNo); pick.setCode(gd.getCode() + "_" + lineNo);
pick.setGdCode(gd.getCode()); pick.setGdCode(gd.getCode());
pick.setStation(gd.getStation()); pick.setStation(station);
pick.setCpCodeOrDpCode(cpCodeOrpCode); pick.setCpCodeOrDpCode(cpCodeOrpCode);
pick.setStatus(BizStatus.OPEN); pick.setStatus(BizStatus.OPEN);
pick.setIsCall(false); pick.setIsCall(false);