no message

main
HUOJIN\92525 2024-11-08 13:30:25 +08:00
parent 28286abf32
commit 62921aa99c
4 changed files with 147 additions and 164 deletions

View File

@ -189,7 +189,7 @@ public class PickDetailController {
} else {
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity<>(HttpStatus.OK);
return new ResponseEntity<>(ApiResult.success(),HttpStatus.OK);
}
@PostMapping("/sbPickdetail")

View File

@ -152,12 +152,11 @@ public class InventoryServiceImpl implements InventoryService {
String hql = " from Inventory inv where 1=1 " +
" and inv.itemKey.item.id=" + itemId + " " +
" and inv.area.id=" + areaId + " " +
" and inv.quantity-inv.queuedQty>0 ";
" and inv.quantity-inv.queuedQty>0" +
" and inv.status='已入库' ";
if (zzkwId != null) {
hql += " and inv.zzkw.id=" + zzkwId;
hql += "and inv.point.type in ('" + BaseStatus.HCKW + "','" + BaseStatus.ZZKW + "')";
} else {
hql += "and inv.point.type='" + BaseStatus.CH + "'";
}
hql += " order by inv.itemKey.propC1 asc ";
Query query = entityManager.createQuery(hql);

View File

@ -176,26 +176,23 @@ public class PickDetailServiceImpl implements PickDetailService {
PickTicket pickTicket = pd.getPickTicket();
ItemDto itemDto = pickDetailDto.getItem();
Item item = itemService.toEntity(itemDto);
if (pd.getOrderQty() > pd.getAllocatedQty()) {
if (pd.getOrderQty() - pd.getAllocatedQty() == 0) {
throw new BadRequestException(HttpStatus.NOT_FOUND, "已分配,请勿重复操作!");
}
Long zzkwId = null;
if (pd.getPoint() != null && pickTicket.getArea().getBexb()) {
zzkwId = pd.getPoint().getId();
}
Point endPoint = pointService.getPoint("FHQ", null, null, null);//目标库位
if (endPoint == null) {
throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护发货暂存区");
}
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(), zzkwId);
if (invs.size() > 0) {
double allocateQty = 0;
double unQty = quantity;//未分配数量
double srs=0;
for (Inventory inv : invs) {
Point startPoint = inv.getPoint();//原库位
String areaCode="S仓";
if(startPoint.getArea().equals("A仓")){
areaCode="A仓";
}
Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位
if(endPoint==null){
throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护备货暂存区");
}
if (unQty <= 0) {
break;
}
@ -203,16 +200,6 @@ public class PickDetailServiceImpl implements PickDetailService {
if (allocateQty <= 0) {
continue;
}
//本次拣货数小于收容数则按照收容数进行分配,只有正常备货单才走该逻辑
if(pickTicket.getCode().indexOf("BH")>=0||pickTicket.getCode().indexOf("BC")>=0) {
if (unQty < srs) {
if (allocateQty >= srs) {
unQty = srs;
} else {
//unQty = allocateQty;
}
}
}
if (unQty < allocateQty) {
allocateQty = unQty;
}
@ -228,12 +215,10 @@ public class PickDetailServiceImpl implements PickDetailService {
//备货表上出单日期(审核写)
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
pickTicketRepository.save(pickTicket);
Task task = taskService.storeTask(null,pd,pickTicket.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty);
taskService.storeTask(null, pd, pickTicket.getArea(), inv.getItemKey(), startPoint, endPoint, allocateQty);
}
}
} else {
throw new BadRequestException(HttpStatus.NOT_FOUND,"已分配,请勿重复操作!");
}
}
@ -315,6 +300,7 @@ public class PickDetailServiceImpl implements PickDetailService {
List<PickDetail> queryResultList = query.getResultList();
return queryResultList;
}
public List<PickDetailZscDto> queryZscAll(PickDetailQueryCriteria criteria) {
Query query = getQuery(criteria);
List ts = query
@ -345,6 +331,7 @@ public class PickDetailServiceImpl implements PickDetailService {
map.put("totalElements", pageCount);
return map;
}
public Query getQuery(PickDetailQueryCriteria criteria) {
String sql = "SELECT * from (select pd.id,pt.id pt_id,pt.`code`,rk.gc_code,rk.name rk_name,rk.code rk_code,ck.code ck_code,ck.name ck_name,pt.`status`,pt.order_date,it.code item_code,it.name item_name,it.unit,\n" +
"pd.xq_qty,it.extend_d3,pd.prop_c4,(pd.order_qty-pd.allocated_qty-pd.bc_qty) as pure_xq_bz,pd.order_qty,pd.bc_qty," +
@ -429,15 +416,16 @@ public class PickDetailServiceImpl implements PickDetailService {
// .list();
return queryResultList;
}
public Double getMaxBomQty(long picktickId, String largeClass) {
String hql = "select max(pd.orderQty) from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.item.largeClass='"+largeClass+"'";
String hql = "select max(pd.orderQty) from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.item='" + largeClass + "'";
Query query = entityMapper.createQuery(hql);
Double result = (Double) query.getResultList().get(0);
return result;
}
public List<PickDetail> getBomList(long picktickId, String largeClass) {
String hql = " from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.item.largeClass='"+largeClass+"'";
String hql = " from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.item='" + largeClass + "'";
Query query = entityMapper.createQuery(hql);
List<PickDetail> queryResultList = query.getResultList();
return queryResultList;

View File

@ -14,6 +14,7 @@
* limitations under the License.
*/
package com.youchain.businessdata.service.impl;
import com.alibaba.fastjson.JSON;
import com.youchain.basicdata.domain.*;
import com.youchain.basicdata.repository.StockRepository;
@ -541,15 +542,10 @@ public class PickTicketServiceImpl implements PickTicketService {
//拣货数量
pt.setPickedQuantity(pt.getPickedQuantity() + pickQty);
pt.setBhQty(pt.getBhQty() + pickQty);
// if ((pt.getOrderQuantity() - pt.getPickedQuantity()) <= 0) {
// pt.setStatus(BizStatus.PICK_ALL);
// } else {
// pt.setStatus(BizStatus.PICKUP);
// }
if(pickDetailRepository.queryPickQty(pt.getId()).size()>0){
pt.setStatus(BizStatus.PICKUP);
}else{
if ((pt.getOrderQuantity() - pt.getPickedQuantity()) == 0) {
pt.setStatus(BizStatus.PICK_ALL);
} else {
pt.setStatus(BizStatus.PICKUP);
}
this.update(pt);
if (xpp != null) {