no message
parent
62921aa99c
commit
aedc6cb9ef
|
|
@ -119,11 +119,11 @@ public class PickDetailController {
|
||||||
InventoryQueryCriteria inventoryQueryCriteria = new InventoryQueryCriteria();
|
InventoryQueryCriteria inventoryQueryCriteria = new InventoryQueryCriteria();
|
||||||
double quantityNum = 0;
|
double quantityNum = 0;
|
||||||
if (resources.getPoint() != null) {
|
if (resources.getPoint() != null) {
|
||||||
double qty=inventoryService.getInvQty(resources.getItem().getId(),resources.getPickTicket().getArea().getId(),
|
double qty = inventoryService.getInvQty(resources.getItem().getId(), resources.getPickTicket().getArea().getId(),
|
||||||
resources.getPoint().getId());
|
resources.getPoint().getId());
|
||||||
if(qty<resources.getOrderQty()){
|
if (qty < resources.getOrderQty()) {
|
||||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "库存不足,库存"+qty);
|
throw new BadRequestException(HttpStatus.NOT_FOUND, "库存不足,库存" + qty);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// inventoryQueryCriteria.setAreaName(resources.getPickTicket().getArea().getName());
|
// inventoryQueryCriteria.setAreaName(resources.getPickTicket().getArea().getName());
|
||||||
// inventoryQueryCriteria.setItemCodeOne(resources.getItem().getCode());
|
// inventoryQueryCriteria.setItemCodeOne(resources.getItem().getCode());
|
||||||
|
|
@ -132,12 +132,12 @@ public class PickDetailController {
|
||||||
// quantityNum += (inv.getQuantity()-inv.getQueuedQty());
|
// quantityNum += (inv.getQuantity()-inv.getQueuedQty());
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
//新增加订单数量
|
//新增加订单数量
|
||||||
PickTicket pickTicket = resources.getPickTicket();
|
PickTicket pickTicket = resources.getPickTicket();
|
||||||
pickTicket.setOrderQuantity(pickTicket.getOrderQuantity() + resources.getOrderQty());
|
pickTicket.setOrderQuantity(pickTicket.getOrderQuantity() + resources.getOrderQty());
|
||||||
pickTicketService.update(pickTicket);
|
pickTicketService.update(pickTicket);
|
||||||
resources.setStatus(BizStatus.OPEN);
|
resources.setStatus(BizStatus.OPEN);
|
||||||
PickDetailDto pickDetailDto = pickDetailService.create(resources);
|
PickDetailDto pickDetailDto = pickDetailService.create(resources);
|
||||||
return new ResponseEntity<>("操作成功", HttpStatus.CREATED);
|
return new ResponseEntity<>("操作成功", HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,11 +156,11 @@ public class PickDetailController {
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
public ResponseEntity<Object> deletePickDetail(@RequestBody Long[] ids) {
|
public ResponseEntity<Object> deletePickDetail(@RequestBody Long[] ids) {
|
||||||
//删除时需判断是否有分配
|
//删除时需判断是否有分配
|
||||||
for(Long id:ids){
|
for (Long id : ids) {
|
||||||
PickDetail pickDetail=pickDetailRepository.getById(id);
|
PickDetail pickDetail = pickDetailRepository.getById(id);
|
||||||
if(pickDetail.getAllocatedQty()+pickDetail.getBcQty()>0){
|
if (pickDetail.getAllocatedQty() + pickDetail.getBcQty() > 0) {
|
||||||
return new ResponseEntity<>(pickDetail.getItem().getCode()+"已出单,不允许删除",BAD_REQUEST);
|
return new ResponseEntity<>(pickDetail.getItem().getCode() + "已出单,不允许删除", BAD_REQUEST);
|
||||||
}else{
|
} else {
|
||||||
// pickDetailRepository.deleteById(id);
|
// pickDetailRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -175,61 +175,54 @@ public class PickDetailController {
|
||||||
public synchronized ResponseEntity<Object> allocatePick(@RequestBody Long[] ids) throws Exception {
|
public synchronized ResponseEntity<Object> allocatePick(@RequestBody Long[] ids) throws Exception {
|
||||||
List<Long> picktickIds = Arrays.asList(ids);
|
List<Long> picktickIds = Arrays.asList(ids);
|
||||||
Collections.sort(picktickIds);//升序排序
|
Collections.sort(picktickIds);//升序排序
|
||||||
if (picktickIds.size() > 0) {
|
List<String> msgList = new ArrayList<>();//存放提示信息
|
||||||
try {
|
for (Long picktickId : picktickIds) {
|
||||||
for (Long picktickId : picktickIds) {
|
List<PickDetail> pickDetailList = pickDetailService.queryPickDetailList(picktickId);
|
||||||
List<PickDetail> pickDetailList = pickDetailService.queryPickDetailList(picktickId);
|
for (PickDetail pd : pickDetailList) {
|
||||||
for (PickDetail pd : pickDetailList) {
|
msgList.add(pickDetailService.allocateAll(pd.getId(), pd.getOrderQty() - pd.getAllocatedQty()));
|
||||||
pickDetailService.allocate(pd.getId(), pd.getOrderQty() - pd.getAllocatedQty());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(ApiResult.success(),HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success(msgList.toString(),null), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/sbPickdetail")
|
@PostMapping("/sbPickdetail")
|
||||||
@Log("设变")
|
@Log("设变")
|
||||||
@ApiOperation("设变")
|
@ApiOperation("设变")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> sbPickdetail(@RequestBody HashMap<String,Object> map) {
|
public ResponseEntity<Object> sbPickdetail(@RequestBody HashMap<String, Object> map) {
|
||||||
Long pdId=Long.parseLong(map.get("pdId").toString());
|
Long pdId = Long.parseLong(map.get("pdId").toString());
|
||||||
Double sbQty=Double.parseDouble(map.get("sbQty").toString());
|
Double sbQty = Double.parseDouble(map.get("sbQty").toString());
|
||||||
if(map.get("sbItemCode")==null){
|
if (map.get("sbItemCode") == null) {
|
||||||
throw new BadRequestException("无关联设变");
|
throw new BadRequestException("无关联设变");
|
||||||
}
|
}
|
||||||
String sbItemCode=map.get("sbItemCode").toString();
|
String sbItemCode = map.get("sbItemCode").toString();
|
||||||
Item sbIt=itemRepository.findByCode(sbItemCode);
|
Item sbIt = itemRepository.findByCode(sbItemCode);
|
||||||
PickDetail oldD=pickDetailRepository.getById(pdId);
|
PickDetail oldD = pickDetailRepository.getById(pdId);
|
||||||
double unSb=oldD.getOrderQty()-oldD.getAllocatedQty()-oldD.getBcQty();
|
double unSb = oldD.getOrderQty() - oldD.getAllocatedQty() - oldD.getBcQty();
|
||||||
if(sbIt==null){
|
if (sbIt == null) {
|
||||||
throw new BadRequestException(sbItemCode+"物料不存在");
|
throw new BadRequestException(sbItemCode + "物料不存在");
|
||||||
}
|
}
|
||||||
if(unSb<sbQty){
|
if (unSb < sbQty) {
|
||||||
throw new BadRequestException("需求不足数小于"+sbQty);
|
throw new BadRequestException("需求不足数小于" + sbQty);
|
||||||
}
|
}
|
||||||
oldD.setRemark("设变"+oldD.getOrderQty());
|
oldD.setRemark("设变" + oldD.getOrderQty());
|
||||||
//查询库存是否足够
|
//查询库存是否足够
|
||||||
Double invQty=inventoryService.getInvQty(sbIt.getId(),oldD.getPickTicket().getArea().getId(),null);
|
Double invQty = inventoryService.getInvQty(sbIt.getId(), oldD.getPickTicket().getArea().getId(), null);
|
||||||
if(invQty.intValue()<sbQty.intValue()){
|
if (invQty.intValue() < sbQty.intValue()) {
|
||||||
throw new BadRequestException("库存不足"+invQty.intValue());
|
throw new BadRequestException("库存不足" + invQty.intValue());
|
||||||
}
|
}
|
||||||
//查找对应的BOM
|
//查找对应的BOM
|
||||||
PickTicket pt=oldD.getPickTicket();
|
PickTicket pt = oldD.getPickTicket();
|
||||||
if(pt.getPickedQuantity()>0){
|
if (pt.getPickedQuantity() > 0) {
|
||||||
throw new BadRequestException(pt.getCode()+"已备货,不能设变");
|
throw new BadRequestException(pt.getCode() + "已备货,不能设变");
|
||||||
}
|
}
|
||||||
Area shArea=pt.getShArea();
|
Area shArea = pt.getShArea();
|
||||||
List<BomAccount> bomList=bomAccountRepository.getItemBomList(sbIt.getId());
|
List<BomAccount> bomList = bomAccountRepository.getItemBomList(sbIt.getId());
|
||||||
if(bomList.size()<=0){
|
if (bomList.size() <= 0) {
|
||||||
throw new BadRequestException(sbIt.getCode()+"找不到对应的Bom工位清单"+sbQty);
|
throw new BadRequestException(sbIt.getCode() + "找不到对应的Bom工位清单" + sbQty);
|
||||||
}
|
}
|
||||||
BomAccount bomAccount=bomList.get(0);
|
BomAccount bomAccount = bomList.get(0);
|
||||||
PickDetail newD= pickDetailService.createPickDetail(pt,sbIt,oldD.getPo(),sbQty,oldD.getSupplier());
|
PickDetail newD = pickDetailService.createPickDetail(pt, sbIt, oldD.getPo(), sbQty, oldD.getSupplier());
|
||||||
newD.setRemark("设变");
|
newD.setRemark("设变");
|
||||||
newD.setSourceId(oldD.getId());
|
newD.setSourceId(oldD.getId());
|
||||||
newD.setBomId(bomAccount.getId());
|
newD.setBomId(bomAccount.getId());
|
||||||
|
|
@ -237,7 +230,7 @@ public class PickDetailController {
|
||||||
newD.setSupplier(bomAccount.getSupplier());
|
newD.setSupplier(bomAccount.getSupplier());
|
||||||
newD.setPoint(bomAccount.getZPoint());
|
newD.setPoint(bomAccount.getZPoint());
|
||||||
pickDetailService.allocate(newD.getId(), newD.getOrderQty() - newD.getAllocatedQty());
|
pickDetailService.allocate(newD.getId(), newD.getOrderQty() - newD.getAllocatedQty());
|
||||||
oldD.setOrderQty(oldD.getOrderQty()-sbQty);
|
oldD.setOrderQty(oldD.getOrderQty() - sbQty);
|
||||||
oldD.setSourceId(newD.getId());
|
oldD.setSourceId(newD.getId());
|
||||||
pickDetailService.update(oldD);
|
pickDetailService.update(oldD);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|
@ -247,7 +240,7 @@ public class PickDetailController {
|
||||||
@Log("取消分配")
|
@Log("取消分配")
|
||||||
@ApiOperation("取消分配")
|
@ApiOperation("取消分配")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public synchronized ResponseEntity<Object> cancelAllocate(@RequestBody Long[] ids) {
|
public synchronized ResponseEntity<Object> cancelAllocate(@RequestBody Long[] ids) {
|
||||||
List<Long> pickDetailIds = Arrays.asList(ids);
|
List<Long> pickDetailIds = Arrays.asList(ids);
|
||||||
if (pickDetailIds.size() > 0) {
|
if (pickDetailIds.size() > 0) {
|
||||||
for (Long id : pickDetailIds) {
|
for (Long id : pickDetailIds) {
|
||||||
|
|
@ -332,22 +325,22 @@ public class PickDetailController {
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> autoBcbl() {
|
public ResponseEntity<Object> autoBcbl() {
|
||||||
BillType bt=billTypeRepository.findByName(BaseStatus.BT_BCBL);
|
BillType bt = billTypeRepository.findByName(BaseStatus.BT_BCBL);
|
||||||
if(bt==null){
|
if (bt == null) {
|
||||||
return new ResponseEntity<>("维护波次补料类型", BAD_REQUEST);
|
return new ResponseEntity<>("维护波次补料类型", BAD_REQUEST);
|
||||||
}
|
}
|
||||||
List<AutomaticPlanning> plans=automaticPlanningRepository.getAll();
|
List<AutomaticPlanning> plans = automaticPlanningRepository.getAll();
|
||||||
if(plans.size()>0){
|
if (plans.size() > 0) {
|
||||||
AutomaticPlanning plan=plans.get(0);
|
AutomaticPlanning plan = plans.get(0);
|
||||||
Date blDate=plan.getJhDate();
|
Date blDate = plan.getJhDate();
|
||||||
blDate=new Date();
|
blDate = new Date();
|
||||||
// for(AutomaticPlanning plan:plans){
|
// for(AutomaticPlanning plan:plans){
|
||||||
//得到出库单的出库库区
|
//得到出库单的出库库区
|
||||||
List<Object[]> outAreaGcs=pickTicketRepository.queryBhCkAreas(DateUtil.dateYmd(plan.getJhDate()));
|
List<Object[]> outAreaGcs = pickTicketRepository.queryBhCkAreas(DateUtil.dateYmd(plan.getJhDate()));
|
||||||
for(Object[] outAreaGc:outAreaGcs) {
|
for (Object[] outAreaGc : outAreaGcs) {
|
||||||
Long outAreaId=Long.parseLong(outAreaGc[0].toString());
|
Long outAreaId = Long.parseLong(outAreaGc[0].toString());
|
||||||
String gc=outAreaGc[1].toString();
|
String gc = outAreaGc[1].toString();
|
||||||
List<Object[]> objs = pickDetailService.getQueryBcbl(blDate,outAreaId,gc);
|
List<Object[]> objs = pickDetailService.getQueryBcbl(blDate, outAreaId, gc);
|
||||||
if (objs.size() > 0) {
|
if (objs.size() > 0) {
|
||||||
Area outArea = areaRepository.getById(outAreaId);
|
Area outArea = areaRepository.getById(outAreaId);
|
||||||
PickTicket pickTicket = pickTicketService.storePick(bt, null, outArea, "大", "波次补料");
|
PickTicket pickTicket = pickTicketService.storePick(bt, null, outArea, "大", "波次补料");
|
||||||
|
|
@ -381,7 +374,7 @@ public class PickDetailController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>("补料成功",HttpStatus.OK);
|
return new ResponseEntity<>("补料成功", HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.AutomaticPlanning;
|
import com.youchain.basicdata.domain.AutomaticPlanning;
|
||||||
|
|
@ -34,73 +34,87 @@ 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 2023-08-16
|
* @date 2023-08-16
|
||||||
**/
|
**/
|
||||||
public interface PickDetailService {
|
public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
* @param criteria 条件
|
*
|
||||||
* @param pageable 分页参数
|
* @param criteria 条件
|
||||||
* @return Map<String,Object>
|
* @param pageable 分页参数
|
||||||
*/
|
* @return Map<String, Object>
|
||||||
Map<String,Object> queryAll(PickDetailQueryCriteria criteria, Pageable pageable);
|
*/
|
||||||
|
Map<String, Object> queryAll(PickDetailQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
* @param criteria 条件参数
|
*
|
||||||
* @return List<PickDetailDto>
|
* @param criteria 条件参数
|
||||||
*/
|
* @return List<PickDetailDto>
|
||||||
|
*/
|
||||||
List<PickDetailDto> queryAll(PickDetailQueryCriteria criteria);
|
List<PickDetailDto> queryAll(PickDetailQueryCriteria criteria);
|
||||||
|
|
||||||
List<PickDetailZscDto> queryZscAll(PickDetailQueryCriteria criteria);
|
List<PickDetailZscDto> queryZscAll(PickDetailQueryCriteria criteria);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return PickDetailDto
|
* @return PickDetailDto
|
||||||
*/
|
*/
|
||||||
PickDetailDto findById(Long id);
|
PickDetailDto findById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
* @param resources /
|
*
|
||||||
* @return PickDetailDto
|
* @param resources /
|
||||||
*/
|
* @return PickDetailDto
|
||||||
|
*/
|
||||||
PickDetailDto create(PickDetail resources);
|
PickDetailDto create(PickDetail resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
* @param resources /
|
*
|
||||||
*/
|
* @param resources /
|
||||||
|
*/
|
||||||
void update(PickDetail resources);
|
void update(PickDetail resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
* @param ids /
|
*
|
||||||
*/
|
* @param ids /
|
||||||
|
*/
|
||||||
void deleteAll(Long[] ids);
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除出库明细更新数据
|
* 删除出库明细更新数据
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
void deletePickDetail(Long id);
|
void deletePickDetail(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出数据
|
* 导出数据
|
||||||
* @param all 待导出的数据
|
*
|
||||||
* @param response /
|
* @param all 待导出的数据
|
||||||
* @throws Exception /
|
* @param response /
|
||||||
*/
|
* @throws Exception /
|
||||||
|
*/
|
||||||
void download(List<PickDetailZscDto> all, HttpServletResponse response) throws Exception, Exception;
|
void download(List<PickDetailZscDto> all, HttpServletResponse response) throws Exception, Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分配
|
* 分配
|
||||||
*/
|
*/
|
||||||
void allocate(long id,double quantity);
|
void allocate(long id, double quantity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配
|
||||||
|
*/
|
||||||
|
String allocateAll(long id, double quantity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消分配
|
* 取消分配
|
||||||
|
|
@ -109,12 +123,14 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计数量
|
* 统计数量
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
long count();
|
long count();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dto转实体
|
* Dto转实体
|
||||||
|
*
|
||||||
* @param pickDetailDto
|
* @param pickDetailDto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -122,6 +138,7 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动生成明细
|
* 自动生成明细
|
||||||
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @param item
|
* @param item
|
||||||
* @param po
|
* @param po
|
||||||
|
|
@ -129,36 +146,40 @@ public interface PickDetailService {
|
||||||
* @param supplier
|
* @param supplier
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PickDetail createPickDetail(PickTicket pt, Item item, String po, double qty,String supplier);
|
PickDetail createPickDetail(PickTicket pt, Item item, String po, double qty, String supplier);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 未分配的出库明细集合
|
* 未分配的出库明细集合
|
||||||
|
*
|
||||||
* @param picktickId
|
* @param picktickId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PickDetail> queryPickDetailList(long picktickId);
|
List<PickDetail> queryPickDetailList(long picktickId);
|
||||||
|
|
||||||
Map<String,Object> queryPickDetailAll(PickDetailQueryCriteria criteria, Pageable pageable);
|
Map<String, Object> queryPickDetailAll(PickDetailQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取补货需求明细
|
* 获取补货需求明细
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Object[]> getQueryBcbl(Date blDate, Long ckAreaId, String gc);
|
List<Object[]> getQueryBcbl(Date blDate, Long ckAreaId, String gc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 得到组合最大的备货需求数
|
* 得到组合最大的备货需求数
|
||||||
|
*
|
||||||
* @param picktickId
|
* @param picktickId
|
||||||
* @param largeClass
|
* @param largeClass
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Double getMaxBomQty(long picktickId,String largeClass);
|
Double getMaxBomQty(long picktickId, String largeClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 得到组合所有叫料明细
|
* 得到组合所有叫料明细
|
||||||
|
*
|
||||||
* @param picktickId
|
* @param picktickId
|
||||||
* @param largeClass
|
* @param largeClass
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PickDetail> getBomList(long picktickId,String largeClass);
|
List<PickDetail> getBomList(long picktickId, String largeClass);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
if (pd.getOrderQty() - pd.getAllocatedQty() == 0) {
|
if (pd.getOrderQty() - pd.getAllocatedQty() == 0) {
|
||||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "已分配,请勿重复操作!");
|
throw new BadRequestException(HttpStatus.NOT_FOUND, "已分配,请勿重复操作!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Long zzkwId = null;
|
Long zzkwId = null;
|
||||||
if (pd.getPoint() != null && pickTicket.getArea().getBexb()) {
|
if (pd.getPoint() != null && pickTicket.getArea().getBexb()) {
|
||||||
zzkwId = pd.getPoint().getId();
|
zzkwId = pd.getPoint().getId();
|
||||||
|
|
@ -188,40 +189,93 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护发货暂存区");
|
throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护发货暂存区");
|
||||||
}
|
}
|
||||||
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(), zzkwId);
|
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(), zzkwId);
|
||||||
if (invs.size() > 0) {
|
double allocateQty = 0;
|
||||||
double allocateQty = 0;
|
double unQty = quantity;//未分配数量
|
||||||
double unQty = quantity;//未分配数量
|
for (Inventory inv : invs) {
|
||||||
for (Inventory inv : invs) {
|
Point startPoint = inv.getPoint();//原库位
|
||||||
Point startPoint = inv.getPoint();//原库位
|
if (unQty <= 0) {
|
||||||
if (unQty <= 0) {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
allocateQty = inv.getQuantity() - inv.getQueuedQty();//库存可用数量
|
|
||||||
if (allocateQty <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (unQty < allocateQty) {
|
|
||||||
allocateQty = unQty;
|
|
||||||
}
|
|
||||||
inv.setQueuedQty(inv.getQueuedQty() + allocateQty);
|
|
||||||
inventoryRepository.save(inv);
|
|
||||||
unQty -= allocateQty;
|
|
||||||
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
|
|
||||||
pickDetailRepository.save(pd);
|
|
||||||
pickTicket.setAllocatedQuantity(pickTicket.getAllocatedQuantity() + allocateQty);
|
|
||||||
if (pickTicket.getAllocatedQuantity() > 0) {
|
|
||||||
pickTicket.setStatus(BizStatus.ALLOCATE);
|
|
||||||
}
|
|
||||||
//备货表上出单日期(审核写)
|
|
||||||
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
|
|
||||||
pickTicketRepository.save(pickTicket);
|
|
||||||
taskService.storeTask(null, pd, pickTicket.getArea(), inv.getItemKey(), startPoint, endPoint, allocateQty);
|
|
||||||
}
|
}
|
||||||
|
allocateQty = inv.getQuantity() - inv.getQueuedQty();//库存可用数量
|
||||||
|
if (allocateQty <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (unQty < allocateQty) {
|
||||||
|
allocateQty = unQty;
|
||||||
|
}
|
||||||
|
inv.setQueuedQty(inv.getQueuedQty() + allocateQty);
|
||||||
|
inventoryRepository.save(inv);
|
||||||
|
unQty -= allocateQty;
|
||||||
|
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
|
||||||
|
pickDetailRepository.save(pd);
|
||||||
|
pickTicket.setAllocatedQuantity(pickTicket.getAllocatedQuantity() + allocateQty);
|
||||||
|
if (pickTicket.getAllocatedQuantity() > 0) {
|
||||||
|
pickTicket.setStatus(BizStatus.ALLOCATE);
|
||||||
|
}
|
||||||
|
//备货表上出单日期(审核写)
|
||||||
|
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
|
||||||
|
pickTicketRepository.save(pickTicket);
|
||||||
|
taskService.storeTask(null, pd, pickTicket.getArea(), inv.getItemKey(), startPoint, endPoint, allocateQty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public String allocateAll(long id, double quantity) {
|
||||||
|
PickDetailDto pickDetailDto = findById(id);
|
||||||
|
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
|
||||||
|
PickTicket pickTicket = pd.getPickTicket();
|
||||||
|
ItemDto itemDto = pickDetailDto.getItem();
|
||||||
|
Item item = itemService.toEntity(itemDto);
|
||||||
|
if (pd.getOrderQty() - pd.getAllocatedQty() == 0) {
|
||||||
|
return pickTicket.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
||||||
|
}
|
||||||
|
Long zzkwId = null;
|
||||||
|
if (pd.getPoint() != null && pickTicket.getArea().getBexb()) {
|
||||||
|
zzkwId = pd.getPoint().getId();
|
||||||
|
}
|
||||||
|
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(), zzkwId);
|
||||||
|
if (invs.isEmpty()) {
|
||||||
|
return item.getCode() + "物料库存不足,请先补充库存!";
|
||||||
|
}
|
||||||
|
|
||||||
|
Point endPoint = pointService.getPoint("FHQ", null, null, null);//目标库位
|
||||||
|
if (endPoint == null) {
|
||||||
|
return "请维护发货暂存区!";
|
||||||
|
}
|
||||||
|
double allocateQty = 0;
|
||||||
|
double unQty = quantity;//未分配数量
|
||||||
|
for (Inventory inv : invs) {
|
||||||
|
Point startPoint = inv.getPoint();//原库位
|
||||||
|
if (unQty <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
allocateQty = inv.getQuantity() - inv.getQueuedQty();//库存可用数量
|
||||||
|
if (allocateQty <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (unQty < allocateQty) {
|
||||||
|
allocateQty = unQty;
|
||||||
|
}
|
||||||
|
inv.setQueuedQty(inv.getQueuedQty() + allocateQty);
|
||||||
|
inventoryRepository.save(inv);
|
||||||
|
unQty -= allocateQty;
|
||||||
|
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
|
||||||
|
pickDetailRepository.save(pd);
|
||||||
|
pickTicket.setAllocatedQuantity(pickTicket.getAllocatedQuantity() + allocateQty);
|
||||||
|
if (pickTicket.getAllocatedQuantity() > 0) {
|
||||||
|
pickTicket.setStatus(BizStatus.ALLOCATE);
|
||||||
|
}
|
||||||
|
//备货表上出单日期(审核写)
|
||||||
|
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
|
||||||
|
pickTicketRepository.save(pickTicket);
|
||||||
|
taskService.storeTask(null, pd, pickTicket.getArea(), inv.getItemKey(), startPoint, endPoint, allocateQty);
|
||||||
|
}
|
||||||
|
return item.getCode() + "物料分配成功!";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue