Browse Source

[update]:物料信息作废、恢复功能;分类字典渲染提取公共方法;作废、恢复功能提取公共方法

erp、
youjianchi 1 year ago
parent
commit
3a9e690b27
  1. 25
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
  2. 14
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java
  3. 14
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java
  4. 12
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
  5. 8
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
  6. 35
      ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
  7. 29
      ruoyi-admin/src/main/resources/templates/erp/material/material.html
  8. 10
      ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java

25
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

14
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);
/**
* 删除物料信息
*

14
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);
}

12
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);

8
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml

@ -158,4 +158,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<update id="cancelErpMaterialById" parameterType="Long">
update erp_material set del_flag = '1' where id = #{id}
</update>
<update id="restoreErpMaterialById" parameterType="Long">
update erp_material set del_flag = '0' where id = #{id}
</update>
</mapper>

35
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();

29
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('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a> ');
actions.push('<a class="btn btn-success btn-xs ' + auditFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-file-o"></i>审核</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>作废</a>');
actions.push('<a class="btn btn-danger btn-xs ' + unRemoveFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>恢复</a>');
if(row.delFlag == '0'){
actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i>作废</a>');
}else{
actions.push('<a class="btn btn-success btn-xs ' + restoreFlag + '" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i>恢复</a>');
}
return actions.join('');
}
}]

10
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java

@ -56,4 +56,14 @@ public enum BusinessType
* 清空
*/
CLEAN,
/**
* 作废
*/
CANCEL,
/**
* 恢复
*/
RESTORE,
}

Loading…
Cancel
Save