模具 工序行用component_line关联

This commit is contained in:
xielue 2023-09-19 17:36:43 +08:00
parent c80453cb57
commit 928c7c0044
6 changed files with 81 additions and 47 deletions

View File

@ -1,6 +1,7 @@
import XEUtils from 'xe-utils' // 加载xe-utils
import JSONbig from 'json-bigint'
import guid from './guid' // 加载modal
export default {
toBigInt(id) {
@ -12,6 +13,10 @@ export default {
},
getGuid(){
return new guid().newGUID();
},
getDateString(cellValue) {
if (!cellValue) {
return '';
@ -62,9 +67,9 @@ export default {
}
if(rule.dataRule.isSelect){
if(value == 0){
data[rule.field] =null;
if (rule.dataRule.isSelect) {
if (value == 0) {
data[rule.field] = null;
}
}
}
@ -139,7 +144,7 @@ export default {
value = 0;
}
item[rule.field] = parseInt(value);
}
}
}
else if (rule.type == "number" || rule.type == "float") {
@ -151,7 +156,7 @@ export default {
value = 0;
}
item[rule.field] = parseFloat(value);
}
}
}
else if (rule.type == "timestamp") {
if (value) {
@ -160,7 +165,7 @@ export default {
}
} else {
item[rule.field] = null;
}
}
}
else if (rule.type == "bigint") {
if (!item[rule.field]) {
@ -213,5 +218,5 @@ export default {
d = list;
}
return d;
}
}
}

View File

@ -0,0 +1,47 @@
function GUID() {
this.date = new Date(); /* 判断是否初始化过,如果初始化过以下代码,则以下代码将不再执行,实际中只执行一次 */
if (typeof this.newGUID != 'function') { /* 生成GUID码 */
GUID.prototype.newGUID = function () {
this.date = new Date();
var guidStr = '';
let sexadecimalDate = this.hexadecimal(this.getGUIDDate(), 16);
let sexadecimalTime = this.hexadecimal(this.getGUIDTime(), 16);
for (var i = 0; i < 9; i++) {
guidStr += Math.floor(Math.random() * 16).toString(16);
}
guidStr += sexadecimalDate;
guidStr += sexadecimalTime;
while (guidStr.length < 32) {
guidStr += Math.floor(Math.random() * 16).toString(16);
}
return this.formatGUID(guidStr);
}
/* * 功能获取当前日期的GUID格式即8位数的日期19700101 * 返回值返回GUID日期格式的字条串 */
GUID.prototype.getGUIDDate = function () {
return this.date.getFullYear() + this.addZero(this.date.getMonth() + 1) + this.addZero(this.date.getDay());
}
/* * 功能获取当前时间的GUID格式即8位数的时间包括毫秒毫秒为2位数12300933 * 返回值返回GUID日期格式的字条串 */
GUID.prototype.getGUIDTime = function () {
return this.addZero(this.date.getHours()) + this.addZero(this.date.getMinutes()) + this.addZero(this.date.getSeconds()) + this.addZero(parseInt(this.date.getMilliseconds() / 10));
}
/* * 功能: 为一位数的正整数前面添加0如果是可以转成非NaN数字的字符串也可以实现 * 参数: 参数表示准备再前面添加0的数字或可以转换成数字的字符串 * 返回值: 如果符合条件返回添加0后的字条串类型否则返回自身的字符串 */
GUID.prototype.addZero = function (num) {
if (Number(num).toString() != 'NaN' && num >= 0 && num < 10) {
return '0' + Math.floor(num);
} else {
return num.toString();
}
}
/* * 功能将y进制的数值转换为x进制的数值 * 参数第1个参数表示欲转换的数值第2个参数表示欲转换的进制第3个参数可选表示当前的进制数如不写则为10 * 返回值:返回转换后的字符串 */GUID.prototype.hexadecimal = function (num, x, y) {
if (y != undefined) { return parseInt(num.toString(), y).toString(x); }
else { return parseInt(num.toString()).toString(x); }
}
/* * 功能格式化32位的字符串为GUID模式的字符串 * 参数第1个参数表示32位的字符串 * 返回值标准GUID格式的字符串 */
GUID.prototype.formatGUID = function (guidStr) {
var str1 = guidStr.slice(0, 8) + '-', str2 = guidStr.slice(8, 12) + '-', str3 = guidStr.slice(12, 16) + '-', str4 = guidStr.slice(16, 20) + '-', str5 = guidStr.slice(20);
return str1 + str2 + str3 + str4 + str5;
}
}
}
export default GUID;

View File

@ -524,6 +524,7 @@ export default {
pageAdd2(row) {
const $table = this.$refs.xTable2
const record = {
component_line:this.detailsData[0].component_line,
component_id:this.detailsData[0].component_id
}
if (row) {
@ -618,7 +619,7 @@ export default {
},
beforeEditMethod({ column, row }) {
if (this.pageStatus == "approved") {
if (this.readonly) {
return false;
}
console.log(column, row);

View File

@ -456,7 +456,7 @@ export default {
header: item.component_detail.name
};
this.detailsData2.forEach(pitem => {
if (pitem.component_id && pitem.component_id.toString() == item.component_id.toString()) {
if (pitem.component_line == item.component_line) {
if (this.departmentId) {
if (pitem.department_id && pitem.department_id.toString() == this.departmentId) {
info.data.mold_production_order_component_processes.push(pitem);
@ -474,9 +474,7 @@ export default {
keys.push(key);
infos.push(info);
})
console.log(infos)
})
this.collapseActiveKey = keys;
@ -858,14 +856,13 @@ export default {
})
}
})
console.log(JSON.stringify(departments))
departments.forEach((department, index) => {
let details2 = JSON.parse(JSON.stringify(this.detailsData2));
let ds2 = [];
let componentIds = [];
let component_line_list = [];
details2.forEach(item => {
if (item.component_detail && item.component_detail.name) {
item.component_detail_name = item.component_detail.name;
@ -879,8 +876,8 @@ export default {
if (!item.component_id) {
return;
}
if (!componentIds.filter(a => a == item.component_id.toString()).length) {
componentIds.push(item.component_id.toString());
if (!component_line_list.filter(a => a == item.component_line).length) {
component_line_list.push(item.component_line);
}
if (item.process_detail && item.process_detail.name) {
item.process_detail_name = item.process_detail.name;
@ -897,7 +894,7 @@ export default {
});
let groups = []; //
componentIds.forEach(componentId => {
component_line_list.forEach(component_line => {
let group = {};
let d1 = [];
@ -916,13 +913,13 @@ export default {
item.send_time = this.getDateValueString(item.send_time);
item.complete_time = this.getDateValueString(item.complete_time);
item.production_type = item.production_type == 1 ?'正常布产' :'委外布产';
if (item.component_id && item.component_id.toString() == componentId) {
if (item.component_line == component_line) {
d1.push(item);
}
})
ds2.forEach(item => {
if (item.component_id && item.component_id.toString() == componentId) {
if (item.component_line == component_line) {
d2.push(item);
}
})

View File

@ -455,10 +455,9 @@ export default {
header: item.component_detail.name
};
this.detailsData2.forEach(pitem => {
if (pitem.component_id && pitem.component_id.toString() == item.component_id.toString()) {
if (pitem.component_line == item.component_line) {
info.data.mold_production_order_component_processes.push(pitem);
}
}
});
keys.push(key);
infos.push(info);
@ -467,8 +466,7 @@ export default {
this.collapseActiveKey = keys;
this.infos = infos
console.log(JSON.stringify(this.infos))
},
setPageReadonly(readonly) {
@ -525,20 +523,24 @@ export default {
}).then((a) => { //
if (a.data && a.data.mold_component) {
let row = a.data.mold_component;
if (this.existComonent({ component_id: row.id.toString() })) {
this.$mk.error("该部件已经存在");
return;
}
//if (this.existComonent({ component_id: row.id.toString() })) {
//this.$mk.error("");
//return;
//}
let mold_component_processes = row.mold_component_processes || [];
let currentAddRows1 = [];
let currentAddRows2 = [];
let component_line = this.$mk.getGuid();
currentAddRows1.push({
component_line: component_line,
component_id: row.id,
component_num: 1,
component_detail: { id: row.id, name: row.name },
})
mold_component_processes.forEach(pitem => {
currentAddRows2.push({
component_line: component_line,
component_id: row.id,
process_id: pitem.mes_processes_id,
process_detail: { id: pitem.mes_processes_id, name: pitem.mes_processes.name },

View File

@ -399,24 +399,6 @@ var config = {
"type": "text"
}
},
printTemplateProgress2: {
"options": {
"left": 201,
"top": 117 + 100,
"height": 16,
"width": 382.5,
"field": "progress",
"fontSize": 15,
"title": "进度2",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "进度X",
"type": "text"
}
},
};