|
|
@@ -304,38 +304,7 @@
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true
|
|
|
},
|
|
|
- // {
|
|
|
- // prop: 'bomType',
|
|
|
- // label: 'BOM分类',
|
|
|
- // align: 'center',
|
|
|
- // width: 100,
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // formatter: (row) => {
|
|
|
- // if (row.bomType == 1) {
|
|
|
- // return '产品(PBOM)';
|
|
|
- // }
|
|
|
- // if (row.bomType == 2) {
|
|
|
- // return '加工(MBOM)';
|
|
|
- // }
|
|
|
- // if (row.bomType == 3) {
|
|
|
- // return '装配(ABOM)';
|
|
|
- // }
|
|
|
- // return '';
|
|
|
- // }
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: 'bomCategoryVersions',
|
|
|
- // label: 'BOM版本',
|
|
|
- // align: 'center',
|
|
|
- // width: 100,
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // formatter: (row) => {
|
|
|
- // if (row.bomCategoryName) {
|
|
|
- // return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
|
|
|
- // }
|
|
|
- // return '';
|
|
|
- // }
|
|
|
- // },
|
|
|
+
|
|
|
{
|
|
|
prop: 'brandNum',
|
|
|
label: '牌号',
|
|
|
@@ -474,141 +443,6 @@
|
|
|
// this.$refs.salesToProductionRef.open(this.selection, type);
|
|
|
},
|
|
|
|
|
|
- async goProduct() {
|
|
|
- console.log(this.selection, 'this.selection 33');
|
|
|
- if (!this.selection.length) {
|
|
|
- return this.$message.warning('请先勾选一个或多个订单!');
|
|
|
- }
|
|
|
- const productCode = this.selection[0].categoryCode;
|
|
|
- const orderType = this.selection[0].orderType;
|
|
|
- const produceRoutingId = this.selection[0].produceRoutingId;
|
|
|
- const measuringUnit = this.selection[0].measuringUnit;
|
|
|
- const factoriesId = this.selection[0].applyFactoriesId;
|
|
|
- const factoriesIdName = this.selection[0].applyFactoriesName;
|
|
|
- const bomCategoryId = this.selection[0].bomCategoryId;
|
|
|
- const saleType = this.selection[0].saleType;
|
|
|
- let produceType = this.selection[0].produceType[0];
|
|
|
- // if(!factoriesId){
|
|
|
- // this.$message.warning('工厂未选择!');
|
|
|
- // return;
|
|
|
- // }
|
|
|
-
|
|
|
- for (var i = 0; i < this.selection.length; i++) {
|
|
|
- if (productCode != this.selection[i].productCode) {
|
|
|
- return this.$message.warning('产品编码不一致!');
|
|
|
- }
|
|
|
- if (orderType != this.selection[i].orderType) {
|
|
|
- return this.$message.warning('订单类型不一致!');
|
|
|
- }
|
|
|
- if (saleType != this.selection[i].saleType) {
|
|
|
- return this.$message.warning('销售类型不一致!');
|
|
|
- }
|
|
|
- if (produceRoutingId != this.selection[i].produceRoutingId) {
|
|
|
- return this.$message.warning('工艺路线不一致!');
|
|
|
- }
|
|
|
- if (measuringUnit != this.selection[i].measuringUnit) {
|
|
|
- return this.$message.warning('计量单位不一致!');
|
|
|
- }
|
|
|
- if (factoriesId != this.selection[i].factoriesId) {
|
|
|
- return this.$message.warning('所属工厂不一致!');
|
|
|
- }
|
|
|
- }
|
|
|
- const list = [];
|
|
|
- let startTime = '';
|
|
|
- let endTime = '';
|
|
|
- this.selection.map((item) => {
|
|
|
- if (!startTime) {
|
|
|
- startTime = item.releaseTime;
|
|
|
- } else {
|
|
|
- startTime =
|
|
|
- this.compareTimes(startTime, item.releaseTime) == 1
|
|
|
- ? item.releaseTime
|
|
|
- : startTime;
|
|
|
- }
|
|
|
- if (!endTime) {
|
|
|
- endTime = item.deliveryTime;
|
|
|
- } else {
|
|
|
- endTime =
|
|
|
- this.compareTimes(endTime, item.deliveryTime) == 2
|
|
|
- ? item.deliveryTime
|
|
|
- : endTime;
|
|
|
- }
|
|
|
- list.push(item.id);
|
|
|
- });
|
|
|
- if (produceRoutingId && !bomCategoryId) {
|
|
|
- produceType = '';
|
|
|
- }
|
|
|
- console.log(this.selection, 'this.selection 3333');
|
|
|
- let categoryId = this.selection[0].categoryId;
|
|
|
- let params = { categoryId: categoryId };
|
|
|
- const res = await listBomType(params);
|
|
|
- console.log(res, 'res 000');
|
|
|
- let bomMap = {
|
|
|
- 1: { code: 1, name: 'PBOM' },
|
|
|
- 2: { code: 2, name: 'MBOM' },
|
|
|
- 3: { code: 3, name: 'ABOM' }
|
|
|
- };
|
|
|
- let arr = [];
|
|
|
- res.map((item) => {
|
|
|
- if (bomMap[item.bomType]) {
|
|
|
- arr.push(bomMap[item.bomType]);
|
|
|
- delete bomMap[item.bomType];
|
|
|
- }
|
|
|
- });
|
|
|
- if (arr.length) {
|
|
|
- let obj = arr.find((el) => el.code == produceType);
|
|
|
- produceType = obj
|
|
|
- ? produceType
|
|
|
- : arr.filter((el) => el.code != 1)?.[0]?.code;
|
|
|
- }
|
|
|
- if (arr.length == 0) {
|
|
|
- produceType = '';
|
|
|
- }
|
|
|
- console.log(produceType, 'produceType');
|
|
|
- console.log(arr, 'arr 222');
|
|
|
- // const res = await findBomCategoryByCategoryId(categoryId);
|
|
|
- // let arr = [];
|
|
|
- // if (res.length > 0) {
|
|
|
- // let obj = res.find((item) => item.id === bomCategoryId);
|
|
|
- // produceType = obj ? obj.bomType : produceType;
|
|
|
- // let listMap = {
|
|
|
- // 1: { code: 1, name: 'PBOM' },
|
|
|
- // 2: { code: 2, name: 'MBOM' },
|
|
|
- // 3: { code: 3, name: 'ABOM' }
|
|
|
- // };
|
|
|
- // res.forEach((el) => {
|
|
|
- // if (listMap[el.bomType]) {
|
|
|
- // arr.push(listMap[el.bomType]);
|
|
|
- // delete listMap[el.bomType];
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
- this.$router
|
|
|
- .push({
|
|
|
- path: '/saleOrder/salesToProduction',
|
|
|
- query: {
|
|
|
- orderType,
|
|
|
- selection: JSON.stringify(list),
|
|
|
- produceRoutingId: produceRoutingId,
|
|
|
- produceRoutingName: this.selection[0].produceRoutingName,
|
|
|
- categoryId: this.selection[0].categoryId,
|
|
|
- factoriesId: factoriesId,
|
|
|
- factoriesIdName: factoriesIdName,
|
|
|
- bomCategoryId: bomCategoryId,
|
|
|
- produceType: produceType,
|
|
|
- startTime,
|
|
|
- endTime,
|
|
|
- producedList: JSON.stringify(arr)
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- // 忽略重复导航错误
|
|
|
- if (error.name !== 'NavigationDuplicated') {
|
|
|
- console.error('路由跳转失败:', error);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
update(id) {
|
|
|
update({ id, status: 1 }).then((res) => {
|
|
|
this.reload();
|