From a5abbaea5e8a35e77df3a06a88b8b96bebbf79b4 Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期二, 14 十月 2025 08:47:57 +0800
Subject: [PATCH] 新增物料更新接口
---
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WmsOrderItemParam.java | 2
rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/MatnrLocLevel.java | 36 ++++++++++++
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderItemServiceImpl.java | 7 ++
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java | 5 +
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TransferItemServiceImpl.java | 12 ++++
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/BaseMatParms.java | 3 +
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java | 10 +++
rsf-server/src/main/java/com/vincent/rsf/server/api/service/ReceiveMsgService.java | 7 ++
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java | 59 ++++++++++++++++++-
rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx | 2
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrdersItem.java | 2
11 files changed, 135 insertions(+), 10 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
index d33ad5f..78c34a1 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
@@ -286,7 +286,7 @@
marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
}}
title={"menu.matnr"}
- empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
+ empty={false}
filters={filters}
sort={{ field: "create_time", order: "desc" }}
actions={(
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WmsOrderItemParam.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WmsOrderItemParam.java
index 75e00de..e604554 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WmsOrderItemParam.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WmsOrderItemParam.java
@@ -12,7 +12,7 @@
public class WmsOrderItemParam {
@ApiModelProperty("鐗╂枡缂栫爜")
- private String matnrCode;
+ private String matnr;
@ApiModelProperty("鐗╂枡鍚嶇О")
private String maktx;
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java
index 41392fb..6997f92 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/BaseInfoController.java
@@ -40,6 +40,16 @@
return R.ok();
}
+ @ApiOperation("鍩虹鐗╂枡淇℃伅鏇存柊")
+ @PostMapping("/mat/sync/auth/v1")
+ public R matUpdate(@RequestBody BaseMatParms baseMatParms) {
+ if (Objects.isNull(baseMatParms)) {
+ return R.error("鍙傛暟涓嶈兘涓虹┖锛�");
+ }
+
+ return receiveMsgService.matUpdate(baseMatParms);
+ }
+
/**
* @author Ryan
* @date 2025/8/18
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/BaseMatParms.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/BaseMatParms.java
index 1d0c087..cd13bb9 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/BaseMatParms.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/BaseMatParms.java
@@ -30,6 +30,9 @@
@ApiModelProperty("灏哄")
private String size;
+ @ApiModelProperty("瑙勬牸")
+ private String spec;
+
@ApiModelProperty("鎻忚堪")
private String describle;
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrdersItem.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrdersItem.java
index f1d3d99..105f5e8 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrdersItem.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrdersItem.java
@@ -22,7 +22,7 @@
private Long matnrId;
@ApiModelProperty("鐗╂枡缂栫爜")
- private String matnrCode;
+ private String matnr;
@ApiModelProperty("鐗╂枡鍚嶇О")
private String maktx;
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/ReceiveMsgService.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/ReceiveMsgService.java
index 91015cf..14c8691 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/ReceiveMsgService.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/ReceiveMsgService.java
@@ -145,4 +145,11 @@
* @version 1.0
*/
R syncCheckDiffs(SyncCheckDiffParams syncParams);
+
+ /**
+ * 鐗╂枡鏇存柊
+ * @param baseMatParms
+ * @return
+ */
+ R matUpdate(BaseMatParms baseMatParms);
}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
index 9c8c055..9584a8f 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
@@ -277,7 +277,7 @@
/**
* @author Ryan
* @date 2025/8/18
- * @description: 鐗╂枡淇℃伅鍚屾
+ * @description: 鐗╂枡鍒嗙粍淇℃伅鍚屾
* @version 1.0
*/
@Override
@@ -576,7 +576,7 @@
revise.getItems().forEach(reviseItem -> {
ReviseLogItem logItem = new ReviseLogItem();
BeanUtils.copyProperties(reviseItem, logItem);
- Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, reviseItem.getMatnrCode()));
+ Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, reviseItem.getMatnr()));
if (Objects.isNull(matnr)) {
throw new CoolException("鐗╂枡涓嶅瓨鍦紒锛�");
}
@@ -621,13 +621,13 @@
}
order.getOrdersItems().forEach(orderItem -> {
WkOrderItem wkOrderItem = asnOrderItemService.getOne(new LambdaUpdateWrapper<WkOrderItem>()
- .eq(WkOrderItem::getMatnrCode, orderItem.getMatnrCode())
+ .eq(WkOrderItem::getMatnrCode, orderItem.getMatnr())
.eq(StringUtils.isNotEmpty(orderItem.getBatch()), WkOrderItem::getSplrBatch, orderItem.getBatch())
.eq(WkOrderItem::getOrderCode, wkOrder.getCode()));
if (!Objects.isNull(wkOrderItem)) {
if (!asnOrderItemService.update(new LambdaUpdateWrapper<WkOrderItem>()
.eq(WkOrderItem::getOrderCode, wkOrder.getCode())
- .eq(WkOrderItem::getMatnrCode, orderItem.getMatnrCode())
+ .eq(WkOrderItem::getMatnrCode, orderItem.getMatnr())
.eq(StringUtils.isNotEmpty(orderItem.getBatch()), WkOrderItem::getSplrBatch, orderItem.getBatch())
.eq(StringUtils.isNotEmpty(orderItem.getPlatItemId()), WkOrderItem::getPlatItemId, orderItem.getPlatItemId())
.set(WkOrderItem::getAnfme, orderItem.getAnfme()))) {
@@ -671,7 +671,7 @@
}
order.getOrdersItems().forEach(orderItem -> {
if (!asnOrderItemService.remove(new LambdaQueryWrapper<WkOrderItem>()
- .eq(WkOrderItem::getMatnrCode, orderItem.getMatnrCode())
+ .eq(WkOrderItem::getMatnrCode, orderItem.getMatnr())
.eq(StringUtils.isNotEmpty(orderItem.getBatch()), WkOrderItem::getSplrBatch, orderItem.getBatch())
.eq(StringUtils.isNotEmpty(orderItem.getPlatItemId()), WkOrderItem::getPlatItemId, orderItem.getPlatItemId())
.eq(WkOrderItem::getOrderCode, wkOrder.getCode()))) {
@@ -744,4 +744,53 @@
return R.ok().add(dtos);
}
+
+ /**
+ * 鍩虹鐗╂枡淇℃伅鍙樻洿
+ * @param baseMatParms
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R matUpdate(BaseMatParms baseMatParms) {
+ if (StringUtils.isNotBlank(baseMatParms.getMatnr())) {
+ throw new CoolException("鍩虹淇℃伅鍙樻洿澶辫触锛侊紒");
+ }
+ Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, baseMatParms.getMatnr()));
+ if (Objects.isNull(matnr)) {
+ BeanUtils.copyProperties(baseMatParms, matnr);
+ matnr.setCode(baseMatParms.getMatnr());
+ matnr.setName(baseMatParms.getMaktx());
+ if (!Objects.isNull(baseMatParms.getGroupName())) {
+ MatnrGroup matnrGroup = matnrGroupService.getOne(new LambdaQueryWrapper<MatnrGroup>()
+ .eq(MatnrGroup::getName, baseMatParms.getGroupName()));
+ if (Objects.isNull(matnrGroup)) {
+ matnr.setGroupCode(matnrGroup.getCode()).setGroupId(matnrGroup.getId());
+ }
+ }
+ if (!matnrService.save(matnr)) {
+ throw new CoolException("鐗╂枡鏂板澶辫触锛侊紒");
+ }
+ } else {
+
+ if (!Objects.isNull(baseMatParms.getGroupName())) {
+ MatnrGroup matnrGroup = matnrGroupService.getOne(new LambdaQueryWrapper<MatnrGroup>()
+ .eq(MatnrGroup::getName, baseMatParms.getGroupName()));
+ if (Objects.isNull(matnrGroup)) {
+ matnr.setGroupCode(matnrGroup.getCode()).setGroupId(matnrGroup.getId());
+ }
+ }
+
+ matnr.setName(baseMatParms.getMaktx())
+ .setColor(baseMatParms.getColor())
+ .setModel(baseMatParms.getModel())
+ .setSpec(baseMatParms.getSpec());
+
+ if (!matnrService.updateById(matnr)) {
+ throw new CoolException("鐗╂枡鏇存柊澶辫触锛侊紒");
+ }
+ }
+
+ return R.ok();
+ }
}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/MatnrLocLevel.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/MatnrLocLevel.java
new file mode 100644
index 0000000..39f54b3
--- /dev/null
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/MatnrLocLevel.java
@@ -0,0 +1,36 @@
+package com.vincent.rsf.server.manager.enums;
+
+/**
+ * 鐗╂枡搴撳瓨ABCD绫�
+ */
+public enum MatnrLocLevel {
+
+ //A銆丅, C锛� D
+ MATNR_LOC_LEVEL_A("0", "A绫�"),
+ MATNR_LOC_LEVEL_B("1", "B绫�"),
+ MATNR_LOC_LEVEL_C("2", "C绫�"),
+ MATNR_LOC_LEVEL_D("3", "D绫�"),
+ ;
+
+ MatnrLocLevel(String type, String desc) {
+ this.type = Short.parseShort(type);
+ this.desc = desc;
+ }
+
+ public Short type;
+
+ public String desc;
+
+ public static Short getTypeVal(String desc) {
+ if (desc.equals(MatnrLocLevel.MATNR_LOC_LEVEL_A.desc)) {
+ return MatnrLocLevel.MATNR_LOC_LEVEL_A.type;
+ } else if (desc.equals(MatnrLocLevel.MATNR_LOC_LEVEL_B.desc)) {
+ return MatnrLocLevel.MATNR_LOC_LEVEL_B.type;
+ } else if (desc.equals(MatnrLocLevel.MATNR_LOC_LEVEL_C.desc)) {
+ return MatnrLocLevel.MATNR_LOC_LEVEL_C.type;
+ } else if (desc.equals(MatnrLocLevel.MATNR_LOC_LEVEL_D.desc)) {
+ return MatnrLocLevel.MATNR_LOC_LEVEL_D.type;
+ }
+ return null;
+ }
+}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderItemServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderItemServiceImpl.java
index 3617b00..4dc8371 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderItemServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderItemServiceImpl.java
@@ -239,6 +239,13 @@
if (Objects.isNull(wkOrderItem.getAnfme()) || Double.compare(wkOrderItem.getAnfme(), 0.0) <= 0) {
throw new CoolException("璁″垝鏁颁笉鑳戒负绌猴紒锛�");
}
+
+ Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, wkOrderItem.getMatnrCode()));
+ if (Objects.isNull(matnr)) {
+ throw new CoolException("鏁版嵁閿欒锛氱墿鏂�" + wkOrderItem.getMatnrCode() + "涓嶅瓨鍦紒锛�");
+ }
+ wkOrderItem.setMatnrCode(matnr.getCode()).setMatnrId(matnr.getId());
+
//淇濆瓨鎵╁睍瀛楁
try {
StringBuffer sb = new StringBuffer();
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java
index fe62567..181193c 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java
@@ -17,6 +17,7 @@
import com.vincent.rsf.server.manager.controller.params.MatnrToGroupParams;
import com.vincent.rsf.server.manager.entity.MatnrGroup;
import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate;
+import com.vincent.rsf.server.manager.enums.MatnrLocLevel;
import com.vincent.rsf.server.manager.mapper.MatnrMapper;
import com.vincent.rsf.server.manager.entity.Matnr;
import com.vincent.rsf.server.manager.service.MatnrGroupService;
@@ -96,10 +97,10 @@
.setModel(template.getModel())
.setGroupCode(template.getGroupCode())
.setPurUnit(template.getPurUnit())
- .setStockLevel(!Objects.isNull(template.getStockLevel()) ? Short.parseShort(template.getStockLevel()) : 0)
+ .setStockLevel(MatnrLocLevel.getTypeVal(template.getStockLevel()))
.setSafeQty(!Objects.isNull(template.getSafeQty()) ? Double.parseDouble(template.getSafeQty()) : 0)
.setMinQty(!Objects.isNull(template.getMinQty()) ? Double.parseDouble(template.getMinQty()) : 0);
- if (Objects.isNull(template.getGroupCode()) && Objects.isNull(template.getGroupName())) {
+ if (!Objects.isNull(template.getGroupCode()) || !Objects.isNull(template.getGroupName())) {
MatnrGroup matnrGroups = matnrGroupService.getOne(new LambdaQueryWrapper<MatnrGroup>()
.eq(!Objects.isNull(template.getGroupCode()), MatnrGroup::getCode, template.getGroupCode())
.eq(!Objects.isNull(template.getGroupName()),MatnrGroup::getName, template.getGroupName()));
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TransferItemServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TransferItemServiceImpl.java
index 25cbcbf..e82223a 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TransferItemServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TransferItemServiceImpl.java
@@ -6,10 +6,12 @@
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.common.utils.FieldsUtils;
import com.vincent.rsf.server.manager.entity.Companys;
+import com.vincent.rsf.server.manager.entity.Matnr;
import com.vincent.rsf.server.manager.enums.CompanysType;
import com.vincent.rsf.server.manager.mapper.TransferItemMapper;
import com.vincent.rsf.server.manager.entity.TransferItem;
import com.vincent.rsf.server.manager.service.CompanysService;
+import com.vincent.rsf.server.manager.service.MatnrService;
import com.vincent.rsf.server.manager.service.TransferItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
@@ -25,6 +27,9 @@
@Autowired
private CompanysService companysService;
+
+ @Autowired
+ private MatnrService matnrService;
/**
@@ -48,6 +53,13 @@
if (Objects.isNull(wkOrderItem.getAnfme()) || Double.compare(wkOrderItem.getAnfme(), 0.0) <= 0) {
throw new CoolException("璁″垝鏁颁笉鑳戒负绌猴紒锛�");
}
+
+ Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getCode, wkOrderItem.getMatnrCode()));
+ if (Objects.isNull(matnr)) {
+ throw new CoolException("鏁版嵁閿欒锛氱墿鏂�" + wkOrderItem.getMatnrCode() + "涓嶅瓨鍦紒锛�");
+ }
+ wkOrderItem.setMatnrCode(matnr.getCode()).setMatnrId(matnr.getId());
+
// //淇濆瓨鎵╁睍瀛楁
try {
StringBuffer sb = new StringBuffer();
--
Gitblit v1.9.1