|
@@ -254,7 +254,6 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
// 更新目标库位空闲有货
|
|
|
baseLocationInfoService.updateLocationIdleAndNoEmpty(baseLocationTo.getId(), warehouseId, updateBy);
|
|
|
|
|
|
-
|
|
|
// todo 事务
|
|
|
|
|
|
return AjaxResult.success("操作成功!");
|
|
@@ -448,31 +447,38 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
BeanUtils.copyProperties(lotattDTO, invLotAtt);
|
|
|
//查询lotatt是否存在
|
|
|
String lotnum;
|
|
|
- /*List<InvLotAtt> queryList = invLotAttMapper.selectInvLotAttList(invLotAtt);
|
|
|
+ List<InvLotAtt> queryList = invLotAttMapper.selectInvLotAttList(invLotAtt);
|
|
|
if (queryList != null && queryList.size() > 0) {
|
|
|
invLotAtt = queryList.get(0);
|
|
|
lotnum = invLotAtt.getLotnum();
|
|
|
- } else {*/
|
|
|
- lotnum = idSequenceUtils.generateId("LOTNUMBER");
|
|
|
- invLotAtt.setLotnum(lotnum);
|
|
|
- invLotAtt.setSku(sku);
|
|
|
- invLotAtt.setCustomerId(customerId);
|
|
|
- invLotAtt.setCreateTime(DateUtils.getNowDate());
|
|
|
- invLotAttMapper.insertInvLotAtt(invLotAtt);
|
|
|
- //}
|
|
|
- InvLotLocId invLotLocId = new InvLotLocId();
|
|
|
- invLotLocId.setLotnum(lotnum);
|
|
|
- invLotLocId.setLocationId(locationFrom);
|
|
|
- invLotLocId.setSku(sku);
|
|
|
- invLotLocId.setCustomerId(customerId);
|
|
|
- invLotLocId.setQty(new BigDecimal(qty));
|
|
|
- invLotLocId.setQtyEach(new BigDecimal(qty));
|
|
|
- invLotLocId.setQtyallocated(qtyallocated);
|
|
|
- invLotLocId.setQtyallocatedEach(qtyallocated);
|
|
|
- invLotLocId.setQtypa(BigDecimal.ZERO);
|
|
|
- invLotLocId.setQtyrpin(BigDecimal.ZERO);
|
|
|
- invLotLocId.setCreateTime(new Date());
|
|
|
- invLotLocIdMapper.insertInvLotLocId(invLotLocId);
|
|
|
+ } else {
|
|
|
+ lotnum = idSequenceUtils.generateId("LOTNUMBER");
|
|
|
+ invLotAtt.setLotnum(lotnum);
|
|
|
+ invLotAtt.setSku(sku);
|
|
|
+ invLotAtt.setCustomerId(customerId);
|
|
|
+ invLotAtt.setCreateTime(DateUtils.getNowDate());
|
|
|
+ invLotAttMapper.insertInvLotAtt(invLotAtt);
|
|
|
+ }
|
|
|
+ InvLotLocId query = invLotLocIdMapper.selectInvLotLocIdByKey(lotnum, locationFrom, customerId, sku);
|
|
|
+ if (query != null) {
|
|
|
+ query.setQty(query.getQty().add(BigDecimal.valueOf(qty)));
|
|
|
+ query.setQtyEach(query.getQty());
|
|
|
+ invLotLocIdService.updateInvLotLocId(query);
|
|
|
+ } else {
|
|
|
+ InvLotLocId invLotLocId = new InvLotLocId();
|
|
|
+ invLotLocId.setLotnum(lotnum);
|
|
|
+ invLotLocId.setLocationId(locationFrom);
|
|
|
+ invLotLocId.setSku(sku);
|
|
|
+ invLotLocId.setCustomerId(customerId);
|
|
|
+ invLotLocId.setQty(new BigDecimal(qty));
|
|
|
+ invLotLocId.setQtyEach(new BigDecimal(qty));
|
|
|
+ invLotLocId.setQtyallocated(qtyallocated);
|
|
|
+ invLotLocId.setQtyallocatedEach(qtyallocated);
|
|
|
+ invLotLocId.setQtypa(BigDecimal.ZERO);
|
|
|
+ invLotLocId.setQtyrpin(BigDecimal.ZERO);
|
|
|
+ invLotLocId.setCreateTime(new Date());
|
|
|
+ invLotLocIdMapper.insertInvLotLocId(invLotLocId);
|
|
|
+ }
|
|
|
|
|
|
BaseLocationInfo baseLocationInfo = new BaseLocationInfo();
|
|
|
baseLocationInfo.setId(Long.parseLong(locationFrom));
|
|
@@ -510,13 +516,60 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public AjaxResult invTransferPick(LotattDTO lotattDTO, BigDecimal qty, String palletNoTo) {
|
|
|
+ WmsBoxInfo wmsBoxInfoTo = iWmsBoxInfoService.selectWmsBoxInfoByBoxNo(palletNoTo);
|
|
|
+ InvLotAtt queryAtt = new InvLotAtt();
|
|
|
+ BeanUtils.copyProperties(lotattDTO, queryAtt);
|
|
|
+ List<InvLotLocId> invLotLocIds = invLotLocIdMapper.queryInvByInvLotatt(queryAtt);
|
|
|
+ BigDecimal total = qty;
|
|
|
+ BigDecimal sumQty = BigDecimal.ZERO;
|
|
|
+ if (invLotLocIds != null && invLotLocIds.size() > 0) {
|
|
|
+ for (InvLotLocId inv : invLotLocIds) {
|
|
|
+ BigDecimal currentQtyTotal = inv.getQty().subtract(inv.getQtyallocated());
|
|
|
+ BigDecimal currentQty;
|
|
|
+ if (currentQtyTotal.compareTo(total) == 1) {
|
|
|
+ currentQty = qty;
|
|
|
+ //当前数量大于拣出数
|
|
|
+ } else {
|
|
|
+ currentQty = inv.getQty();
|
|
|
+ //当前数量小于等于拣出数
|
|
|
+ }
|
|
|
+ //目标库位生成新库存
|
|
|
+ LotattDTO newLot = new LotattDTO();
|
|
|
+ BeanUtils.copyProperties(lotattDTO, newLot);
|
|
|
+ newLot.setLotatt07(palletNoTo);
|
|
|
+ invLotLocIdService.initInv(wmsBoxInfoTo.getLocationId().toString(), inv.getSku(), inv.getCustomerId(), currentQty.doubleValue(), newLot, BigDecimal.ZERO);
|
|
|
+
|
|
|
+ //扣减原库存
|
|
|
+ inv.setQty(inv.getQty().subtract(currentQty));
|
|
|
+ inv.setQtyEach(inv.getQty().subtract(currentQty));
|
|
|
+ //inv.setQtyallocated(inv.getQtyallocated().subtract(currentQty));
|
|
|
+ //inv.setQtyallocatedEach(inv.getQtyallocatedEach().subtract(currentQty));
|
|
|
+ invLotLocIdService.updateInvLotLocId(inv);
|
|
|
+
|
|
|
+ sumQty = sumQty.add(currentQty);
|
|
|
+ total = total.subtract(currentQty);
|
|
|
+
|
|
|
+ if (total.compareTo(sumQty) == 0) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("查询不到库存信息");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Double queryInvBySku(String sku, LotattDTO lotattDTO, List<String> zoneIdList) {
|
|
|
return invLotLocIdMapper.queryInvBySku(sku, lotattDTO, zoneIdList);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<InvLotLocId> queryInvOrderBy(String lotnum, String sku, String location, String customerId, LotattDTO lotattDTO) {
|
|
|
+ public List<InvLotLocId> queryInvOrderBy(String lotnum, String sku, String location, String
|
|
|
+ customerId, LotattDTO lotattDTO) {
|
|
|
return invLotLocIdMapper.queryInvOrderBy(lotnum, sku, location, customerId, lotattDTO);
|
|
|
}
|
|
|
|
|
@@ -546,7 +599,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public AjaxResult stockTransferPick(Long locationFrom, Long locationTo, String lotnum, BigDecimal qty, String boxNo) {
|
|
|
+ public AjaxResult stockTransferPick(Long locationFrom, Long locationTo, String lotnum, BigDecimal qty, String
|
|
|
+ boxNo) {
|
|
|
List<InvLotLocId> invLotLocIds = invLotLocIdMapper.selectInvLotLocIdByLotnum(lotnum);
|
|
|
if (invLotLocIds != null && invLotLocIds.size() > 0) {
|
|
|
for (InvLotLocId inv : invLotLocIds) {
|