fix(存储仓库库存大于0同步sap):抛送变更

This commit is contained in:
liaohechuan 2025-03-05 18:56:17 +08:00
parent 860a72bf65
commit cf7807e511
8 changed files with 89 additions and 74 deletions

View File

@ -135,20 +135,21 @@ public interface RemoteWmsInventoryService {
@GetMapping("/wms-inventory/api/getInvByBatchNoAndItemBo/{site}/{itemBo}/{batchNo}")
R<List<Inventory>> getInvByBatchNoAndItemBo(@PathVariable("site") String site, @PathVariable("itemBo") String itemBo, @PathVariable("batchNo") String batchNo);
/**
* 获取库存数量大于0的最新一笔快照数据量
*
* @param site
* @return
*/
@GetMapping("/z-wms-inventory-stock-his-itf/api/readZWmsInventoryStockHisItfCount/{site}")
R<Integer> readZWmsInventoryStockHisItfCount(@PathVariable("site") String site, @RequestHeader(SecurityConstants.FROM) String from);
/**
* 获取库存数量大于0的数据
*
* @param site
* @return
*/
@GetMapping("/z-wms-inventory-stock-his-itf/api/readZWmsInventoryStockHisItfList/{site}")
R<List<ZWmsInventoryStockHisItf>> readZWmsInventoryStockHisItfList(@PathVariable("site") String site, @RequestHeader(SecurityConstants.FROM) String from);
/**
* 存储仓库库存大于0同步sap临时日志表接口用
* @param zWmsInventoryStockHisItf 仓库库存大于0同步sap临时日志表
* @return R
*/
@PostMapping("/z-wms-inventory-stock-his-itf/api/saveZWmsInventoryStockHisItf")
R<String> saveZWmsInventoryStockHisItf(@RequestBody ZWmsInventoryStockHisItf zWmsInventoryStockHisItf, @RequestHeader(SecurityConstants.FROM) String from);
@GetMapping("/z-wms-inventory-stock-his-itf/api/readZWmsInventoryStockHisItfList/{site}/{start}/{end}")
R<List<ZWmsInventoryStockHisItf>> readZWmsInventoryStockHisItfList(@PathVariable("site") String site, @PathVariable("start") Integer start, @PathVariable("end") Integer end, @RequestHeader(SecurityConstants.FROM) String from);
}

View File

@ -135,4 +135,16 @@ public class ZWmsInventoryStockHisItf extends Model<ZWmsInventoryStockHisItf> {
*/
@ApiModelProperty(value="创建人员")
private String creator;
/**
* 序号
*/
@ApiModelProperty(value="序号")
private String seq;
/**
* 快照ID
*/
@ApiModelProperty(value="快照ID")
private String snapshotId;
}

View File

@ -1,5 +1,7 @@
package com.foreverwin.mom.wms.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -237,4 +239,22 @@ public class WmsStorageLocationController {
public R updateBatchById(@RequestBody List<StorageLocation> storageLocations) {
return R.ok(storageLocationService.updateBatchById(storageLocations));
}
/**
* 分页模糊查询
* @return
*/
@ApiOperation(value = "分页模糊查询", notes = "分页模糊查询")
@GetMapping("/readStorageLocationPage")
public R<IPage<StorageLocation>> readStorageLocationPage(Page page, StorageLocation storageLocation) {
LambdaQueryWrapper<StorageLocation> lambdaQueryWrapper = Wrappers.lambdaQuery(StorageLocation.class);
lambdaQueryWrapper.eq(StorageLocation::getSite, storageLocation.getSite());
if (StrUtil.isNotBlank(storageLocation.getStorageLocation())) {
lambdaQueryWrapper.and(wrapper -> wrapper
.like(StorageLocation::getStorageLocation, storageLocation.getStorageLocation())
.or().like(StorageLocation::getDescription, storageLocation.getStorageLocation())
);
}
return R.ok(storageLocationService.page(page, lambdaQueryWrapper));
}
}

View File

@ -108,6 +108,19 @@ public class ZWmsInventoryStockHisItfController {
return zWmsInventoryStockHisItfService.list(Wrappers.query(zWmsInventoryStockHisItf));
}
/**
* 获取库存数量大于0的最新一笔快照数据量
*
* @param site 站点
* @return
*/
@ApiOperation(value = "获取库存数量大于0的最新一笔快照数据量", notes = "获取库存数量大于0的最新一笔快照数据量")
@GetMapping("/api/readZWmsInventoryStockHisItfCount/{site}")
@Inner(value = false)
public R<Integer> readZWmsInventoryStockHisItfCount(@PathVariable("site") String site) {
return R.ok(zWmsInventoryStockHisItfService.readZWmsInventoryStockHisItfCount(site));
}
/**
* 获取库存数量大于0的数据
*
@ -115,22 +128,9 @@ public class ZWmsInventoryStockHisItfController {
* @return ZWmsInventoryStockHisItf
*/
@ApiOperation(value = "获取库存数量大于0的数据", notes = "获取库存数量大于0的数据")
@GetMapping("/api/readZWmsInventoryStockHisItfList/{site}")
@GetMapping("/api/readZWmsInventoryStockHisItfList/{site}/{start}/{end}")
@Inner(value = false)
public R<List<ZWmsInventoryStockHisItf>> readOperationOutListByShopOrder(@PathVariable("site") String site) {
return R.ok(zWmsInventoryStockHisItfService.readZWmsInventoryStockHisItfList(site));
}
/**
* 存储仓库库存大于0同步sap临时日志表接口用
* @param zWmsInventoryStockHisItf 仓库库存大于0同步sap临时日志表
* @return R
*/
@ApiOperation(value = "存储仓库库存大于0同步sap临时日志表接口用", notes = "存储仓库库存大于0同步sap临时日志表接口用")
@SysLog("存储仓库库存大于0同步sap临时日志表接口用" )
@PostMapping("/api/saveZWmsInventoryStockHisItf")
@Inner(value = false)
public R<String> saveZWmsInventoryStockHisItf(@RequestBody ZWmsInventoryStockHisItf zWmsInventoryStockHisItf) {
return R.ok(zWmsInventoryStockHisItfService.saveZWmsInventoryStockHisItf(zWmsInventoryStockHisItf));
public R<List<ZWmsInventoryStockHisItf>> readZWmsInventoryStockHisItfList(@PathVariable("site") String site, @PathVariable("start") Integer start, @PathVariable("end") Integer end) {
return R.ok(zWmsInventoryStockHisItfService.readZWmsInventoryStockHisItfList(site, start, end));
}
}

View File

@ -19,12 +19,13 @@ public interface ZWmsInventoryStockHisItfService extends IService<ZWmsInventoryS
* @param site 站点
* @return ZWmsInventoryStockHisItf
*/
List<ZWmsInventoryStockHisItf> readZWmsInventoryStockHisItfList(String site);
List<ZWmsInventoryStockHisItf> readZWmsInventoryStockHisItfList(String site, Integer start, Integer end);
/**
* 存储仓库库存大于0同步sap临时日志表接口用
* @param zWmsInventoryStockHisItf 仓库库存大于0同步sap临时日志表
* @return R
* 获取库存数量大于0的最新一笔快照数据量
*
* @param site 站点
* @return
*/
String saveZWmsInventoryStockHisItf(ZWmsInventoryStockHisItf zWmsInventoryStockHisItf);
Integer readZWmsInventoryStockHisItfCount(String site);
}

View File

@ -1,13 +1,11 @@
package com.foreverwin.mom.wms.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mom.wms.entity.ZWmsInventoryStockHisItf;
import com.foreverwin.mom.wms.mapper.ZWmsInventoryStockHisItfMapper;
import com.foreverwin.mom.wms.service.ZWmsInventoryStockHisItfService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -21,21 +19,16 @@ import java.util.List;
public class ZWmsInventoryStockHisItfServiceImpl extends ServiceImpl<ZWmsInventoryStockHisItfMapper, ZWmsInventoryStockHisItf> implements ZWmsInventoryStockHisItfService {
@Override
public List<ZWmsInventoryStockHisItf> readZWmsInventoryStockHisItfList(String site) {
return baseMapper.readZWmsInventoryStockHisItfList(site);
public List<ZWmsInventoryStockHisItf> readZWmsInventoryStockHisItfList(String site, Integer start, Integer end) {
List<ZWmsInventoryStockHisItf> zWmsInventoryStockHisItfList = baseMapper.selectList(Wrappers.<ZWmsInventoryStockHisItf>lambdaQuery()
.eq(ZWmsInventoryStockHisItf::getWerks, site)
.between(ZWmsInventoryStockHisItf::getSeq, start, end)
);
return zWmsInventoryStockHisItfList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public String saveZWmsInventoryStockHisItf(ZWmsInventoryStockHisItf zWmsInventoryStockHisItf) {
// 查询
List<ZWmsInventoryStockHisItf> zWmsInventoryStockHisItfList = this.readZWmsInventoryStockHisItfList(zWmsInventoryStockHisItf.getWerks());
if (CollectionUtils.isNotEmpty(zWmsInventoryStockHisItfList)) {
// 先删除原来的
baseMapper.delete(Wrappers.<ZWmsInventoryStockHisItf>lambdaQuery().eq(ZWmsInventoryStockHisItf::getWerks, zWmsInventoryStockHisItf.getWerks()));
// 再添加
super.saveBatch(zWmsInventoryStockHisItfList);
}
return "S";
public Integer readZWmsInventoryStockHisItfCount(String site) {
return baseMapper.readZWmsInventoryStockHisItfCount(site);
}
}

View File

@ -5,8 +5,6 @@ import com.foreverwin.mom.wms.entity.ZWmsInventoryStockHisItf;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 仓库库存大于0同步sap临时日志表
*
@ -16,5 +14,5 @@ import java.util.List;
@Mapper
public interface ZWmsInventoryStockHisItfMapper extends BaseMapper<ZWmsInventoryStockHisItf> {
List<ZWmsInventoryStockHisItf> readZWmsInventoryStockHisItfList(@Param("site") String site);
Integer readZWmsInventoryStockHisItfCount(@Param("site") String site);
}

View File

@ -25,33 +25,23 @@
<result property="creator" column="CREATOR"/>
</resultMap>
<!--获取库存数量大于0的数据-->
<select id="readZWmsInventoryStockHisItfList"
resultType="com.foreverwin.mom.wms.entity.ZWmsInventoryStockHisItf">
<!--获取库存数量大于0的最新一笔快照数据量-->
<select id="readZWmsInventoryStockHisItfCount" resultType="java.lang.Integer">
select
wi.HANDLE,
'' as ZUUID,
wi.INVENTORY_ID as Z_TM,
CURRENT_DATE as ZDATE,
CURRENT_TIME as ZTIME,
substring_index(substring_index(wi.ITEM_BO, ',', -2), ',', 1) as MATNR,
wi.SITE as WERKS,
wi.ERP_STORAGE_LOCATION as LGORT,
wi.BATCH_NO as CHARG,
wi.INVENTORY_SPECIAL_MARKING as SOBKZ,
wi.DN_ORDER as VBELN,
wi.DN_ORDER_SEQ as POSNR,
'' as KUNNR,
'' as LIFNR,
substring_index(substring_index(wcm.CARRIER_BO, ',', -1), ',', 1) as Z_TP,
wi.QTY_ON_HAND as Z_KC,
CURRENT_TIMESTAMP as DATE_CREATE,
'JOB' as CREATOR
count(zwishi.HANDLE) as AMOUNT
from
wms.wms_inventory wi
left join wms.wms_carrier_member wcm on wcm.CARRIER_OR_INVENTORY_BO = wi.HANDLE
wms.z_wms_inventory_stock_his_itf zwishi
where
wi.SITE = #{site}
and wi.QTY_ON_HAND > 0
zwishi.WERKS = #{site}
and zwishi.SNAPSHOT_ID = (
select
zwisi.HANDLE
from
wms.z_wms_inventory_snapshot_itf zwisi
where
zwisi.SITE = #{site}
order by
zwisi.DATE_CREATE desc
limit 1)
</select>
</mapper>