修改 移库

master
wanghao 3 months ago
parent 1d0fe2f860
commit 52138c0319

@ -5,6 +5,7 @@ import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.dromara.wms.domain.*;
import org.dromara.wms.domain.bo.WmsInstockPrintBo;
import org.dromara.wms.domain.bo.WmsMoveOrderBo;
import org.dromara.wms.domain.bo.WmsReturnOrderBo;
import org.dromara.wms.domain.vo.*;
import org.dromara.wms.service.*;
@ -26,6 +27,8 @@ public class WmsPdaApiController extends BaseController {
private final IWmsHppStorePlaceService wmsHppStorePlaceService;
private final IWmsBaseAreaService baseAreaService;
private final IWmsInstockPrintService wmsInstockPrintService;
private final IWmsInventoryService wmsInventoryService;
private final IWmsMoveOrderService wmsMoveOrderService;
/**
* 退-
@ -49,7 +52,7 @@ public class WmsPdaApiController extends BaseController {
}
/**
* 退
* 退
*/
@PostMapping("/raw/returnSubmit")
public R<Void> rawReturnSubmit(@RequestBody WmsReturnOrderBo bo) {
@ -68,8 +71,12 @@ public class WmsPdaApiController extends BaseController {
}
// 退库入库提交
@PostMapping("/returnStore/submit")
@PostMapping("/returnInstore/submit")
public R<Void> returnStoreSubmit(@RequestBody WmsReturnOrderVo data) {
WmsBaseLocationVo wmsBaseLocationVo = baseLocationService.selectLocationVoByCode(data.getReturnLocationCode());
if (wmsBaseLocationVo == null) {
return R.fail("库位条码扫描错误");
}
Boolean result = wmsReturnOrderService.returnStoreSubmit(data);
return toAjax(result);
}
@ -143,6 +150,17 @@ public class WmsPdaApiController extends BaseController {
@PostMapping("/raw/outSelectByOrderCode")
public R<List<WmsOutstockDetailVo>> outSelectByOrderCode(String orderCode) {
List<WmsOutstockDetailVo> wmsOutstockDetailVo = apiService.outSelectByOrderCode(orderCode);
wmsOutstockDetailVo.forEach(item -> {
WmsInventoryVo inventory = wmsInventoryService.selectOrderBeachCode(item.getMaterialId());
if (inventory != null) {
item.setLocationCode(inventory.getLocationCode());
item.setBatchCode(inventory.getBatchCode());
item.setInventoryQty(inventory.getInventoryQty());
}
});
if (wmsOutstockDetailVo == null) return R.fail("出库单号不正确");
return R.ok(wmsOutstockDetailVo);
}
@ -151,13 +169,13 @@ public class WmsPdaApiController extends BaseController {
*
*/
@PostMapping("/raw/selectInVentoryByBatchCode")
public R<Void> rawSelectInVentoryByBatchCode(WmsOutstockRecord outstockRecord) {
public R<Void> rawSelectInVentoryByBatchCode(@RequestBody WmsOutstockRecord outstockRecord) {
// 验证库存
WmsInventory wmsInventory = apiService.outSelectInVentoryByBatch(outstockRecord);
if (wmsInventory == null) {
R.fail("物料不在待出库列表内");
return R.fail("物料扫描错误");
}
assert wmsInventory != null;
if (wmsInventory.getInventoryQty().compareTo(outstockRecord.getOutstockQty()) < 0) {
R.fail("当前库位库存为:" + wmsInventory.getInventoryQty());
}
@ -173,10 +191,10 @@ public class WmsPdaApiController extends BaseController {
// 验证库存
WmsInventoryVo WmsInventoryVo = apiService.selectInVentoryByBatchCode(outstockRecord.getBatchCode(), outstockRecord.getLocationCode());
if (WmsInventoryVo == null) {
R.fail("条码扫描错误");
return R.fail("条码扫描错误");
}
if (WmsInventoryVo.getInventoryQty().compareTo(outstockRecord.getOutstockQty()) < 0) {
R.fail("无法出库,当前库位库存为:" + WmsInventoryVo.getInventoryQty());
return R.fail("无法出库,当前库位库存为:" + WmsInventoryVo.getInventoryQty());
}
WmsInventory wmsInventory = new WmsInventory();
BeanUtils.copyProperties(WmsInventoryVo, wmsInventory);
@ -199,15 +217,24 @@ public class WmsPdaApiController extends BaseController {
}
// 移库提交
@GetMapping("/moveSubmit")
@PostMapping("/moveSubmit")
public R<WmsInventoryVo> moveSubmit(@RequestBody WmsInventoryVo vo) {
// 验证库位
WmsBaseLocationVo wmsBaseLocationVo = baseLocationService.selectLocationVoByCode(vo.getNewLocationCode());
if (wmsBaseLocationVo == null) {
return R.fail("库位条码扫描错误");
}
WmsMoveOrderBo moveOrderBo = new WmsMoveOrderBo();
moveOrderBo.setOrderStatus("1");
moveOrderBo.setMaterialId(vo.getMaterialId());
moveOrderBo.setWarehouseId(wmsBaseLocationVo.getWarehouseId());
moveOrderBo.setPlanLocationCode(vo.getLocationCode());
moveOrderBo.setTargetLocationCode(vo.getNewLocationCode());
wmsMoveOrderService.insertByBo(moveOrderBo);
boolean result = apiService.moveSubmit(vo);
return result ? R.ok() : R.fail();
}

@ -123,4 +123,9 @@ public class WmsOutstockDetailVo implements Serializable {
*
*/
private BigDecimal outstockQty;
private String batchCode;
private String locationCode;
private BigDecimal inventoryQty;
}

@ -1,8 +1,10 @@
package org.dromara.wms.mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.wms.domain.WmsOutstockRecord;
import org.dromara.wms.domain.vo.WmsOutstockRecordVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.springframework.stereotype.Repository;
/**
@ -13,5 +15,33 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface WmsOutstockRecordMapper extends BaseMapperPlus<WmsOutstockRecord, WmsOutstockRecordVo> {
@Select("SELECT top 1 t.outstock_record_id,\n" +
" t.outstock_code,\n" +
" t.outstock_id,\n" +
" t.batch_code,\n" +
" t.material_id,\n" +
" t.location_code,\n" +
" t.outstock_qty,\n" +
" t.material_categories,\n" +
" t.erp_synchronous_status,\n" +
" t.erp_synchronous_qty,\n" +
" t.special_type,\n" +
" t.return_flag,\n" +
" t.tenant_id,\n" +
" t.create_dept,\n" +
" t.create_by,\n" +
" t.create_time,\n" +
" t.update_by,\n" +
" t.update_time,\n" +
" t1.material_code,\n" +
" t1.ro_id,\n" +
" t1.material_name,\n" +
" t1.material_unit,\n" +
" t1.material_spec\n" +
"FROM wms_outstock_record t\n" +
" LEFT JOIN base_material_info_copy1 t1 ON (t1.material_id = t.material_id)\n" +
"WHERE t.batch_code = #{code}\n" +
"\n" +
"ORDER BY t.create_time DESC")
WmsOutstockRecordVo returnSelectCode(@Param("code") String code);
}

@ -2,6 +2,7 @@ package org.dromara.wms.mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.wms.domain.WmsReturnOrder;
import org.dromara.wms.domain.vo.WmsReturnOrderVo;
@ -18,4 +19,7 @@ public interface WmsReturnOrderMapper extends BaseMapperPlus<WmsReturnOrder, Wms
@Select("select top 1 ro_id,wro.material_id,batch_code,plan_amount,plan_location_code,bmi.material_name,bmi.material_unit from wms_return_order wro\n" +
"left join base_material_info_copy1 bmi on bmi.material_id=wro.material_id where batch_code=#{code} order by wro.create_time desc")
WmsReturnOrderVo selectOrderInfoByCode(@Param("code") String code);
@Update("UPDATE hwmom.dbo.wms_return_order SET order_status =1, return_amount = #{data.returnAmount}, " +
"return_location_code = #{data.returnLocationCode} WHERE ro_id = #{data.roId}")
int updateTable(@Param("data") WmsReturnOrder wmsReturnOrder);
}

@ -1,13 +1,13 @@
package org.dromara.wms.service;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.wms.domain.WmsInventory;
import org.dromara.wms.domain.bo.WmsInventoryBo;
import org.dromara.wms.domain.bo.WmsInventoryLedgerBo;
import org.dromara.wms.domain.bo.WmsMoveOrderBo;
import org.dromara.wms.domain.vo.WmsInventoryVo;
import org.dromara.wms.domain.vo.WmsInventoryLedgerVo;
import org.dromara.wms.domain.vo.WmsInventoryVo;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -118,4 +118,6 @@ public interface IWmsInventoryService {
* @return
*/
List<WmsInventoryLedgerVo> queryInventoryLedgerList(WmsInventoryLedgerBo bo);
WmsInventoryVo selectOrderBeachCode(Long materialId);
}

@ -18,8 +18,8 @@ import org.dromara.wms.domain.WmsInventory;
import org.dromara.wms.domain.bo.WmsInventoryBo;
import org.dromara.wms.domain.bo.WmsInventoryLedgerBo;
import org.dromara.wms.domain.bo.WmsMoveOrderBo;
import org.dromara.wms.domain.vo.WmsInventoryVo;
import org.dromara.wms.domain.vo.WmsInventoryLedgerVo;
import org.dromara.wms.domain.vo.WmsInventoryVo;
import org.dromara.wms.mapper.WmsInventoryMapper;
import org.dromara.wms.service.IWmsInventoryService;
import org.springframework.stereotype.Service;
@ -46,7 +46,7 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
* @return
*/
@Override
public WmsInventoryVo queryById(Long inventoryId){
public WmsInventoryVo queryById(Long inventoryId) {
return baseMapper.selectVoById(inventoryId);
}
@ -168,7 +168,7 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
/**
*
*/
private void validEntityBeforeSave(WmsInventory entity){
private void validEntityBeforeSave(WmsInventory entity) {
//TODO 做一些数据校验,如唯一约束
}
@ -202,22 +202,22 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
@Override
public HashMap<String, List<WmsInventoryVo>> selectInventorys(WmsMoveOrderBo bo) {
LambdaQueryWrapper<WmsInventory> lqw = new LambdaQueryWrapper<>();
lqw.eq(WmsInventory::getLocationCode,bo.getPlanLocationCode())
.eq(WmsInventory::getMaterialId,bo.getMaterialId());
lqw.eq(WmsInventory::getLocationCode, bo.getPlanLocationCode())
.eq(WmsInventory::getMaterialId, bo.getMaterialId());
List<WmsInventoryVo> planList = baseMapper.selectVoList(lqw);
LambdaQueryWrapper<WmsInventory> lqw1 = new LambdaQueryWrapper<>();
lqw1.eq(WmsInventory::getLocationCode,bo.getTargetLocationCode())
.eq(WmsInventory::getMaterialId,bo.getMaterialId());
lqw1.eq(WmsInventory::getLocationCode, bo.getTargetLocationCode())
.eq(WmsInventory::getMaterialId, bo.getMaterialId());
List<WmsInventoryVo> targetList = baseMapper.selectVoList(lqw1);
HashMap<String, List<WmsInventoryVo>> result = new HashMap<>();
result.put("planList",planList);
result.put("targetList",targetList);
result.put("planList", planList);
result.put("targetList", targetList);
return result;
}
@Override
public BigDecimal materailCount(WmsInventory wmsInventory) {
return baseMapper.materailCount(wmsInventory);
return baseMapper.materailCount(wmsInventory);
}
/**
@ -229,7 +229,7 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
@ -270,7 +270,8 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
/**
*
* @param batchCode
*
* @param batchCode
* @param locationCode
* @return VO
*/
@ -415,5 +416,13 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
}
}
@Override
public WmsInventoryVo selectOrderBeachCode(Long materialId) {
LambdaQueryWrapper<WmsInventory> lqw = Wrappers.lambdaQuery();
lqw.eq(WmsInventory::getMaterialId, materialId)
.gt(WmsInventory::getInventoryQty, BigDecimal.ZERO)
.eq(WmsInventory::getLockState, 0)
.orderByAsc(WmsInventory::getCreateTime);
return baseMapper.selectVoOne(lqw);
}
}

@ -49,27 +49,30 @@ 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)
// 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(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)
// // /* 关联仓库改为关联区域,先查区域再查仓库 */
// // // 关联库位信息获取区域ID
// // .select(WmsBaseLocation::getAreaId)
// // .leftJoin(WmsBaseLocation.class, WmsBaseLocation::getLocationCode, WmsOutstockRecord::getLocationCode)
// // // 关联区域信息获取仓库ID
// // .select(WmsBaseArea::getWarehouseId)
// // .leftJoin(WmsBaseArea.class, WmsBaseArea::getAreaId, WmsBaseLocation::getAreaId)
// .eq(WmsOutstockRecord::getBatchCode, code)
// .eq(WmsOutstockRecord::getReturnFlag, 0)
// .orderByDesc(WmsOutstockRecord::getCreateTime);
// .select(WmsBaseLocation::getWarehouseId)
// .leftJoin(WmsBaseLocation.class, WmsBaseLocation::getLocationCode, WmsOutstockRecord::getLocationCode)
/* 关联仓库改为关联区域,先查区域再查仓库 */
// 关联库位信息获取区域ID
.select(WmsBaseLocation::getAreaId)
.leftJoin(WmsBaseLocation.class, WmsBaseLocation::getLocationCode, WmsOutstockRecord::getLocationCode)
// 关联区域信息获取仓库ID
.select(WmsBaseArea::getWarehouseId)
.leftJoin(WmsBaseArea.class, WmsBaseArea::getAreaId, WmsBaseLocation::getAreaId)
.eq(WmsOutstockRecord::getBatchCode, code)
.eq(WmsOutstockRecord::getReturnFlag, 0)
.orderByDesc(WmsOutstockRecord::getCreateTime);
return wmsOutstockRecordMapper.selectVoOne(lqw);
return wmsOutstockRecordMapper.returnSelectCode(code);
}
@Override
@ -225,7 +228,9 @@ 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);
}
@ -257,14 +262,14 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
*/
@Override
public Boolean rawOutSubmit(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory) {
outStoreOperation(outstockRecord, wmsInventory);
outStoreOperation(outstockRecord, wmsInventory,"5");
// 修改子表出库数量
wmsOutstockDetailMapper.updateOutNumberByObjId(wmsInventory.getOutstockDetailId(), outstockRecord.getOutstockQty());
return true;
}
// 出库操作
private void outStoreOperation(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory) {
private void outStoreOperation(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory,String type) {
// 出库数量
BigDecimal outstockQty = outstockRecord.getOutstockQty();
// 库存
@ -282,6 +287,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
outstockRecord.setMaterialId(wmsInventory.getMaterialId());
outstockRecord.setCreateBy(LoginHelper.getUserId());
outstockRecord.setCreateTime(DateUtils.getNowDate());
outstockRecord.setSpecialType(type);
wmsOutstockRecordMapper.insert(outstockRecord);
}
@ -295,7 +301,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
@Override
public Boolean specialOutSubmit(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory) {
// 出库数量
outStoreOperation(outstockRecord, wmsInventory);
outStoreOperation(outstockRecord, wmsInventory,"6");
return true;
}
@ -305,15 +311,17 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
@Override
public WmsInventory outSelectInVentoryByBatch(WmsOutstockRecord outstockRecord) {
MPJLambdaWrapper<WmsInventory> lqw = JoinWrappers.lambda(WmsInventory.class)
.selectAll(WmsInventory.class)
.rightJoin(WmsOutstockDetail.class, WmsOutstockDetail::getMaterialId, WmsInventory::getMaterialId).
select(WmsOutstockDetail::getOutstockDetailId).eq(WmsOutstockDetail::getOutstockCode, outstockRecord.getOutstockCode())
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) {
if (type.equals("原材料盘点")) {
if (type.equals("盘点")) {
return apiMapper.selectRawStore();
} else if (type.equals("半成品盘点")) {
return apiMapper.selectSemiStore();

@ -187,7 +187,7 @@ public class WmsReturnOrderServiceImpl implements IWmsReturnOrderService {
wmsReturnOrder.setUpdateBy(LoginHelper.getUsername());
wmsReturnOrder.setReturnAmount(data.getPlanAmount());
wmsReturnOrder.setOrderStatus(String.valueOf(1));
int i = baseMapper.updateById(wmsReturnOrder);
int i = baseMapper.updateTable(wmsReturnOrder);
return i > 0;
}
}

Loading…
Cancel
Save