diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
index 4d55e5ef..b9eedc92 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
@@ -127,7 +127,30 @@ public class ErpMaterialController extends BaseController
}
/**
- * 校验用户名
+ * 作废物料信息
+ */
+ @RequiresPermissions("erp:material:cancel")
+ @Log(title = "物料信息", businessType = BusinessType.CANCEL)
+ @GetMapping( "/cancel/{id}")
+ @ResponseBody
+ public AjaxResult cancel(@PathVariable("id") Long id){
+ return toAjax(erpMaterialService.cancelErpMaterialById(id));
+ }
+
+ /**
+ * 恢复物料信息
+ */
+ @RequiresPermissions("erp:material:restore")
+ @Log(title = "物料信息", businessType = BusinessType.RESTORE)
+ @GetMapping( "/restore/{id}")
+ @ResponseBody
+ public AjaxResult restore(@PathVariable("id")Long id)
+ {
+ return toAjax(erpMaterialService.restoreErpMaterialById(id));
+ }
+
+ /**
+ * 校验料号
*/
@PostMapping("/checkMaterialNoUnique")
@ResponseBody
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java
index a96ce708..b62d32cc 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java
@@ -43,6 +43,20 @@ public interface ErpMaterialMapper
*/
public int updateErpMaterial(ErpMaterial erpMaterial);
+ /**
+ * 作废物料信息
+ * @param id
+ * @return
+ */
+ int cancelErpMaterialById(Long id);
+
+ /**
+ * 恢复物料信息
+ * @param id
+ * @return
+ */
+ int restoreErpMaterialById(Long id);
+
/**
* 删除物料信息
*
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java
index 8c88a4cf..2ddec3d5 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java
@@ -59,5 +59,19 @@ public interface IErpMaterialService
*/
public int deleteErpMaterialById(Long id);
+ /**
+ * 作废物料信息
+ * @param id
+ * @return
+ */
+ int cancelErpMaterialById(Long id);
+
+ /**
+ * 恢复物料信息
+ * @param id
+ * @return
+ */
+ int restoreErpMaterialById(Long id);
+
String checkMaterialNoUnique(String materialNo);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
index 8881a583..e00a1ce6 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
@@ -27,7 +27,7 @@ import com.ruoyi.common.core.text.Convert;
* @date 2023-11-12
*/
@Service
-public class ErpMaterialServiceImpl implements IErpMaterialService
+public class ErpMaterialServiceImpl implements IErpMaterialService
{
@Autowired
private ErpMaterialMapper erpMaterialMapper;
@@ -156,6 +156,16 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
return erpMaterialMapper.deleteErpMaterialById(id);
}
+ @Override
+ public int cancelErpMaterialById(Long id) {
+ return erpMaterialMapper.cancelErpMaterialById(id);
+ }
+
+ @Override
+ public int restoreErpMaterialById(Long id) {
+ return erpMaterialMapper.restoreErpMaterialById(id);
+ }
+
@Override
public String checkMaterialNoUnique(String materialNo) {
int count = erpMaterialMapper.checkMaterialNoUnique(materialNo);
diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
index 4f5629b3..fdcad135 100644
--- a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
+++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
@@ -158,4 +158,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
+ update erp_material set del_flag = '1' where id = #{id}
+
+
+
+ update erp_material set del_flag = '0' where id = #{id}
+
+
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
index 79e3524e..30205814 100644
--- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
+++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
@@ -529,6 +529,25 @@ var table = {
});
return actions.join('');
},
+ // 回显分类字典
+ selectCategoryLabel: function(datas, value) {
+ if ($.common.isEmpty(datas) || $.common.isEmpty(value)) {
+ return '';
+ }
+ var categoryName = '';
+ $.each(datas, function(index, category) {
+ var childName = category.name;
+ var childSonArray = category.children;
+ $.each(childSonArray, function(index, son) {
+ var sonCode = son.code;
+ var sonName = son.name;
+ if (sonCode == value) {
+ categoryName = childName+"-"+sonName;
+ }
+ });
+ });
+ return categoryName;
+ },
// 显示表格指定列
showColumn: function(column, tableId) {
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
@@ -1033,6 +1052,22 @@ var table = {
$.operate.submit(url, "post", "json", data);
});
},
+ // 作废信息
+ cancel: function(id) {
+ table.set();
+ $.modal.confirm("确定作废该条" + table.options.modalName + "信息吗?", function() {
+ var url = $.common.isEmpty(id) ? table.options.cancelUrl : table.options.cancelUrl.replace("{id}", id);
+ $.operate.get(url);
+ });
+ },
+ // 恢复信息
+ restore: function(id) {
+ table.set();
+ $.modal.confirm("确定恢复该条" + table.options.modalName + "信息吗?", function() {
+ var url = $.common.isEmpty(id) ? table.options.restoreUrl : table.options.restoreUrl.replace("{id}", id);
+ $.operate.get(url);
+ });
+ },
// 清空信息
clean: function() {
table.set();
diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/material.html b/ruoyi-admin/src/main/resources/templates/erp/material/material.html
index 87a18eaf..dc3801fd 100644
--- a/ruoyi-admin/src/main/resources/templates/erp/material/material.html
+++ b/ruoyi-admin/src/main/resources/templates/erp/material/material.html
@@ -108,7 +108,8 @@
var editFlag = [[${@permission.hasPermi('erp:material:edit')}]];
var auditFlag = [[${@permission.hasPermi('erp:material:audit')}]];
var removeFlag = [[${@permission.hasPermi('erp:material:remove')}]];
- var unRemoveFlag = [[${@permission.hasPermi('erp:material:unRemove')}]];
+ var cancelFlag = [[${@permission.hasPermi('erp:material:cancel')}]];
+ var restoreFlag = [[${@permission.hasPermi('erp:material:restore')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
@@ -123,6 +124,8 @@
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
+ cancelUrl: prefix + "/cancel/{id}",
+ restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
modalName: "物料信息",
columns: [{
@@ -170,22 +173,7 @@
field: 'materialType',
title: '物料类型',
formatter: function(value, row, index) {
- if ($.common.isEmpty(materialTypeDatas) || $.common.isEmpty(value)) {
- return '';
- }
- var materialTypeName = '';
- $.each(materialTypeDatas, function(index, category) {
- var childName = category.name;
- var childSonArray = category.children;
- $.each(childSonArray, function(index, son) {
- var sonCode = son.code;
- var sonName = son.name;
- if (sonCode == value) {
- materialTypeName = childName+"-"+sonName;
- }
- });
- });
- return materialTypeName;
+ return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
@@ -246,8 +234,11 @@
actions.push('编辑 ');
actions.push('详情 ');
actions.push('审核 ');
- actions.push('作废');
- actions.push('恢复');
+ if(row.delFlag == '0'){
+ actions.push('作废');
+ }else{
+ actions.push('恢复');
+ }
return actions.join('');
}
}]
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
index 24d076a4..3d4a8a8e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
@@ -56,4 +56,14 @@ public enum BusinessType
* 清空
*/
CLEAN,
+
+ /**
+ * 作废
+ */
+ CANCEL,
+
+ /**
+ * 恢复
+ */
+ RESTORE,
}