no message
parent
ae7f78db63
commit
e1409df173
|
|
@ -11,7 +11,7 @@ public class BindStock {
|
|||
@ApiModelProperty(value = "容器编号")
|
||||
String stockCode;
|
||||
|
||||
@ApiModelProperty(value = "物料编号")
|
||||
@ApiModelProperty(value = "MO票")
|
||||
String itemCode;
|
||||
|
||||
@ApiModelProperty(value = "点位编号")
|
||||
|
|
|
|||
|
|
@ -29,6 +29,24 @@ public class BydAppController {
|
|||
|
||||
private final StockService stockService;
|
||||
|
||||
@PostMapping("/materialIn")
|
||||
@Log("原材料入库")
|
||||
@ApiOperation("原材料入库")
|
||||
@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 QRCode = bindStock.getItemCode();//Mo票二维码
|
||||
String stockCode = bindStock.getStockCode();//容器编号
|
||||
String pointCode = bindStock.getPointCode();//点位编号
|
||||
stockService.bindContainer(QRCode, stockCode, pointCode);
|
||||
} catch (Exception e) {
|
||||
return badRequest(e.getMessage());
|
||||
}
|
||||
return successRequest("入库成功!");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/containerIn")
|
||||
@Log("容器入场")
|
||||
@ApiOperation("容器入场")
|
||||
|
|
@ -60,22 +78,6 @@ public class BydAppController {
|
|||
return successRequest("出场成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/materialIn")
|
||||
@Log("原材料入库")
|
||||
@ApiOperation("原材料入库")
|
||||
@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 QRCode = bindStock.getItemCode();//Mo票二维码
|
||||
String stockCode = bindStock.getStockCode();//容器编号
|
||||
String pointCode = bindStock.getPointCode();//点位编号
|
||||
stockService.bindContainer(QRCode, stockCode, pointCode);
|
||||
} catch (Exception e) {
|
||||
return badRequest(e.getMessage());
|
||||
}
|
||||
return successRequest("入库成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/callAssemblyLine")
|
||||
@Log("装配线叫料")
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ public interface PickRepository extends JpaRepository<Pick, Long>, JpaSpecificat
|
|||
@Query(value = "SELECT p FROM Pick p WHERE p.id=?1 and p.lineNo=?2")
|
||||
List<Pick> findRepeat(long gdDetailId, int no);
|
||||
|
||||
@Query(value = " FROM Pick p WHERE p.status=?1 ")
|
||||
List<Pick> findByPickStatus(String status);
|
||||
@Query(value = " FROM Pick p WHERE p.status in :status order by p.createTime,p.lineNo ")
|
||||
List<Pick> findByPickStatus(List<String> status);
|
||||
|
||||
@Query(value = " FROM Pick p WHERE p.code=?1 and p.code=?2 and p.code=?3 ")
|
||||
Pick findByPick(String gdNo, String completeCode, String station);
|
||||
|
|
|
|||
|
|
@ -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.RequestData.Yclbl;
|
||||
|
|
@ -20,29 +20,32 @@ import com.youchain.businessdata.domain.Gd;
|
|||
import com.youchain.businessdata.service.dto.GdDto;
|
||||
import com.youchain.businessdata.service.dto.GdQueryCriteria;
|
||||
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-06
|
||||
**/
|
||||
* @author huojin
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @date 2024-06-06
|
||||
**/
|
||||
public interface GdService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(GdQueryCriteria criteria, Pageable pageable);
|
||||
Map<String, Object> queryAll(GdQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param criteria 条件参数
|
||||
* @return List<GdDto>
|
||||
*/
|
||||
|
|
@ -50,6 +53,7 @@ public interface GdService {
|
|||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return GdDto
|
||||
*/
|
||||
|
|
@ -57,6 +61,7 @@ public interface GdService {
|
|||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param resources /
|
||||
* @return GdDto
|
||||
*/
|
||||
|
|
@ -64,31 +69,41 @@ public interface GdService {
|
|||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param resources /
|
||||
*/
|
||||
void update(Gd resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<GdDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
Gd createGd(String orderNo, String taskCode, String station);
|
||||
|
||||
/** 根据工单,申城出库明细*/
|
||||
void addPickDetail(Gd gd);
|
||||
/**
|
||||
* 创建工单
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
* @param taskCode 任务代码
|
||||
* @param station 工位
|
||||
* @return Gd
|
||||
*/
|
||||
Gd createGd(String orderNo, String taskCode, String station);
|
||||
|
||||
/**
|
||||
* 原材料备料
|
||||
*
|
||||
* @param yclbl 原材料备料
|
||||
*/
|
||||
void materialBL(Yclbl yclbl);
|
||||
|
|
|
|||
|
|
@ -127,8 +127,6 @@ public interface PickDetailService {
|
|||
|
||||
PickDetail createPickDetail(Item item, String po);
|
||||
|
||||
void save(Pick pick);
|
||||
|
||||
/**
|
||||
* 创建出库单明细
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.impl;
|
||||
|
||||
import com.youchain.basicdata.domain.BigItem;
|
||||
|
|
@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
|
|
@ -39,11 +40,11 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author huojin
|
||||
* @date 2024-06-06
|
||||
**/
|
||||
* @author huojin
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @date 2024-06-06
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GdDetailServiceImpl implements GdDetailService {
|
||||
|
|
@ -53,21 +54,21 @@ public class GdDetailServiceImpl implements GdDetailService {
|
|||
private final DeptService deptService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(GdDetailQueryCriteria criteria, Pageable pageable){
|
||||
Page<GdDetail> page = gdDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
public Map<String, Object> queryAll(GdDetailQueryCriteria criteria, Pageable pageable) {
|
||||
Page<GdDetail> page = gdDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
return PageUtil.toPage(page.map(gdDetailMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GdDetailDto> queryAll(GdDetailQueryCriteria criteria){
|
||||
return gdDetailMapper.toDto(gdDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
public List<GdDetailDto> queryAll(GdDetailQueryCriteria criteria) {
|
||||
return gdDetailMapper.toDto(gdDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public GdDetailDto findById(Long id) {
|
||||
GdDetail gdDetail = gdDetailRepository.findById(id).orElseGet(GdDetail::new);
|
||||
ValidationUtil.isNull(gdDetail.getId(),"GdDetail","id",id);
|
||||
ValidationUtil.isNull(gdDetail.getId(), "GdDetail", "id", id);
|
||||
return gdDetailMapper.toDto(gdDetail);
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +82,7 @@ public class GdDetailServiceImpl implements GdDetailService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(GdDetail resources) {
|
||||
GdDetail gdDetail = gdDetailRepository.findById(resources.getId()).orElseGet(GdDetail::new);
|
||||
ValidationUtil.isNull( gdDetail.getId(),"GdDetail","id",resources.getId());
|
||||
ValidationUtil.isNull(gdDetail.getId(), "GdDetail", "id", resources.getId());
|
||||
gdDetail.copy(resources);
|
||||
gdDetailRepository.save(gdDetail);
|
||||
}
|
||||
|
|
@ -97,7 +98,7 @@ public class GdDetailServiceImpl implements GdDetailService {
|
|||
public void download(List<GdDetailDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (GdDetailDto gdDetail : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("创建人", gdDetail.getCreateBy());
|
||||
map.put("修改人", gdDetail.getUpdateBy());
|
||||
map.put("创建时间", gdDetail.getCreateTime());
|
||||
|
|
@ -112,29 +113,4 @@ public class GdDetailServiceImpl implements GdDetailService {
|
|||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GdDetail save(int lineNo,Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty,Double orderQty) {
|
||||
GdDetail gdDetail= new GdDetail();
|
||||
List<GdDetail> gdList;
|
||||
if (orderType.equals(BaseStatus.GD_TYPE_DP)){
|
||||
gdList=gdDetailRepository.findRepeat(gd.getId(),null,item.getId(),BaseStatus.GD_TYPE_DP);
|
||||
}else {
|
||||
gdList=gdDetailRepository.findRepeat(gd.getId(),bigItem.getId(),item.getId(),BaseStatus.GD_TYPE_CT);
|
||||
}
|
||||
if (gdList.size()>0){
|
||||
gdDetail=gdList.get(0);
|
||||
}
|
||||
gdDetail.setGd(gd);
|
||||
gdDetail.setLineNo(lineNo);
|
||||
gdDetail.setItem(item);
|
||||
gdDetail.setItemQty(itemQty);
|
||||
gdDetail.setOrderQty(orderQty);
|
||||
gdDetail.setBigItem(bigItem);
|
||||
gdDetail.setBigItemQty(completeQty);
|
||||
gdDetail.setDept(deptService.getDefaultDept());
|
||||
gdDetail.setOrderType(orderType);
|
||||
gdDetailRepository.save(gdDetail);
|
||||
return gdDetail;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,35 +150,7 @@ public class GdServiceImpl implements GdService {
|
|||
return gd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPickDetail(Gd gd) {
|
||||
int no = 1;// 序号
|
||||
while (true) {
|
||||
List<GdDetail> gdDetailList = gdDetailRepository.findByGdAndQty(gd.getId());
|
||||
if (gdDetailList.size() < 1) {
|
||||
break;
|
||||
} else {
|
||||
List<Integer> arr = new ArrayList<Integer>();//已分配过的行号
|
||||
for (GdDetail gdDetail : gdDetailList) {
|
||||
/*本次循环已拆分过 工单明细行*/
|
||||
if (arr.contains(gdDetail.getLineNo())) {
|
||||
continue;
|
||||
}
|
||||
/*生成出库单*/
|
||||
Pick pick = pickService.save(gdDetail, no);
|
||||
/* 去重*/
|
||||
arr.add(gdDetail.getLineNo());
|
||||
no = no + 1;
|
||||
/*生成出库明细*/
|
||||
pickDetailService.save(pick);
|
||||
/*添加 默认目标备料点位*/
|
||||
Point point = pointRepository.getById(2195l);
|
||||
pick.setPoint(point);
|
||||
pickRepository.save(pick);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 原材料备料
|
||||
|
|
|
|||
|
|
@ -133,10 +133,8 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public synchronized String allocate(long id, double quantity, String areaName, Point endPoint) {
|
||||
if (areaName == null) {
|
||||
areaName = "大件存储区,小件存储区";
|
||||
}
|
||||
public synchronized String allocate(long id, double quantity, String areaCode, Point endPoint) {
|
||||
|
||||
PickDetailDto pickDetailDto = findById(id);
|
||||
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
|
||||
ItemDto itemDto = pickDetailDto.getItem();
|
||||
|
|
@ -148,7 +146,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
if (pd.getAllocatedQty() >= pd.getOrderQty()) {
|
||||
return pick.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
||||
}
|
||||
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaName);
|
||||
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaCode);
|
||||
if (Inventorys.isEmpty()) {
|
||||
return pick.getCode() + "出库单;" + item.getCode() + "物料库存不足,请先补充库存!";
|
||||
}
|
||||
|
|
@ -323,42 +321,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Pick pick) {
|
||||
List<GdDetail> gdDetailList;
|
||||
if (pick != null) {
|
||||
/* 成套物料 */
|
||||
gdDetailList = gdDetailRepository.findByBigItem(pick.getId());
|
||||
} else {
|
||||
/* 单品物料*/
|
||||
gdDetailList = new ArrayList<>();
|
||||
}
|
||||
for (GdDetail gdDetail : gdDetailList) {
|
||||
int fb = 1;//封包系数
|
||||
PickDetail pickDetail = new PickDetail();
|
||||
List<PickDetail> pickDetailList = pickDetailRepository.findRepeat(pick.getId(), gdDetail.getItem().getId());
|
||||
if (pickDetailList.size() > 0) {
|
||||
pickDetail = pickDetailList.get(0);
|
||||
}
|
||||
pickDetail.setDept(UserUtils.isDept);
|
||||
pickDetail.setStatus(BizStatus.OPEN);
|
||||
pickDetail.setPick(pick);
|
||||
pickDetail.setItem(gdDetail.getItem());
|
||||
if (gdDetail.getBigItem() == null) {
|
||||
/*如果为单品物料 默认封包系数10*/
|
||||
fb = 10;
|
||||
pickDetail.setOrderQty(1d * fb);
|
||||
} else {
|
||||
pickDetail.setOrderQty(gdDetail.getItemQty() * fb);
|
||||
}
|
||||
pickDetail.setLineNo(fb);
|
||||
pickDetailRepository.save(pickDetail);
|
||||
/*更新待拆分数量*/
|
||||
gdDetail.setOrderQty(gdDetail.getOrderQty() - pickDetail.getOrderQty());
|
||||
gdDetailRepository.save(gdDetail);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createPickDetail(Pick pick, List<GdDetail> gdDetails) {
|
||||
|
|
@ -399,9 +361,10 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
|
||||
List<String> MsgList = new ArrayList<>();//存放提示信息
|
||||
//查询出待分配的pickDetail
|
||||
String areaCode=AreaNameDic.XJQ+","+AreaNameDic.DJQ;
|
||||
List<PickDetail> pickDetails = pickDetailRepository.findByPickDetailNoAllocate(pick.getId());
|
||||
for (PickDetail pickDetail : pickDetails) {
|
||||
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), null, endPoint));
|
||||
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), areaCode, endPoint));
|
||||
}
|
||||
|
||||
/* 更新出库单状态并写入目标点位*/
|
||||
|
|
|
|||
|
|
@ -19,10 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
|
|
@ -55,8 +52,8 @@ public class pickTask {
|
|||
* 定时检测出库单,分配库存
|
||||
*/
|
||||
public void allocatePick() {
|
||||
|
||||
List<Pick> pickList = pickRepository.findByPickStatus(BizStatus.OPEN);
|
||||
List<String> statuses = Arrays.asList(BizStatus.OPEN, BizStatus.ASSIGN);
|
||||
List<Pick> pickList = pickRepository.findByPickStatus(statuses);
|
||||
if (pickList.isEmpty()) {
|
||||
throw new RuntimeException("无待分配的出库单!");
|
||||
} else {
|
||||
|
|
@ -72,7 +69,7 @@ public class pickTask {
|
|||
*/
|
||||
public void pickAgvTask() {
|
||||
/*查询分配完成的出库单*/
|
||||
List<Pick> pickList = pickRepository.findByPickStatus(BizStatus.ALLOCATE);
|
||||
List<Pick> pickList = null;//pickRepository.findByPickStatus(BizStatus.ALLOCATE);
|
||||
for (Pick pick : pickList) {
|
||||
List<Task> taskList = taskRepository.findByPick(pick.getId());
|
||||
for (Task task : taskList) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue