From 607254d0f4283def3d384511d8e2f4486998d18b Mon Sep 17 00:00:00 2001
From: zhangsiqi <2825463979@qq.com>
Date: Fri, 5 Jul 2024 19:46:30 +0800
Subject: [PATCH] =?UTF-8?q?[feat]=20erpBom=E9=A1=B5=E9=9D=A2bom=E5=AD=90?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9=E5=85=A5=E5=BA=93=E9=83=A8?=
=?UTF-8?q?=E9=97=A8=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../erp/service/impl/ErpBomServiceImpl.java | 4 +-
.../resources/mapper/erp/ErpBomMapper.xml | 4 +-
.../main/resources/templates/erp/bom/add.html | 25 ++-
.../main/resources/templates/erp/bom/bom.html | 153 +++++++-----------
4 files changed, 72 insertions(+), 114 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
index 8553a5c7..09ad985e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
@@ -543,6 +543,7 @@ private ISysAttachService attachService;
fatherBom.setUnit(erpMaterialVo.getUnit());
fatherBom.setBrand(erpMaterialVo.getBrand());
fatherBom.setDescribe(erpMaterialVo.getDescribe());
+ fatherBom.setWarehouseDept(erpMaterialVo.getWarehouseDept());
fatherBom.setParentId(0L);
fatherBom.setLevel(0L);
erpBomMapper.insertErpBom(fatherBom);
@@ -565,6 +566,7 @@ private ISysAttachService attachService;
subBom.setUnit(erpMaterialVo.getUnit());
subBom.setBrand(erpMaterialVo.getBrand());
subBom.setDescribe(erpMaterialVo.getDescribe());
+ subBom.setWarehouseDept(erpMaterialVo.getWarehouseDept());
subBom.setUseNum(useNum);
subBom.setLossRate(String.valueOf(lossRate));
subBom.setParentId(parentId);
@@ -628,8 +630,8 @@ private ISysAttachService attachService;
* @param erpBom
* @return
*/
- @Override
@Transactional(rollbackFor = Exception.class)
+ @Override
public ProcessInstance submitApply(ErpBom erpBom) {
SysUser user = ShiroUtils.getSysUser();
erpBom.setApplyUser(user.getLoginName());
diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
index 4d61fe05..8f9431d2 100644
--- a/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
+++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
@@ -56,11 +56,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-
+
-
+
diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html
index fe274520..d4e04253 100644
--- a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html
+++ b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html
@@ -115,7 +115,6 @@
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
var loginName = [[${@permission.getPrincipalProperty('loginName')}]];
- var userName = [[${@permission.getPrincipalProperty('userName')}]];
$("#form-bom-add").validate({
onkeyup: false,
rules:{
@@ -166,7 +165,7 @@
var usertData = res.rows;
for (let i in usertData) {
$("#selectEngineer").append(
- "");
+ "");
}
$("#selectEngineer").val(loginName);
} else {
@@ -228,15 +227,15 @@
title: 'bom主键id',
visible: false
},
- {
- field: 'index',
- align: 'center',
- title: "序号",
- formatter: function (value, row, index) {
- var columnIndex = $.common.sprintf("", $.table.serialNumber(index));
- return columnIndex + $.table.serialNumber(index);
- }
- },
+ {
+ field: 'index',
+ align: 'center',
+ title: "序号",
+ formatter: function (value, row, index) {
+ var columnIndex = $.common.sprintf("", $.table.serialNumber(index));
+ return columnIndex + $.table.serialNumber(index);
+ }
+ },
{
field: 'level',
align: 'center',
@@ -355,8 +354,8 @@
}
},
formatter: function (value,row,index){
- if(value == null){
- return "%";
+ if(value == null || value == ""){
+ return "0%";
}
return value + "%";
},
diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
index 9367ece7..4f1b3307 100644
--- a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
+++ b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
@@ -144,107 +144,49 @@
columns: [{
checkbox: true
},
- {title: '主键ID',field: 'id'},
+ { title: '主键ID',field: 'id'},
{ title: '流程实例ID',field: 'instanceId',visible: false},
{ title: '流程提交实例ID',field: 'submitInstanceId',visible: false},
- {title: '流程作废实例ID', field: 'cancelInstanceId',visible: false},
+ { title: '流程作废实例ID', field: 'cancelInstanceId',visible: false},
{ title: '流程恢复实例ID',field: 'restoreInstanceId',visible: false},
{ title: '流程实例类型',field: 'instanceTypeName', visible: false},
- {
- field: 'applyUser',
- title: '申请人ID',
- visible: false
- },
- {
- field: 'applyUserName',
- title: '申请人',
- formatter: function(value, row, index) {
- return '' + (value ? value : "-") + '';
- }
- },
- {
- field: 'applyTime',
- title: '申请时间',
- sortable: true,
- },
- {
- field: 'taskId',
- title: '当前任务ID',
- visible: false,
-
- },
- {
- field: 'todoUserId',
- title: '待办用户ID',
- visible: false,
- },
- {
- field: 'taskName',
- title: '当前任务名称',
- align: 'center',
+ { title: '申请人ID',field: 'applyUser',visible: false},
+ { title: '申请人',field: 'applyUserName',
+ formatter: function(value, row, index) {return '' + (value ? value : "-") + '';}
+ },
+ { title: '申请时间',field: 'applyTime',sortable: true,},
+ { title: '当前任务ID',field: 'taskId',visible: false,},
+ { title: '待办用户ID',field: 'todoUserId',visible: false,},
+ { title: '当前任务名称',field: 'taskName',align: 'center',
formatter: function(value, row, index) {
return '' + value + '';
}
},
- {
- field: 'auditStatus',
- title: '审核状态',
- sortable: true,
+ { title: '审核状态',field: 'auditStatus',sortable: true,
formatter: function(value, row, index) {
return $.table.selectDictLabel(auditStatusDatas, value);
}
},
- {
- field: 'useStatus',
- title: '使用状态',
- sortable: true,
+ { title: '使用状态',field: 'useStatus',sortable: true,
formatter: function(value, row, index) {
return $.table.selectDictLabel(useStatusDatas, value);
}
},
- {title: '工程员',field: 'engineer', sortable: true,},
- {title: 'bom号',field: 'bomNo', sortable: true,},
- {title: '关联料号',field: 'materialNo', sortable: true,},
- {
- field: 'photoUrl',
- title: '图片',
- formatter: function(value, row, index) {
- return $.table.imageView(value);
- }
- },
- { title: '物料名称',field: 'materialName', sortable: true,},
- {
- field: 'materialType',
- title: '物料类型',
- sortable: true,
- formatter: function(value, row, index) {
- return $.table.selectCategoryLabel(materialTypeDatas, value);
- }
- },
- {
- field: 'processMethod',
- title: '半成品类型',
- sortable: true,
- formatter: function(value, row, index) {
- return $.table.selectDictLabel(processMethodDatas, value);
- }
- },
- {
- field: 'unit',
- title: '单位',
- sortable: true,
+ { title: '工程员',field: 'engineer', sortable: true,},
+ { title: 'bom号',field: 'bomNo', sortable: true,},
+ { title: '关联料号',field: 'materialNo', sortable: true,},
+ { title: '图片',field: 'photoUrl',formatter: function(value, row, index) {return $.table.imageView(value);}},
+ { title: '物料名称',field: 'materialName', sortable: true,},
+ { title: '物料类型',field: 'materialType',sortable: true,
+ formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}},
+ { title: '加工方式',field: 'processMethod',sortable: true,
+ formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}
},
+ { title: '单位',field: 'unit', sortable: true,},
{ title: '品牌',field: 'brand', sortable: true,},
{title: '描述',field: 'describe', sortable: true,},
- {
- field: 'parentId',
- title: '父级id',
- visible:false
- },
- {
- field: 'level',
- title: '层级',
- visible:false,
+ { title: '父级id',field: 'parentId',visible:false },
+ {title: '层级',field: 'level', visible:false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(levelDatas, value);
}
@@ -556,16 +498,22 @@
}
}
},
- {
- field: 'lossRate',
- title: '损耗率',
- formatter: function (value,row,index){
- if (value == null || value == ''){
- return "/";
+ {
+ field: 'lossRate',
+ title: '损耗率',
+ 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 + "%";
+ }
}
- return value + "%";
- }
- },
+ },
{
field: 'processMethod',
title: '半成品类型',
@@ -712,13 +660,22 @@
}
},
- {
- field: 'lossRate',
- title: '损耗率(%)',
- formatter:function (value,row,index){
- return value + '%';
- }
- },
+ {
+ field: 'lossRate',
+ title: '损耗率',
+ 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 + "%";
+ }
+ }
+ },
{
field: 'processMethod',
title: '半成品类型',