no message
parent
28286abf32
commit
62921aa99c
|
|
@ -189,7 +189,7 @@ public class PickDetailController {
|
||||||
} else {
|
} else {
|
||||||
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
|
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")
|
@PostMapping("/sbPickdetail")
|
||||||
|
|
|
||||||
|
|
@ -152,12 +152,11 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
String hql = " from Inventory inv where 1=1 " +
|
String hql = " from Inventory inv where 1=1 " +
|
||||||
" and inv.itemKey.item.id=" + itemId + " " +
|
" and inv.itemKey.item.id=" + itemId + " " +
|
||||||
" and inv.area.id=" + areaId + " " +
|
" and inv.area.id=" + areaId + " " +
|
||||||
" and inv.quantity-inv.queuedQty>0 ";
|
" and inv.quantity-inv.queuedQty>0" +
|
||||||
|
" and inv.status='已入库' ";
|
||||||
if (zzkwId != null) {
|
if (zzkwId != null) {
|
||||||
hql += " and inv.zzkw.id=" + zzkwId;
|
hql += " and inv.zzkw.id=" + zzkwId;
|
||||||
hql += "and inv.point.type in ('" + BaseStatus.HCKW + "','" + BaseStatus.ZZKW + "')";
|
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 ";
|
hql += " order by inv.itemKey.propC1 asc ";
|
||||||
Query query = entityManager.createQuery(hql);
|
Query query = entityManager.createQuery(hql);
|
||||||
|
|
|
||||||
|
|
@ -176,26 +176,23 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
PickTicket pickTicket = pd.getPickTicket();
|
PickTicket pickTicket = pd.getPickTicket();
|
||||||
ItemDto itemDto = pickDetailDto.getItem();
|
ItemDto itemDto = pickDetailDto.getItem();
|
||||||
Item item = itemService.toEntity(itemDto);
|
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;
|
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();
|
||||||
}
|
}
|
||||||
|
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);
|
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(), zzkwId);
|
||||||
if (invs.size() > 0) {
|
if (invs.size() > 0) {
|
||||||
double allocateQty = 0;
|
double allocateQty = 0;
|
||||||
double unQty = quantity;//未分配数量
|
double unQty = quantity;//未分配数量
|
||||||
double srs=0;
|
|
||||||
for (Inventory inv : invs) {
|
for (Inventory inv : invs) {
|
||||||
Point startPoint = inv.getPoint();//原库位
|
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) {
|
if (unQty <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -203,16 +200,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
if (allocateQty <= 0) {
|
if (allocateQty <= 0) {
|
||||||
continue;
|
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) {
|
if (unQty < allocateQty) {
|
||||||
allocateQty = unQty;
|
allocateQty = unQty;
|
||||||
}
|
}
|
||||||
|
|
@ -228,12 +215,10 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
//备货表上出单日期(审核写)
|
//备货表上出单日期(审核写)
|
||||||
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
|
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
|
||||||
pickTicketRepository.save(pickTicket);
|
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();
|
List<PickDetail> queryResultList = query.getResultList();
|
||||||
return queryResultList;
|
return queryResultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PickDetailZscDto> queryZscAll(PickDetailQueryCriteria criteria) {
|
public List<PickDetailZscDto> queryZscAll(PickDetailQueryCriteria criteria) {
|
||||||
Query query = getQuery(criteria);
|
Query query = getQuery(criteria);
|
||||||
List ts = query
|
List ts = query
|
||||||
|
|
@ -345,6 +331,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
map.put("totalElements", pageCount);
|
map.put("totalElements", pageCount);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Query getQuery(PickDetailQueryCriteria criteria) {
|
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" +
|
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," +
|
"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();
|
// .list();
|
||||||
return queryResultList;
|
return queryResultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getMaxBomQty(long picktickId, String largeClass) {
|
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);
|
Query query = entityMapper.createQuery(hql);
|
||||||
Double result = (Double) query.getResultList().get(0);
|
Double result = (Double) query.getResultList().get(0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PickDetail> getBomList(long picktickId, String largeClass) {
|
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);
|
Query query = entityMapper.createQuery(hql);
|
||||||
List<PickDetail> queryResultList = query.getResultList();
|
List<PickDetail> queryResultList = query.getResultList();
|
||||||
return queryResultList;
|
return queryResultList;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.youchain.basicdata.domain.*;
|
import com.youchain.basicdata.domain.*;
|
||||||
import com.youchain.basicdata.repository.StockRepository;
|
import com.youchain.basicdata.repository.StockRepository;
|
||||||
|
|
@ -541,15 +542,10 @@ public class PickTicketServiceImpl implements PickTicketService {
|
||||||
//拣货数量
|
//拣货数量
|
||||||
pt.setPickedQuantity(pt.getPickedQuantity() + pickQty);
|
pt.setPickedQuantity(pt.getPickedQuantity() + pickQty);
|
||||||
pt.setBhQty(pt.getBhQty() + pickQty);
|
pt.setBhQty(pt.getBhQty() + pickQty);
|
||||||
// if ((pt.getOrderQuantity() - pt.getPickedQuantity()) <= 0) {
|
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{
|
|
||||||
pt.setStatus(BizStatus.PICK_ALL);
|
pt.setStatus(BizStatus.PICK_ALL);
|
||||||
|
} else {
|
||||||
|
pt.setStatus(BizStatus.PICKUP);
|
||||||
}
|
}
|
||||||
this.update(pt);
|
this.update(pt);
|
||||||
if (xpp != null) {
|
if (xpp != null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue