增加 调拨出库插入记录、插入任务

master
wanghao 3 months ago
parent b2447e0d7b
commit 8e42ebde1f

@ -151,10 +151,10 @@ public class WmsPdaApiController extends BaseController {
*/
@PostMapping("/raw/outSelectByOrderCode")
public R<List<WmsOutstockDetailVo>> outSelectByOrderCode(String orderCode, String orderType) {
List<WmsOutstockDetailVo> wmsOutstockDetailVo = null;
List<WmsOutstockDetailVo> wmsOutstockDetailVoList;
if (orderType.equals("5")) {
wmsOutstockDetailVo = apiService.outSelectByOrderCode(orderCode);
wmsOutstockDetailVo.forEach(item -> {
wmsOutstockDetailVoList = apiService.outSelectByOrderCode(orderCode);
wmsOutstockDetailVoList.forEach(item -> {
WmsInventoryVo inventory = wmsInventoryService.selectOrderBeachCode(item.getMaterialId());
if (inventory != null) {
item.setLocationCode(inventory.getLocationCode());
@ -165,8 +165,9 @@ public class WmsPdaApiController extends BaseController {
});
} else if (orderType.equals("7")) {
List<WmsAllocateOrderDetailVo> list = wmsAllocateOrderDetailService.selectdetailListByOrderCode(orderCode);
if (list != null && list.size() > 0) {
wmsOutstockDetailVo = new ArrayList<>(list.size());
if (list != null && !list.isEmpty()) {
wmsOutstockDetailVoList = new ArrayList<>(list.size());
list.forEach(item -> {
WmsInventoryVo inventory = wmsInventoryService.selectOrderBeachCode(item.getMaterialId());
WmsOutstockDetailVo vo = new WmsOutstockDetailVo();
@ -175,16 +176,22 @@ public class WmsPdaApiController extends BaseController {
vo.setBatchCode(inventory.getBatchCode());
vo.setInventoryQty(inventory.getInventoryQty());
vo.setMaterialCode(inventory.getMaterialCode());
vo.setMaterialName(inventory.getMaterialName());
vo.setOutstockQty(item.getAllocateOrderQty());
vo.setOutSum(item.getOutSum());
vo.setMaterialName(item.getMaterialName());
vo.setOutstockQty(item.getAllocateOrderQty());
wmsOutstockDetailVoList.add(vo);
});
} else {
wmsOutstockDetailVoList = null;
}
} else {
wmsOutstockDetailVoList = null;
}
if (wmsOutstockDetailVo == null) return R.fail("出库单号不正确");
return R.ok(wmsOutstockDetailVo);
if (wmsOutstockDetailVoList == null) return R.fail("出库单号不正确");
return R.ok(wmsOutstockDetailVoList);
}
/**
@ -192,8 +199,18 @@ vo.setOutstockQty(item.getAllocateOrderQty());
*/
@PostMapping("/raw/selectInVentoryByBatchCode")
public R<Void> rawSelectInVentoryByBatchCode(@RequestBody WmsOutstockRecord outstockRecord) {
// 验证库存
WmsInventory wmsInventory = apiService.outSelectInVentoryByBatch(outstockRecord);
String type = outstockRecord.getSpecialType();
WmsInventory wmsInventory = null;
if (type.equals("5")) {
// 验证库存
wmsInventory = apiService.outSelectInVentoryByBatch(outstockRecord);
} else if (type.equals("7")) {
wmsInventory = apiService.outAllocateSelectInVentory(outstockRecord);
}
if (wmsInventory == null) {
return R.fail("物料扫描错误");
}
@ -201,6 +218,7 @@ vo.setOutstockQty(item.getAllocateOrderQty());
if (wmsInventory.getInventoryQty().compareTo(outstockRecord.getOutstockQty()) < 0) {
R.fail("当前库位库存为:" + wmsInventory.getInventoryQty());
}
Boolean result = apiService.rawOutSubmit(outstockRecord, wmsInventory);
return result ? R.ok() : R.fail();
}

@ -94,5 +94,6 @@ public class WmsAllocateOrderDetail {
@TableField(exist = false)
private String materialCode;
private double outSum;//实际出库数量
}

@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import java.io.Serial;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -43,7 +44,7 @@ public class WmsAllocateTask extends TenantEntity {
/**
*
*/
private Long materialQty;
private BigDecimal materialQty;
/**
*

@ -118,5 +118,9 @@ public class WmsInventory {
@TableField(exist = false)
private String materialUnit;//字段映射
/**
*
*/
@TableField(exist = false)
private Long aoDId;//字段映射
}

@ -1,12 +1,9 @@
package org.dromara.wms.domain.bo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.wms.domain.WmsAllocateOrderDetail;
import java.math.BigDecimal;
@ -57,12 +54,12 @@ public class WmsAllocateOrderDetailBo extends BaseEntity {
*/
// @NotNull(message = "erp同步数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Long erpSynchronousQty;
/**
*
*/
private BigDecimal printedQty;
private String tenantId;
/**
@ -95,5 +92,6 @@ public class WmsAllocateOrderDetailBo extends BaseEntity {
*/
private BigDecimal inventoryQty;
private double outSum;
}

@ -121,6 +121,7 @@ public class WmsAllocateOrderDetailVo implements Serializable {
*
*/
private BigDecimal inventoryQty;
private double outSum;
}

@ -7,6 +7,7 @@ import org.dromara.wms.domain.*;
import org.dromara.wms.domain.vo.*;
import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
import java.util.List;
@Repository
@ -58,4 +59,6 @@ public interface WmsPdaApiMapper {
int semiDeleteErrorCode(String code);
String selectInstoreRecordLocaltionCode(@Param("materialId") Long materialId);
void updateAllocate(@Param("id") Long aoDId,@Param("qty") BigDecimal outstockQty);
}

@ -81,4 +81,6 @@ public interface IWmsPdaApiService {
boolean moveSubmit(WmsInventoryVo vo);
String selectInstoreRecordLocaltionCode(Long materialId);
WmsInventory outAllocateSelectInVentory(WmsOutstockRecord outstockRecord);
}

@ -46,6 +46,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
private final BaseMaterialInfoMapper baseMaterialInfoMapper;//物料基础信息
private final WmsHppTransferMapper wmsHppTransferMapper;
private final WmsBaseLocationMapper wmsBaseLocationMapper;
private final WmsAllocateTaskMapper wmsAllocateTaskMapper;
@Override
public WmsOutstockRecordVo returnSelectCode(String code) {
@ -264,14 +265,48 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
*/
@Override
public Boolean rawOutSubmit(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory) {
outStoreOperation(outstockRecord, wmsInventory,"5");
// 修改子表出库数量
wmsOutstockDetailMapper.updateOutNumberByObjId(wmsInventory.getOutstockDetailId(), outstockRecord.getOutstockQty());
String type = outstockRecord.getSpecialType();
outStoreOperation(outstockRecord, wmsInventory, type);
if (type.equals("7")) {
// outstockCode = "AL250905152403002"
String outstockCode = outstockRecord.getOutstockCode();
// batchCode = "IN20250903001WMS-003001"
String batchCode = outstockRecord.getBatchCode();
// locationCode = "DJ-01"
BigDecimal outstockQty = outstockRecord.getOutstockQty();
//修改调拨子表出库数量
apiMapper.updateAllocate(wmsInventory.getAoDId(), outstockRecord.getOutstockQty());
//查询调拨入库任务
MPJLambdaWrapper<WmsAllocateTask> lqw = JoinWrappers.lambda(WmsAllocateTask.class)
.selectAll(WmsAllocateTask.class);
// lqw.eq(WmsAllocateTask::getAoDId, wmsInventory.getAoDId());
lqw.eq(WmsAllocateTask::getAllocateCode,outstockCode);//单号
lqw.eq(WmsAllocateTask::getBatchCode,batchCode);//批次码
WmsAllocateTask WmsAllocateTask =wmsAllocateTaskMapper.selectOne(lqw);
if (WmsAllocateTask == null) {
WmsAllocateTask=new WmsAllocateTask();
BeanUtils.copyProperties(wmsInventory, WmsAllocateTask);
WmsAllocateTask.setAoDId(wmsInventory.getAoDId());
WmsAllocateTask.setAllocateCode(outstockCode);
// WmsAllocateTask.setBatchCode(batchCode);
WmsAllocateTask.setMaterialQty(outstockQty);
wmsAllocateTaskMapper.insert(WmsAllocateTask);
}
} else if (type.equals("5")) {
// 修改子表出库数量
wmsOutstockDetailMapper.updateOutNumberByObjId(wmsInventory.getOutstockDetailId(), outstockRecord.getOutstockQty());
}
return true;
}
// 出库操作
private void outStoreOperation(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory,String type) {
private void outStoreOperation(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory, String type) {
// 出库数量
BigDecimal outstockQty = outstockRecord.getOutstockQty();
// 库存
@ -291,6 +326,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
outstockRecord.setCreateTime(DateUtils.getNowDate());
outstockRecord.setSpecialType(type);
wmsOutstockRecordMapper.insert(outstockRecord);
}
/**
@ -303,7 +339,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
@Override
public Boolean specialOutSubmit(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory) {
// 出库数量
outStoreOperation(outstockRecord, wmsInventory,"6");
outStoreOperation(outstockRecord, wmsInventory, "6");
return true;
}
@ -321,6 +357,20 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
return wmsInventoryMapper.selectOne(lqw);
}
/**
*
*/
@Override
public WmsInventory outAllocateSelectInVentory(WmsOutstockRecord outstockRecord) {
MPJLambdaWrapper<WmsInventory> lqw = JoinWrappers.lambda(WmsInventory.class)
.selectAll(WmsInventory.class)
.rightJoin(WmsAllocateOrderDetail.class, WmsAllocateOrderDetail::getMaterialId, WmsInventory::getMaterialId)
.select(WmsAllocateOrderDetail::getAoDId)
.eq(WmsAllocateOrderDetail::getAllocateCode, 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("盘点")) {

@ -180,5 +180,9 @@
select top 1 location_code from wms_instock_record where material_id = #{materialId} order by create_time desc
</select>
<update id="updateAllocate">
UPDATE wms_allocate_order_detail SET out_sum = out_sum + #{qty} WHERE ao_d_id = #{id}
</update>
</mapper>

Loading…
Cancel
Save