|
@@ -47,13 +47,15 @@ public class AcqGoodsOnSeatCusData implements CusData {
|
|
List<CusAcqGoodsSeat06> insertList = new ArrayList<>();
|
|
List<CusAcqGoodsSeat06> insertList = new ArrayList<>();
|
|
// 修改库存list
|
|
// 修改库存list
|
|
List<CusAcqGoodsSeat06> updateList = new ArrayList<>();
|
|
List<CusAcqGoodsSeat06> updateList = new ArrayList<>();
|
|
|
|
+ // 删除库存list
|
|
|
|
+ List<CusAcqGoodsSeat06> deleteList = new ArrayList<>();
|
|
|
|
|
|
List<String> gUnitNameList = Lists.newArrayList();
|
|
List<String> gUnitNameList = Lists.newArrayList();
|
|
cusList.forEach(i -> gUnitNameList.add(i.getgUnit()));
|
|
cusList.forEach(i -> gUnitNameList.add(i.getgUnit()));
|
|
|
|
|
|
// 查询已有库存信息表对应sku数据
|
|
// 查询已有库存信息表对应sku数据
|
|
List<CusAcqGoodsSeat06> listgoodsSeat = cusAcqGoodsSeatService06.listCusAcqGoodsSeat(cusList);
|
|
List<CusAcqGoodsSeat06> listgoodsSeat = cusAcqGoodsSeatService06.listCusAcqGoodsSeat(cusList);
|
|
- Map<String, String> exitGoodsSeat = listgoodsSeat.stream().collect(Collectors.toMap(k->k.getSkuNo()+k.getSeatNo(), v->v.getLocalEmsNo()));
|
|
|
|
|
|
+ Map<String, String> exitGoodsSeat = listgoodsSeat.stream().collect(Collectors.toMap(k->k.getSkuNo()+k.getSeatNo(), v->v.getId()));
|
|
|
|
|
|
List<OmsCusUnitCode> codeList = omsCusUnitCodeMapper.getOmsCusUnitCodeList(gUnitNameList);
|
|
List<OmsCusUnitCode> codeList = omsCusUnitCodeMapper.getOmsCusUnitCodeList(gUnitNameList);
|
|
Map<String,OmsCusUnitCode> omsCusUnitCodeMap = codeList.stream().collect(Collectors.toMap(k->k.getgUnitName(), v->v));
|
|
Map<String,OmsCusUnitCode> omsCusUnitCodeMap = codeList.stream().collect(Collectors.toMap(k->k.getgUnitName(), v->v));
|
|
@@ -66,16 +68,25 @@ public class AcqGoodsOnSeatCusData implements CusData {
|
|
|
|
|
|
String key = seat.getSkuNo() + seat.getSeatNo();
|
|
String key = seat.getSkuNo() + seat.getSeatNo();
|
|
if (exitGoodsSeat.containsKey(key)) {
|
|
if (exitGoodsSeat.containsKey(key)) {
|
|
- // 存在, 则更新
|
|
|
|
- updateList.add(seat);
|
|
|
|
|
|
+ if (seat.getgQty().intValue() != 0) {
|
|
|
|
+ // 存在并且库存不为0, 则更新
|
|
|
|
+ updateList.add(seat);
|
|
|
|
+ } else {
|
|
|
|
+ // 存在并库存为0,则删除
|
|
|
|
+ seat.setId(exitGoodsSeat.get(key));
|
|
|
|
+ deleteList.add(seat);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- // 不存在, 则插入
|
|
|
|
- insertList.add(seat);
|
|
|
|
|
|
+ if (seat.getgQty().intValue() != 0) {
|
|
|
|
+ // 不存在并且库存不为0, 则插入
|
|
|
|
+ insertList.add(seat);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
int insertResult = 0;
|
|
int insertResult = 0;
|
|
int updateResult = 0;
|
|
int updateResult = 0;
|
|
|
|
+ int deleteResult = 0;
|
|
|
|
|
|
if (insertList.size() > 0) {
|
|
if (insertList.size() > 0) {
|
|
insertResult = cusAcqGoodsSeatService06.addCusAcqGoodsSeat06(insertList);
|
|
insertResult = cusAcqGoodsSeatService06.addCusAcqGoodsSeat06(insertList);
|
|
@@ -83,10 +94,13 @@ public class AcqGoodsOnSeatCusData implements CusData {
|
|
if (updateList.size() > 0) {
|
|
if (updateList.size() > 0) {
|
|
updateResult = cusAcqGoodsSeatService06.updateCusAcqGoodsSeat06(updateList);
|
|
updateResult = cusAcqGoodsSeatService06.updateCusAcqGoodsSeat06(updateList);
|
|
}
|
|
}
|
|
|
|
+ if (deleteList.size() > 0) {
|
|
|
|
+ deleteResult = cusAcqGoodsSeatService06.deleteCusAcqGoodsSeat06(deleteList);
|
|
|
|
+ }
|
|
|
|
|
|
- logger.info("---【" + DATA_TYPE_INFO + "】写入监控数据:{} 条, 更新监控数据:{}条", insertResult, updateResult);
|
|
|
|
|
|
+ logger.info("---【" + DATA_TYPE_INFO + "】写入监控数据:{} 条, 更新监控数据:{}条, 删除监控数据:{}条", insertResult, updateResult, deleteResult);
|
|
|
|
|
|
logger.info("---------- 库位货物数据::写入本次监控数据结束 --------------------");
|
|
logger.info("---------- 库位货物数据::写入本次监控数据结束 --------------------");
|
|
- return insertResult + updateResult;
|
|
|
|
|
|
+ return insertResult + updateResult + deleteResult;
|
|
}
|
|
}
|
|
}
|
|
}
|