|
|
|
@ -3,9 +3,11 @@ package org.dromara.wms.service.impl;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.github.yulichang.wrapper.UpdateJoinWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
@ -33,15 +35,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsOutstockRecordVo returnSelectCode(String code) {
|
|
|
|
|
MPJLambdaWrapper<WmsOutstockRecord> lqw = JoinWrappers.lambda(WmsOutstockRecord.class)
|
|
|
|
|
.selectAll(WmsOutstockRecord.class)
|
|
|
|
|
.select(BaseMaterialInfo::getMaterialCode, BaseMaterialInfo::getMaterialName, BaseMaterialInfo::getMaterialUnit, BaseMaterialInfo::getMaterialSpec)
|
|
|
|
|
.leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, WmsOutstockRecord::getMaterialId)
|
|
|
|
|
.select(WmsBaseLocation::getWarehouseId)
|
|
|
|
|
.leftJoin(WmsBaseLocation.class, WmsBaseLocation::getLocationCode, WmsOutstockRecord::getLocationCode)
|
|
|
|
|
.eq(WmsOutstockRecord::getBatchCode, code)
|
|
|
|
|
.eq(WmsOutstockRecord::getReturnFlag, 0)
|
|
|
|
|
.orderByDesc(WmsOutstockRecord::getCreateTime);
|
|
|
|
|
MPJLambdaWrapper<WmsOutstockRecord> lqw = JoinWrappers.lambda(WmsOutstockRecord.class).selectAll(WmsOutstockRecord.class).select(BaseMaterialInfo::getMaterialCode, BaseMaterialInfo::getMaterialName, BaseMaterialInfo::getMaterialUnit, BaseMaterialInfo::getMaterialSpec).leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, WmsOutstockRecord::getMaterialId).select(WmsBaseLocation::getWarehouseId).leftJoin(WmsBaseLocation.class, WmsBaseLocation::getLocationCode, WmsOutstockRecord::getLocationCode).eq(WmsOutstockRecord::getBatchCode, code).eq(WmsOutstockRecord::getReturnFlag, 0).orderByDesc(WmsOutstockRecord::getCreateTime);
|
|
|
|
|
return wmsOutstockRecordMapper.selectVoOne(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -115,10 +109,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean updataInStoreRecord(WmsHppInStockDetailVo vo) {
|
|
|
|
|
LambdaUpdateWrapper<WmsHppInStockDetail> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
lambdaUpdateWrapper.eq(WmsHppInStockDetail::getObjId, vo.getObjId())
|
|
|
|
|
.set(WmsHppInStockDetail::getStorePlaceId, vo.getStorePlaceId())
|
|
|
|
|
.set(WmsHppInStockDetail::getUpdateTime, DateUtils.getTime())
|
|
|
|
|
.set(WmsHppInStockDetail::getUpdateBy, LoginHelper.getUsername());
|
|
|
|
|
lambdaUpdateWrapper.eq(WmsHppInStockDetail::getObjId, vo.getObjId()).set(WmsHppInStockDetail::getStorePlaceId, vo.getStorePlaceId()).set(WmsHppInStockDetail::getUpdateTime, DateUtils.getTime()).set(WmsHppInStockDetail::getUpdateBy, LoginHelper.getUsername());
|
|
|
|
|
int rows = hppInStockDetailMapper.update(null, lambdaUpdateWrapper);
|
|
|
|
|
if (rows > 0) {
|
|
|
|
|
// System.out.println("更新成功");
|
|
|
|
@ -155,9 +146,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
hppStorageDetailMapper.deleteById(vo.getStorePlaceId());
|
|
|
|
|
} else {
|
|
|
|
|
LambdaUpdateWrapper<WmsHppStorageDetail> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
updateWrapper.eq(WmsHppStorageDetail::getObjId, vo.getObjId())
|
|
|
|
|
.set(WmsHppStorageDetail::getStorageNum, vo.getStorageNum() - vo.getOutNumber())
|
|
|
|
|
.set(WmsHppStorageDetail::getUpdateTime, DateUtils.getTime());
|
|
|
|
|
updateWrapper.eq(WmsHppStorageDetail::getObjId, vo.getObjId()).set(WmsHppStorageDetail::getStorageNum, vo.getStorageNum() - vo.getOutNumber()).set(WmsHppStorageDetail::getUpdateTime, DateUtils.getTime());
|
|
|
|
|
hppStorageDetailMapper.update(updateWrapper);
|
|
|
|
|
}
|
|
|
|
|
WmsHppOutStockDetail outStockDetail = new WmsHppOutStockDetail();
|
|
|
|
@ -206,19 +195,14 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<WmsOutstockDetailVo> outSelectByOrderCode(String orderCode) {
|
|
|
|
|
MPJLambdaWrapper<WmsOutstockDetail> lqw = JoinWrappers.lambda(WmsOutstockDetail.class)
|
|
|
|
|
.selectAll(WmsOutstockDetail.class)
|
|
|
|
|
.select(BaseMaterialInfo::getMaterialUnit, BaseMaterialInfo::getMaterialSpec)
|
|
|
|
|
.leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, WmsOutstockDetail::getMaterialId)
|
|
|
|
|
.eq(WmsOutstockDetail::getOutstockCode, orderCode);
|
|
|
|
|
MPJLambdaWrapper<WmsOutstockDetail> lqw = JoinWrappers.lambda(WmsOutstockDetail.class).selectAll(WmsOutstockDetail.class).select(BaseMaterialInfo::getMaterialUnit, BaseMaterialInfo::getMaterialSpec).leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, WmsOutstockDetail::getMaterialId).eq(WmsOutstockDetail::getOutstockCode, orderCode);
|
|
|
|
|
return wmsOutstockDetailMapper.selectVoList(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsInventoryVo selectInVentoryByBatchCode(String bacthCode, String locationCode) {
|
|
|
|
|
LambdaQueryWrapper<WmsInventory> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
lqw.eq(WmsInventory::getBatchCode, bacthCode)
|
|
|
|
|
.eq(WmsInventory::getLocationCode, locationCode);
|
|
|
|
|
lqw.eq(WmsInventory::getBatchCode, bacthCode).eq(WmsInventory::getLocationCode, locationCode);
|
|
|
|
|
return wmsInventoryMapper.selectVoOne(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -243,7 +227,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
inventoryQty = inventoryQty.subtract(outstockQty);
|
|
|
|
|
if (inventoryQty.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
|
|
wmsInventoryMapper.deleteById(wmsInventory.getInventoryId());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
WmsInventory inventory = new WmsInventory();
|
|
|
|
|
inventory.setInventoryId(wmsInventory.getInventoryId());
|
|
|
|
|
inventory.setInventoryQty(inventoryQty);
|
|
|
|
@ -255,7 +239,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
outstockRecord.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
wmsOutstockRecordMapper.insert(outstockRecord);
|
|
|
|
|
// 修改子表出库数量
|
|
|
|
|
wmsOutstockDetailMapper.updateOutNumberByObjId(wmsInventory.getOutstockDetailId(),outstockRecord.getOutstockQty());
|
|
|
|
|
wmsOutstockDetailMapper.updateOutNumberByObjId(wmsInventory.getOutstockDetailId(), outstockRecord.getOutstockQty());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
@ -263,24 +247,20 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 出库连子表查物料库存
|
|
|
|
|
*
|
|
|
|
|
* @param outstockRecord
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public WmsInventory outSelectInVentoryByBatch(WmsOutstockRecord outstockRecord) {
|
|
|
|
|
MPJLambdaWrapper<WmsInventory> lqw = JoinWrappers.lambda(WmsInventory.class)
|
|
|
|
|
.rightJoin(WmsOutstockDetail.class,WmsOutstockDetail::getMaterialId,WmsInventory::getMaterialId)
|
|
|
|
|
.select(WmsOutstockDetail::getOutstockDetailId)
|
|
|
|
|
.eq(WmsOutstockDetail::getOutstockCode, outstockRecord.getOutstockCode())
|
|
|
|
|
.eq(WmsInventory::getBatchCode, outstockRecord.getBatchCode())
|
|
|
|
|
.eq(WmsInventory::getLocationCode, outstockRecord.getLocationCode());
|
|
|
|
|
MPJLambdaWrapper<WmsInventory> lqw = JoinWrappers.lambda(WmsInventory.class).rightJoin(WmsOutstockDetail.class, WmsOutstockDetail::getMaterialId, WmsInventory::getMaterialId).select(WmsOutstockDetail::getOutstockDetailId).eq(WmsOutstockDetail::getOutstockCode, outstockRecord.getOutstockCode()).eq(WmsInventory::getBatchCode, outstockRecord.getBatchCode()).eq(WmsInventory::getLocationCode, outstockRecord.getLocationCode());
|
|
|
|
|
return wmsInventoryMapper.selectOne(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<StoreInfoVo> selectStoreInfo(String type) {
|
|
|
|
|
|
|
|
|
|
List<StoreInfoVo> list=apiMapper.selectRawStore();
|
|
|
|
|
List<StoreInfoVo> list = apiMapper.selectRawStore();
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
@ -288,9 +268,10 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<WmsBaseLocationVo> storeCheckSelectLocation(String type, Long storeId) {
|
|
|
|
|
List<WmsBaseLocationVo> list= apiMapper.selectRawCheckLocationList(storeId);
|
|
|
|
|
List<WmsBaseLocationVo> list = apiMapper.selectRawCheckLocationList(storeId);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final WmsInventoryCheckMapper wmsInventoryCheckMapper;
|
|
|
|
|
// 查询盘点工单
|
|
|
|
|
|
|
|
|
@ -301,18 +282,18 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
WmsInventoryCheck wmsInventoryCheck = wmsInventoryCheckMapper.selectInventoryCheckOrder();
|
|
|
|
|
WmsInventoryCheck insert = new WmsInventoryCheck();
|
|
|
|
|
if (wmsInventoryCheck == null) {
|
|
|
|
|
insert.setCheckCode("PD"+tag+"001");
|
|
|
|
|
}else {
|
|
|
|
|
insert.setCheckCode("PD" + tag + "001");
|
|
|
|
|
} else {
|
|
|
|
|
String checkCode = wmsInventoryCheck.getCheckCode();
|
|
|
|
|
String lastThreeDigits = checkCode.substring(checkCode.length() - 3);
|
|
|
|
|
int nextNumber = Integer.parseInt(lastThreeDigits) + 1;
|
|
|
|
|
String formattedNumber = String.format("%03d", nextNumber);
|
|
|
|
|
insert.setCheckCode("PD"+tag+formattedNumber);
|
|
|
|
|
insert.setCheckCode("PD" + tag + formattedNumber);
|
|
|
|
|
}
|
|
|
|
|
insert.setPlanWarehouseId(storeId);
|
|
|
|
|
insert.setCreateBy(LoginHelper.getUserId());
|
|
|
|
|
wmsInventoryCheckMapper.insert(insert);
|
|
|
|
|
return wmsInventoryCheck;
|
|
|
|
|
return insert;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -321,13 +302,25 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
lqw.eq(WmsInventory::getLocationCode, locationCode);
|
|
|
|
|
return wmsInventoryMapper.selectVoList(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final WmsInventoryCheckRecordMapper wmsInventoryCheckRecordMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean storeCheckSubmitCheckRecord(WmsInventoryCheckRecord wmsInventoryCheckRecord) {
|
|
|
|
|
wmsInventoryCheckRecord.setCheckStatus(wmsInventoryCheckRecord.getInventoryQty().compareTo(wmsInventoryCheckRecord.getCheckQty())==0 ?"0":"1");
|
|
|
|
|
wmsInventoryCheckRecord.setCheckStatus(
|
|
|
|
|
wmsInventoryCheckRecord.getInventoryQty().compareTo(wmsInventoryCheckRecord.getCheckQty()) == 0 ? "0" : "1");
|
|
|
|
|
wmsInventoryCheckRecord.setCreateBy(LoginHelper.getUsername());
|
|
|
|
|
wmsInventoryCheckRecordMapper.insert(wmsInventoryCheckRecord);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean storeCheckStoreCheckWorkOver(String checkCode) {
|
|
|
|
|
// UpdateJoinWrapper<WmsInventoryCheck> updateWrapper = new UpdateJoinWrapper<>(WmsInventoryCheck.class);
|
|
|
|
|
// updateWrapper.eq(WmsInventoryCheck::getCheckCode,checkCode )
|
|
|
|
|
// .set(WmsInventoryCheck::getCheckStatus, "3")
|
|
|
|
|
// .set(WmsInventoryCheck::getEndTime, DateUtils.getNowDate());
|
|
|
|
|
return apiMapper.updateWmsInventoryCheck(checkCode,3) > 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|