Browse Source

[fix]

工程管理 bom信息
修改添加bom页面物料子表损耗率表格内输入验证方法,去除百分号初始化添加;
修改bom列表页面子表表格损耗率百分号初始化方法;
修改编辑bom页面损耗率初始化及验证方法;
修改bom损耗率字段为double类型;
修改bom导入service方法,设置物料型号,导入损耗率为空时设置为0;
修改工程主管、工程经理、研发总监审批页面损耗率显示方法;
dev
王晓迪 2 months ago
parent
commit
9142bdf0e1
  1. 14
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java
  2. 9
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  3. 38
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html
  4. 37
      ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
  5. 44
      ruoyi-admin/src/main/resources/templates/erp/bom/edit.html
  6. 12
      ruoyi-admin/src/main/resources/templates/erp/bom/taskGcjlVerify.html
  7. 12
      ruoyi-admin/src/main/resources/templates/erp/bom/taskGczgVerify.html
  8. 12
      ruoyi-admin/src/main/resources/templates/erp/bom/taskYfzjVerify.html

14
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java

@ -76,7 +76,7 @@ public class ErpBom extends BaseEntity
private Integer useNum; private Integer useNum;
/** 损耗率 */ /** 损耗率 */
private String lossRate; private Double lossRate;
/** 父级id */ /** 父级id */
private Long parentId; private Long parentId;
@ -294,16 +294,16 @@ public class ErpBom extends BaseEntity
{ {
return useNum; return useNum;
} }
public void setLossRate(String lossRate) public void setLossRate(Double lossRate)
{ {
String[] lossRateArr = lossRate.split("\\%"); // String[] lossRateArr = lossRate.split("\\%");
if(lossRateArr.length>0){ // if(lossRateArr.length>0){
this.lossRate = lossRateArr[0]; // this.lossRate = lossRateArr[0];
} // }
this.lossRate = lossRate; this.lossRate = lossRate;
} }
public String getLossRate() public Double getLossRate()
{ {
return lossRate; return lossRate;
} }

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

@ -619,6 +619,7 @@ private ISysAttachService attachService;
* @param updateSupport 是否更新支持如果已存在则进行更新数据 * @param updateSupport 是否更新支持如果已存在则进行更新数据
* @return 结果 * @return 结果
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public String importData(List<ErpBomImportVo> bomImportVos, boolean updateSupport) { public String importData(List<ErpBomImportVo> bomImportVos, boolean updateSupport) {
@ -671,7 +672,7 @@ private ISysAttachService attachService;
ErpBomImportVo bomImportVo = bomImportVos.get(i); ErpBomImportVo bomImportVo = bomImportVos.get(i);
String materialNo = bomImportVo.getMaterialNo(); String materialNo = bomImportVo.getMaterialNo();
Integer useNum = bomImportVo.getUseNum(); Integer useNum = bomImportVo.getUseNum();
Double lossRate = bomImportVo.getLossRate(); Double lossRate = Optional.ofNullable(bomImportVo.getLossRate()).orElse(0.00);
String remark = bomImportVo.getRemark(); String remark = bomImportVo.getRemark();
ErpMaterialVo erpMaterialVo = materialMapper.selectErpMaterialByMaterialNo(materialNo); ErpMaterialVo erpMaterialVo = materialMapper.selectErpMaterialByMaterialNo(materialNo);
try try
@ -725,6 +726,7 @@ private ISysAttachService attachService;
fatherBom.setMaterialName(erpMaterialVo.getMaterialName()); fatherBom.setMaterialName(erpMaterialVo.getMaterialName());
fatherBom.setMaterialType(erpMaterialVo.getMaterialType()); fatherBom.setMaterialType(erpMaterialVo.getMaterialType());
fatherBom.setProcessMethod(erpMaterialVo.getProcessMethod()); fatherBom.setProcessMethod(erpMaterialVo.getProcessMethod());
fatherBom.setMaterialModel(erpMaterialVo.getMaterialModel());
fatherBom.setFileCode(erpMaterialVo.getFileCode()); fatherBom.setFileCode(erpMaterialVo.getFileCode());
fatherBom.setUnit(erpMaterialVo.getUnit()); fatherBom.setUnit(erpMaterialVo.getUnit());
fatherBom.setBrand(erpMaterialVo.getBrand()); fatherBom.setBrand(erpMaterialVo.getBrand());
@ -750,6 +752,7 @@ private ISysAttachService attachService;
subBom.setMaterialNo(materialNo); subBom.setMaterialNo(materialNo);
subBom.setMaterialName(erpMaterialVo.getMaterialName()); subBom.setMaterialName(erpMaterialVo.getMaterialName());
subBom.setMaterialType(erpMaterialVo.getMaterialType()); subBom.setMaterialType(erpMaterialVo.getMaterialType());
subBom.setMaterialModel(erpMaterialVo.getMaterialModel());
subBom.setProcessMethod(erpMaterialVo.getProcessMethod()); subBom.setProcessMethod(erpMaterialVo.getProcessMethod());
subBom.setUnit(erpMaterialVo.getUnit()); subBom.setUnit(erpMaterialVo.getUnit());
subBom.setBrand(erpMaterialVo.getBrand()); subBom.setBrand(erpMaterialVo.getBrand());
@ -757,7 +760,7 @@ private ISysAttachService attachService;
subBom.setWarehouseDept(erpMaterialVo.getWarehouseDept()); subBom.setWarehouseDept(erpMaterialVo.getWarehouseDept());
subBom.setFileCode(erpMaterialVo.getFileCode()); subBom.setFileCode(erpMaterialVo.getFileCode());
subBom.setUseNum(useNum); subBom.setUseNum(useNum);
subBom.setLossRate(String.valueOf(lossRate)); subBom.setLossRate(lossRate);
subBom.setParentId(parentId); subBom.setParentId(parentId);
subBom.setLevel(1L); subBom.setLevel(1L);
subBom.setSortNo(i+0L); subBom.setSortNo(i+0L);
@ -804,6 +807,8 @@ private ISysAttachService attachService;
erpBom1.setParentId(id); erpBom1.setParentId(id);
erpBom1.setCreateBy(ShiroUtils.getLoginName()); erpBom1.setCreateBy(ShiroUtils.getLoginName());
erpBom1.setCreateTime(DateUtils.getNowDate()); erpBom1.setCreateTime(DateUtils.getNowDate());
Double lossRate = Optional.ofNullable(erpBom1.getLossRate()).orElse(0.00);
erpBom1.setLossRate(lossRate);
// 新添加,理论上,刚添加的一阶物料默认审核通过,使用状态为是 // 新添加,理论上,刚添加的一阶物料默认审核通过,使用状态为是
// erpBom1.setAuditStatus("1"); // erpBom1.setAuditStatus("1");
// erpBom1.setUseStatus("1"); // erpBom1.setUseStatus("1");

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

@ -323,7 +323,6 @@
type : 'text', type : 'text',
//默认text //默认text
title : '用量', title : '用量',
mode:'inline',
validate : function(value) { validate : function(value) {
if (!value) { if (!value) {
return '用量不能为空'; return '用量不能为空';
@ -345,38 +344,30 @@
editor: { editor: {
defaultValue: '%', defaultValue: '%',
title: '损耗率(%)', title: '损耗率(%)',
mode: 'inline',
type: 'text', type: 'text',
// 编辑时同样附带百分比符号
formatter: function (value) {
return value + '%';
},
// 编辑后去除百分比符号
custom_getter: function (value) {
return value.replace('%', '');
}
}, },
validate : function (value) { validate : function (value) {
if (!value) { if (!value) {
return '损耗率不能为空'; return '损耗率不能为空';
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 if (isNaN(value)) return '损耗率必须是数字';
const match = value.match(regex); // 使用match方法查找所有匹配 // const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配
if (!match) { // const match = value.match(regex); // 使用match方法查找所有匹配
return '损耗率必须以百分比结尾'; // if (!match) {
} // return '损耗率必须以百分比结尾';
var num = value.replace('%', ''); // }
if (num < 0 || num > 100) { // var num = value.replace('%', '');
if (value < 0 || value > 100) {
return '损耗率必须大于等于0小于等于100'; return '损耗率必须大于等于0小于等于100';
} }
} }
}, },
formatter: function (value,row,index){ // formatter: function (value,row,index){
if(value == null || value == ""){ // if(value == null || value == ""){
return "0%"; // return "0%";
} // }
return value + "%"; // return value + "%";
}, // },
}, },
{ {
field: 'processMethod', field: 'processMethod',
@ -407,7 +398,6 @@
editable : { editable : {
type : 'text', type : 'text',
title : '备注', title : '备注',
mode:'inline',
validate : function(value) { validate : function(value) {
if (!value) { if (!value) {
return '备注不能为空'; return '备注不能为空';

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

@ -387,16 +387,11 @@
title: '损耗率', title: '损耗率',
formatter: function (value,row,index){ formatter: function (value,row,index){
if (value == null || value == ''){ if (value == null || value == ''){
return "%"; return "0.00%";
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 value = parseFloat(value).toFixed(2);
const match = value.match(regex); // 使用match方法查找所有匹配
if (match) {
return value;
}else{
return value + "%"; return value + "%";
} }
}
}, },
{ {
field: 'processMethod', field: 'processMethod',
@ -533,17 +528,22 @@
field: 'lossRate', field: 'lossRate',
title: '损耗率', title: '损耗率',
formatter: function (value,row,index){ formatter: function (value,row,index){
// if (value == null || value == ''){
// return "0%";
// }
// const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配
// const match = value.match(regex); // 使用match方法查找所有匹配
// if (match) {
// return value;
// }else{
// return value + "%";
// }
if (value == null || value == ''){ if (value == null || value == ''){
return "0%"; return "0.00%";
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 value = parseFloat(value).toFixed(2);
const match = value.match(regex); // 使用match方法查找所有匹配
if (match) {
return value;
}else{
return value + "%"; return value + "%";
} }
}
}, },
{ {
field: 'processMethod', field: 'processMethod',
@ -696,16 +696,11 @@
title: '损耗率', title: '损耗率',
formatter: function (value,row,index){ formatter: function (value,row,index){
if (value == null || value == ''){ if (value == null || value == ''){
return "0%"; return "0.00%";
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 value = parseFloat(value).toFixed(2);
const match = value.match(regex); // 使用match方法查找所有匹配
if (match) {
return value;
}else{
return value + "%"; return value + "%";
} }
}
}, },
{ {
field: 'processMethod', field: 'processMethod',

44
ruoyi-admin/src/main/resources/templates/erp/bom/edit.html

@ -240,7 +240,6 @@
editable : { editable : {
type : 'text', type : 'text',
title : '用量', title : '用量',
mode:'inline',
validate : function(value) { validate : function(value) {
if (!value) { if (!value) {
return '用量不能为空'; return '用量不能为空';
@ -262,44 +261,31 @@
editor: { editor: {
defaultValue: '%', defaultValue: '%',
title: '损耗率(%)', title: '损耗率(%)',
mode:'inline',
type: 'text', type: 'text',
// 编辑时同样附带百分比符号
formatter: function(value) {
return value + '%';
},
// 编辑后去除百分比符号
custom_getter: function(value) {
return value.replace('%', '');
}
}, },
validate : function (value) { validate : function (value) {
if (!value) { if (!value) {
return '损耗率不能为空'; return '损耗率不能为空';
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 if (isNaN(value)) return '损耗率必须是数字';
const match = value.match(regex); // 使用match方法查找所有匹配 // const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配
if (!match) { // const match = value.match(regex); // 使用match方法查找所有匹配
return '损耗率必须以百分比结尾'; // if (!match) {
} // return '损耗率必须以百分比结尾';
var num = value.replace('%', ''); // }
if (num < 0 || num > 100) { // var num = value.replace('%', '');
if (value < 0 || value > 100) {
return '损耗率必须大于等于0小于等于100'; return '损耗率必须大于等于0小于等于100';
} }
},
},
formatter: function (value,row,index){
if (value == null || value == ''){
return "%";
}
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配
const match = value.match(regex); // 使用match方法查找所有匹配
if (match) {
return value;
}else{
return value + "%";
} }
}, },
// formatter: function (value,row,index){
// if (value == null || value == ''){
// return "0.00%";
// }
// value = parseFloat(value).toFixed(2);
// return value + "%";
// },
}, },
{ {
field: 'processMethod', field: 'processMethod',

12
ruoyi-admin/src/main/resources/templates/erp/bom/taskGcjlVerify.html

@ -281,7 +281,8 @@
}, },
columns: [{ columns: [{
field: 'id', field: 'id',
title: '主键id' title: '主键id',
visible: false,
}, },
{ {
field: 'level', field: 'level',
@ -387,16 +388,11 @@
title: '损耗率', title: '损耗率',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null || value == ''){ if (value == null || value == ''){
return "%"; return "0.00%";
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 value = parseFloat(value).toFixed(2);
const match = value.match(regex); // 使用match方法查找所有匹配
if (match) {
return value;
} else {
return value + "%"; return value + "%";
} }
}
}, },
{ {
field: 'processMethod', field: 'processMethod',

12
ruoyi-admin/src/main/resources/templates/erp/bom/taskGczgVerify.html

@ -281,7 +281,8 @@
}, },
columns: [{ columns: [{
field: 'id', field: 'id',
title: '主键id' title: '主键id',
visible: false,
}, },
{ {
field: 'level', field: 'level',
@ -387,16 +388,11 @@
title: '损耗率', title: '损耗率',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null || value == ''){ if (value == null || value == ''){
return "%"; return "0.00%";
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 value = parseFloat(value).toFixed(2);
const match = value.match(regex); // 使用match方法查找所有匹配
if (match) {
return value;
} else {
return value + "%"; return value + "%";
} }
}
}, },
{ {
field: 'processMethod', field: 'processMethod',

12
ruoyi-admin/src/main/resources/templates/erp/bom/taskYfzjVerify.html

@ -280,7 +280,8 @@
}, },
columns: [{ columns: [{
field: 'id', field: 'id',
title: '主键id' title: '主键id',
visible: false,
}, },
{ {
field: 'level', field: 'level',
@ -386,16 +387,11 @@
title: '损耗率', title: '损耗率',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null || value == ''){ if (value == null || value == ''){
return "%"; return "0.00%";
} }
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 value = parseFloat(value).toFixed(2);
const match = value.match(regex); // 使用match方法查找所有匹配
if (match) {
return value;
} else {
return value + "%"; return value + "%";
} }
}
}, },
{ {
field: 'processMethod', field: 'processMethod',

Loading…
Cancel
Save