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
public class ItemDate {
@ApiModelProperty(value ="行号",required = true,example = "行号")
@ApiModelProperty(value = "行号", required = true, example = "行号")
int lineNo;
@ApiModelProperty(value ="物料代码",required = true,example = "物料代码")
@ApiModelProperty(value = "需求工位", required = true)
String station;
@ApiModelProperty(value = "物料代码", required = true, example = "物料代码")
String itemCode;
@ApiModelProperty(value ="物料名称",required = true,example = "物料名称")
@ApiModelProperty(value = "物料名称", required = true, example = "物料名称")
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
public class Yclbl {
@ApiModelProperty(value ="任务号",required = true,example = "任务号")
@ApiModelProperty(value = "任务号", required = true, example = "任务号")
String taskCode;
@ApiModelProperty(value ="工单号",required = true,example = "工单号")
@ApiModelProperty(value = "工单号", required = true, example = "工单号")
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;
@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;
@ApiModelProperty(value ="总成明细",required = true)
@ApiModelProperty(value = "总成明细", required = true)
Set<ZcData> blzc;
@ApiModelProperty(value ="单品明细",required = true)
@ApiModelProperty(value = "单品明细", required = true)
Set<ItemDate> blzcmx;
}

View File

@ -8,16 +8,22 @@ import java.util.Set;
@Data
public class ZcData {
@ApiModelProperty(value ="行号",required = true,example = "行号")
@ApiModelProperty(value = "行号", required = true, example = "行号")
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;
@ApiModelProperty(value = "需求工位", required = true)
String station;
}

View File

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

View File

@ -25,6 +25,7 @@ import com.youchain.basicdata.service.ItemService;
import com.youchain.basicdata.service.PointService;
import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.repository.AsnDetailRepository;
import com.youchain.businessdata.repository.TaskRepository;
import com.youchain.businessdata.service.*;
import com.youchain.utils.*;
import lombok.RequiredArgsConstructor;
@ -43,6 +44,7 @@ import org.springframework.data.domain.Pageable;
import java.sql.Timestamp;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.servlet.http.HttpServletResponse;
@ -61,8 +63,7 @@ public class StockServiceImpl implements StockService {
private final StockRepository stockRepository;
private final AsnDetailRepository asnDetailRepository;
private final StockMapper stockMapper;
private final EntityManager entityMapper;
private final TaskRepository taskRepository;
private final AgvTaskService agvTaskService;
private final ItemService itemService;
private final InventoryService inventoryService;
@ -72,7 +73,8 @@ public class StockServiceImpl implements StockService {
private final PointService pointService;
private final TaskService taskService;
private final StockTypeToAreaMap stockTypeToAreaMap;
private final StockMapper stockMapper;
private final EntityManager entityMapper;
@Override
public Map<String, Object> queryAll(StockQueryCriteria criteria, Pageable pageable) {
@ -275,6 +277,7 @@ public class StockServiceImpl implements StockService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public String scanMo(String stockCode, String mo) {
Map<String, String> map = parseString(mo);//解析二维码
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);
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getOrderNumber());//生成Itemkey
createTask(item, itemKey, asnDetail, stock, null, null, null);//生成Task任务
stock.setStatus(BaseStatus.USED);
update(stock);
return boxNumber;
}
@ -303,19 +308,39 @@ public class StockServiceImpl implements StockService {
@Transactional(rollbackFor = Exception.class)
public void materialIn(String stockCode, Set boxNumbers, String pointCode) {
Stock stock = validateStock(stockCode);//验证容器
if (boxNumbers.isEmpty()) {
throw new RuntimeException("请扫描箱号!");
}
Point srcPoint = validateSrcPoint(pointCode);//验证点位
String srcPointAreaName = srcPoint.getArea().getCode();
if (!isValidMCArea(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());
Point endPoint = validateEndPoint(null, areaCode);//验证目标点位
Point endPoint = validateEndPoint(asnDetailList.get(0).getItem(), areaCode);//验证目标点位
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);//更新容器和点位状态
}
@ -385,15 +410,24 @@ public class StockServiceImpl implements StockService {
}
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) {
if (!asnDetail.getItem().getCode().equals(item.getCode())) {
throw new RuntimeException(stock.getCode() + "托盘已装入" + asnDetail.getItem().getCode() + "物料,扫描物料" + item.getCode() + "不一致!");
}
}
}
}
private Point validateSrcPoint(String pointCode) {
@ -434,8 +468,9 @@ public class StockServiceImpl implements StockService {
agvTaskService.sendAgvTaskImpl(agvTask);
}
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);
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 == null ? null : srcPoint.getCode(), endPoint == null ? null : endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept(), agvTask);
taskService.create(task);
return task;
}

View File

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

View File

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

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.businessdata.repository;
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 java.util.List;
import java.util.Set;
/**
* @website https://eladmin.vip
* @author hjl
* @date 2023-08-14
**/
* @author hjl
* @website https://eladmin.vip
* @date 2023-08-14
**/
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);
@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
* @param code
* @param name
* @param station
* @return
*/
@Query(value = " FROM Gd g WHERE g.code=?1 and g.name=?2 and g.station=?3 ")
Gd findByGdList(String code, String name, String station);
@Query(value = " FROM Gd g WHERE g.code=?1 and g.name=?2 ")
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.Map;
import java.util.Set;
/**
* @author houjianlan
@ -30,14 +31,24 @@ import java.util.Map;
* @date 2023-08-16
**/
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
*
* @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);
@Query(value = " select count(t.id) FROM Task t WHERE t.taskType='PICK' and t.taskStatus not in ('FINISH') and t.srcPoint.id=?1 ")
int existsByTask(Long srcPointId);
}

View File

@ -96,10 +96,9 @@ public interface GdService {
*
* @param orderNo
* @param taskCode
* @param station
* @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
*
* 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.businessdata.service;
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.PickQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description
* @author huojin
* @date 2024-06-11
**/
* @author huojin
* @website https://eladmin.vip
* @description
* @date 2024-06-11
**/
public interface PickService {
/**
*
* @param criteria
* @param pageable
* @return Map<String,Object>
*/
Map<String,Object> queryAll(PickQueryCriteria criteria, Pageable pageable);
*
*
* @param criteria
* @param pageable
* @return Map<String, Object>
*/
Map<String, Object> queryAll(PickQueryCriteria criteria, Pageable pageable);
/**
*
* @param criteria
* @return List<PickDto>
*/
*
*
* @param criteria
* @return List<PickDto>
*/
List<PickDto> queryAll(PickQueryCriteria criteria);
/**
* ID
*
* @param id ID
* @return PickDto
*/
PickDto findById(Long id);
/**
*
* @param resources /
* @return PickDto
*/
*
*
* @param resources /
* @return PickDto
*/
PickDto create(Pick resources);
/**
*
* @param resources /
*/
*
*
* @param resources /
*/
void update(Pick resources);
/**
*
* @param ids /
*/
*
*
* @param ids /
*/
void deleteAll(Long[] ids);
/**
*
* @param all
* @param response /
* @throws IOException /
*/
*
*
* @param all
* @param response /
* @throws IOException /
*/
void download(List<PickDto> all, HttpServletResponse response) throws IOException;
Pick save(GdDetail gdDetail, int no);
/**
*
*
* @param gdNo->
* @param completeCode->
* @param station->
* @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 itemCode->
* @param station->
* @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 lineNo->
* @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.businessdata.domain.Gd;
import lombok.Data;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @author huojin
* @website https://eladmin.vip
* @description /
* @author huojin
* @date 2024-06-06
**/
@Data
public class GdDetailDto implements Serializable {
/** ID */
/**
* ID
*/
private Long id;
/** 创建人 */
/**
*
*/
private String createBy;
/** 修改人 */
/**
*
*/
private String updateBy;
/** 创建时间 */
/**
*
*/
private Timestamp createTime;
/** 修改时间 */
/**
*
*/
private Timestamp updateTime;
/** 行号 */
/**
*
*/
private int lineNo;
/** 关联物料 */
/**
*
*/
private Long itemId;
private Item item;
/** 订单数量 */
/**
*
*/
private Long itemQty;
/** 总成代码 */
/**
*
*/
private Long bigItemId;
private BigItem bigItem;
/** 总成套数 */
/**
*
*/
private Long bigItemQty;
private Gd gd;
private Double orderQty;
/** 单据类型 */
/**
*
*/
private String orderType;
/**
*
*/
private String station;
}

View File

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

View File

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

View File

@ -39,7 +39,4 @@ public class GdQueryCriteria{
@Query
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);//入库
break;
case AreaNameDic.FBQ:
handleFBQ(taskList, endPoint);//备料完成
handleFBQ(taskList, stock, endPoint);//备料完成
case AreaNameDic.JLQ:
// handleJL(taskList, endPoint, stock);//满车出库
break;
@ -571,37 +571,17 @@ public class AgvTaskServiceImpl implements AgvTaskService {
*
* @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任务状态*/
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);
task.setTaskStatus(BizStatus.FINISH);
taskRepository.save(task);
}
}
@ -634,16 +614,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
* @param 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.setQuantity(inventory.getQuantity() + task.getPlanQty());

View File

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

View File

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

View File

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