Browse Source

[update]:BOM新增时校验料号是否存在

dev
youjianchi 9 months ago
parent
commit
73f4573490
  1. 10
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java
  3. 9
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  4. 27
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html

10
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java

@ -249,4 +249,14 @@ public class ErpBomController extends BaseController
return map;
}
/**
* 校验料号
*/
@GetMapping("/checkMaterialNoUnique")
@ResponseBody
public String checkMaterialNoUnique(@RequestParam("materialNo") String materialNo)
{
return erpBomService.checkMaterialNoUnique(materialNo);
}
}

2
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java

@ -99,4 +99,6 @@ public interface IErpBomService
*/
public ErpBom selectBomByBomNo(String bomNo);
String checkMaterialNoUnique(String materialNo);
}

9
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java

@ -249,6 +249,15 @@ public class ErpBomServiceImpl implements IErpBomService
return erpBomMapper.selectBomByBomNo(bomNo);
}
@Override
public String checkMaterialNoUnique(String materialNo) {
ErpBom erpBom = erpBomMapper.selectErpBomByOneMaterialNo(materialNo);
if(erpBom!=null){
return "1";
}
return "0";
}
/**
* 新增bom信息
*

27
ruoyi-admin/src/main/resources/templates/erp/bom/add.html

@ -97,9 +97,36 @@
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var bomLevelSelectDatas = [[${@dict.getTypeSelect('bomLevel')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
$("#form-bom-add").validate({
onkeyup: false,
rules:{
materialNo:{
remote: {
url: prefix + "/checkMaterialNoUnique",
type: "get",
dataType: "json",
data: {
"materialNo": function() {
console.log($("#materialNo").val())
return $.common.trim($("#materialNo").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
}
},
messages: {
"materialNo": {
remote: "料号已经存在",
},
},
focusCleanup: true
});
$(function() {
$("#materialNo").select2({
theme: "bootstrap",

Loading…
Cancel
Save