diff --git a/src/api/part/partInformation.js b/src/api/part/partInformation.js
index 21e638b..21256fd 100644
--- a/src/api/part/partInformation.js
+++ b/src/api/part/partInformation.js
@@ -248,3 +248,5 @@ export const locationInformationSearch = data => createAPI(`/plm/partInformation
export const queryOfficialPartList = data => createAPI(`/plm/partInformation/queryOfficialPartList`,'post',data)
export const copyPart2 = data => createAPI(`/plm/partInformation/copyPart2`,'post',data)
+
+export const createOfficialPartForRohs = data => createAPI(`/plm/partInformation/createOfficialPartForRohs`,'post',data)
diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue
index 5fe551d..8a80e65 100644
--- a/src/views/modules/rohs/rohsRecord.vue
+++ b/src/views/modules/rohs/rohsRecord.vue
@@ -516,6 +516,7 @@
+ 创建IFS料号
关联料号
删除关联
@@ -716,6 +717,469 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Next Part No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 安全代码 / Safety Code
+
+
+
+
+
+
+ 计划人 / Planner
+
+
+
+
+ 会计组 / Accounting Group
+
+
+
+
+
+
+ 计量单位 / Inventory UoM
+
+
+
+
+ 产品代码 / Product Code
+
+
+
+
+
+
+ 商品组1 / Comm Group 1
+
+
+
+
+ 产品大类 / Product Family
+
+
+
+
+
+
+ 商品组2 / Comm Group 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 资产等级 / Asset Class
+
+
+
+
+
+
+
+
+
+ 零件状态 / Part Status
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ABC类 / ABC Class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 来源国家 / Country of Origin
+
+
+
+
+
+
+
+
+
+
+
+
+ 区域代码 / Region Code
+
+
+
+
+
+
+
+
+
+
+ 海关统计序号 / Customs Stat No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 零件成本组 / Part Cost Group
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 计划方法 / Planning Method
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 将副产品用作MRP中的供应 / Use By-Product as Supply in MRP
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MRP控制 / MRP Control
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 使用理论 / Use Theoretical
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 属性模板
+
+
+
+
+ 新增
+ 删除
+
+
+
+
+
+
+
+
+
+
{{ scope.row[item.columnProp] }}
+
![]()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+ 关闭
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+
+ {{scope.row[item.columnProp]}}
+
+
+
+
+
+ 保存
+ 关闭
+
+
+
@@ -1119,6 +1583,7 @@ import { verifyData } from "@/api/chooselist/chooselist.js"
import { searchProjectInfoList } from "@/api/quotation/quotationInformation.js"
import { queryCustomer } from "@/api/customer/customerInformation"
import { queryProjectByCustomer } from "@/api/project/project"
+import { createOfficialPartForRohs, getNextPartNo as getPartNextPartNo, getItemListByCodeNo as getPartItemListByCodeNo, getItemExclusionAlreadyExists as getPartItemExclusionAlreadyExists } from "@/api/part/partInformation.js"
import uploadFileList from '../common/uploadFileList'
import ossComponents from '../oss/ossComponents.vue'
import ChooseList from '@/views/modules/common/Chooselist'
@@ -1404,6 +1869,190 @@ export default {
modalFlag: false,
chooseProjectListFlag: false,
projectMaterialDialogFlag: false,
+ rohsCreatePartDialogFlag: false,
+ rohsCreatePartLoading: false,
+ rohsCreatePartTab: 'General',
+ rohsCreatePartTagNo: 0,
+ rohsCharacteristicDialogFlag: false,
+ rohsCharacteristicQueryData: {
+ propertiesItemNo: '',
+ itemDesc: ''
+ },
+ rohsCharacteristicList: [],
+ rohsCharacteristicSelections: [],
+ rohsPartItemSelections: [],
+ rohsCreatePartColumnItemList: [
+ {
+ columnProp: 'propertiesItemNo',
+ headerAlign: 'center',
+ align: 'left',
+ columnLabel: '属性编码',
+ columnHidden: false,
+ columnImage: false,
+ status: true,
+ fixed: '',
+ columnWidth: 100
+ },
+ {
+ columnProp: 'itemDesc',
+ headerAlign: 'center',
+ align: 'left',
+ columnLabel: '属性名称',
+ columnHidden: false,
+ columnImage: false,
+ status: true,
+ fixed: '',
+ columnWidth: 150
+ },
+ {
+ columnProp: 'valueType',
+ headerAlign: 'center',
+ align: 'center',
+ columnLabel: '属性类型',
+ columnHidden: false,
+ columnImage: false,
+ status: true,
+ fixed: '',
+ columnWidth: 60
+ },
+ {
+ columnProp: 'textValue',
+ headerAlign: 'center',
+ align: 'left',
+ columnLabel: '属性值',
+ columnHidden: false,
+ columnImage: false,
+ status: true,
+ fixed: '',
+ columnWidth: 140
+ }
+ ],
+ rohsCharacteristicColumnList: [
+ {
+ columnProp: 'propertiesItemNo',
+ headerAlign: 'center',
+ align: 'left',
+ columnLabel: '属性编码',
+ columnHidden: false,
+ columnImage: false,
+ status: true,
+ fixed: '',
+ columnWidth: 100
+ },
+ {
+ columnProp: 'itemDesc',
+ headerAlign: 'center',
+ align: 'left',
+ columnLabel: '属性名称',
+ columnHidden: false,
+ columnImage: false,
+ status: true,
+ fixed: '',
+ columnWidth: 200
+ },
+ {
+ columnProp: 'valueType',
+ headerAlign: 'center',
+ align: 'center',
+ columnLabel: '属性类型',
+ columnHidden: false,
+ columnImage: false,
+ status: true,
+ fixed: '',
+ columnWidth: 60
+ }
+ ],
+ rohsCreatePartData: {
+ site: '',
+ partNo: '',
+ partDesc: '',
+ partType: 'Purchased',
+ hazardCode: '',
+ hazardDesc: '',
+ familyId: '',
+ familyName: '',
+ groupId: '',
+ groupName: '',
+ umId: '',
+ umName: '',
+ weightNet: '',
+ uomForWeightNet: 'kg',
+ volumeNet: '',
+ uomForVolumeNet: 'm3',
+ lotTrackingCode: 'Order Based',
+ remark: '',
+ productGroupId1: '',
+ productGroupName1: '',
+ productGroupId2: '',
+ productGroupName2: '',
+ productGroupId3: '',
+ productGroupName3: '',
+ productGroupId4: '*',
+ productGroupName4: 'NorthSky Application owner',
+ commGroup3: '',
+ commGroup3Desc: '',
+ codeNo: '',
+ codeDesc: '',
+ typeDesignation: '',
+ assetClass: 'S',
+ assetClassDesc: '标准',
+ dimQuality: '',
+ abcClass: 'C',
+ abcClassDesc: '',
+ frequencyClass: 'Very Slow Mover',
+ lifecycleStage: 'Development',
+ countryOfOrigin: '',
+ countryOfOriginDesc: '',
+ regionOfOrigin: '',
+ regionOfOriginDesc: '',
+ manufacturingLeadTime: 0,
+ expectedLeadTime: 0,
+ durabilityWeek: '',
+ durabilityDay: '',
+ intrastatConvFactor: undefined,
+ customsStatNo: '',
+ customsStatDesc: '',
+ umDesc: '',
+ planningMethod: 'A',
+ planningMethodDesc: '',
+ partStatus: 'A',
+ partStatusDesc: '活动',
+ active: 'Y',
+ status: 'Y',
+ supplyCode: 'Inventory Order',
+ configurationId: '*',
+ partCostGroupId: '',
+ partCostGroupDesc: '',
+ inventoryValuationMethod: 'Standard Cost',
+ inventoryPartCostLevel: 'Cost Per Part',
+ invoiceConsideration: 'Ignore Invoice Price',
+ zeroCostFlag: 'Zero Cost Forbidden',
+ estimatedMaterialCost: 0,
+ safetyStock: 0,
+ minOrderQty: 0,
+ maxOrderQty: 0,
+ mulOrderQty: 0,
+ safetyLeadTime: 0,
+ shrinkageFac: 0,
+ stdOrderQty: 0,
+ cumLeadTime: 0,
+ byProdAsSupplyInMrpDb: '',
+ unprotectedLeadTime: 0,
+ backFlushPart: 'All Locations',
+ issueType: 'Reserve And Backflush',
+ mrpControlFlagDb: 'Y',
+ fixedLeadTimeDay: 0,
+ overReporting: 'Allowed',
+ useTheoreticalDensityDb: '',
+ variableLeadTimeDay: 0,
+ overReportTolerance: 0,
+ fixedLeadTimeHour: 0,
+ density: undefined,
+ variableLeadTimeHour: 0,
+ showInQueryFlag: 'Y',
+ temporaryPartFlag: 'N',
+ partItemList: []
+ },
searchProjectData: {
site: '',
projectId: undefined,
@@ -2468,6 +3117,9 @@ export default {
const site = this.modalData.site
const referenceNo = this.modalData.referenceNo
this.modalFlag = false
+ this.rohsCreatePartDialogFlag = false
+ this.rohsCharacteristicDialogFlag = false
+ this.rohsCreatePartTab = 'General'
this.$nextTick(() => {
this.refreshAttachmentPanels()
})
@@ -2792,6 +3444,18 @@ export default {
remark: ''
}
this.projectMaterialDialogFlag = false
+ this.rohsCreatePartDialogFlag = false
+ this.rohsCreatePartLoading = false
+ this.rohsCreatePartTab = 'General'
+ this.rohsCreatePartTagNo = 0
+ this.rohsCharacteristicDialogFlag = false
+ this.rohsCharacteristicQueryData = {
+ propertiesItemNo: '',
+ itemDesc: ''
+ }
+ this.rohsCharacteristicList = []
+ this.rohsCharacteristicSelections = []
+ this.rohsPartItemSelections = []
this.projectMaterialSelections = []
this.materialSelections = []
this.hsfApproverOptionList = []
@@ -3152,6 +3816,546 @@ export default {
})
}).catch(() => {})
},
+ buildRohsCreatePartData () {
+ const user = this.$store.state.user || {}
+ return {
+ site: this.modalData.site || user.site || '',
+ partNo: '',
+ partDesc: this.modalData.materialDesc || '',
+ partType: 'Purchased',
+ hazardCode: '',
+ hazardDesc: '',
+ familyId: '',
+ familyName: '',
+ groupId: '',
+ groupName: '',
+ umId: '',
+ umName: '',
+ weightNet: '',
+ uomForWeightNet: 'kg',
+ volumeNet: '',
+ uomForVolumeNet: 'm3',
+ lotTrackingCode: 'Order Based',
+ remark: '',
+ productGroupId1: this.modalData.commGroup1 || '',
+ productGroupName1: this.modalData.commGroup1Desc || '',
+ productGroupId2: this.modalData.commGroup2 || '',
+ productGroupName2: this.modalData.commGroup2Desc || '',
+ productGroupId3: '',
+ productGroupName3: '',
+ productGroupId4: '*',
+ productGroupName4: 'NorthSky Application owner',
+ commGroup3: this.modalData.commGroup3 || '',
+ commGroup3Desc: this.modalData.commGroup3Desc || '',
+ codeNo: '',
+ codeDesc: '',
+ typeDesignation: '',
+ assetClass: 'S',
+ assetClassDesc: '标准',
+ dimQuality: '',
+ abcClass: 'C',
+ abcClassDesc: '',
+ frequencyClass: 'Very Slow Mover',
+ lifecycleStage: 'Development',
+ countryOfOrigin: '',
+ countryOfOriginDesc: '',
+ regionOfOrigin: '',
+ regionOfOriginDesc: '',
+ manufacturingLeadTime: 0,
+ expectedLeadTime: 0,
+ durabilityWeek: '',
+ durabilityDay: '',
+ intrastatConvFactor: undefined,
+ customsStatNo: '',
+ customsStatDesc: '',
+ umDesc: '',
+ planningMethod: 'A',
+ planningMethodDesc: '',
+ partStatus: 'A',
+ partStatusDesc: '活动',
+ active: 'Y',
+ status: 'Y',
+ supplyCode: 'Inventory Order',
+ configurationId: '*',
+ partCostGroupId: '',
+ partCostGroupDesc: '',
+ inventoryValuationMethod: 'Standard Cost',
+ inventoryPartCostLevel: 'Cost Per Part',
+ invoiceConsideration: 'Ignore Invoice Price',
+ zeroCostFlag: 'Zero Cost Forbidden',
+ estimatedMaterialCost: 0,
+ safetyStock: 0,
+ minOrderQty: 0,
+ maxOrderQty: 0,
+ mulOrderQty: 0,
+ safetyLeadTime: 0,
+ shrinkageFac: 0,
+ stdOrderQty: 0,
+ cumLeadTime: 0,
+ byProdAsSupplyInMrpDb: '',
+ unprotectedLeadTime: 0,
+ backFlushPart: 'All Locations',
+ issueType: 'Reserve And Backflush',
+ mrpControlFlagDb: 'Y',
+ fixedLeadTimeDay: 0,
+ overReporting: 'Allowed',
+ useTheoreticalDensityDb: '',
+ variableLeadTimeDay: 0,
+ overReportTolerance: 0,
+ fixedLeadTimeHour: 0,
+ density: undefined,
+ variableLeadTimeHour: 0,
+ showInQueryFlag: 'Y',
+ temporaryPartFlag: 'N',
+ partItemList: [],
+ createBy: user.name || '',
+ updateBy: user.name || ''
+ }
+ },
+ openCreateIfsPartDialog () {
+ if (!this.isEditMode || !this.canEditRohsMaterial()) {
+ this.$message.warning('当前状态不允许创建IFS料号')
+ return
+ }
+ this.rohsCreatePartData = this.buildRohsCreatePartData()
+ this.rohsCreatePartTab = 'General'
+ this.rohsCreatePartTagNo = 0
+ this.rohsCharacteristicDialogFlag = false
+ this.rohsCharacteristicQueryData = {
+ propertiesItemNo: '',
+ itemDesc: ''
+ }
+ this.rohsCharacteristicList = []
+ this.rohsCharacteristicSelections = []
+ this.rohsPartItemSelections = []
+ this.rohsCreatePartDialogFlag = true
+ },
+ closeRohsCreatePartDialog () {
+ this.rohsCreatePartTab = 'General'
+ this.rohsCreatePartTagNo = 0
+ this.rohsCreatePartLoading = false
+ this.rohsCharacteristicDialogFlag = false
+ this.rohsCharacteristicQueryData = {
+ propertiesItemNo: '',
+ itemDesc: ''
+ }
+ this.rohsCharacteristicList = []
+ this.rohsCharacteristicSelections = []
+ this.rohsPartItemSelections = []
+ this.rohsCreatePartData = this.buildRohsCreatePartData()
+ },
+ rohsChangeExpectedLeadTime () {
+ this.rohsCreatePartData.expectedLeadTime = this.rohsCreatePartData.manufacturingLeadTime
+ },
+ rohsChangeDurabilityWeek () {
+ const day = Number(this.rohsCreatePartData.durabilityDay || 0)
+ this.rohsCreatePartData.durabilityWeek = day / 7
+ },
+ nextRohsCreatePartNo (silent = false) {
+ this.rohsCreatePartData.ifsPartNo = this.rohsCreatePartData.partNo
+ const params = {
+ ...this.rohsCreatePartData,
+ ifsPartNo: this.rohsCreatePartData.ifsPartNo,
+ site: this.rohsCreatePartData.site || this.$store.state.user.site,
+ createBy: this.$store.state.user.name || '',
+ updateBy: this.$store.state.user.name || ''
+ }
+ getPartNextPartNo(params).then(({data}) => {
+ if (data && data.code === 0) {
+ this.$set(this.rohsCreatePartData, 'partNo', data.rows || '')
+ this.$set(this.rohsCreatePartData, 'ifsPartNo', data.rows || '')
+ } else if (!silent) {
+ this.$message.error((data && data.msg) || '获取料号失败')
+ }
+ }).catch(() => {
+ if (!silent) {
+ this.$message.error('获取料号失败')
+ }
+ })
+ },
+ openRohsCreatePartBaseList (tagNo) {
+ if (!this.rohsCreatePartDialogFlag) {
+ return
+ }
+ this.rohsCreatePartTagNo = tagNo
+ this.$nextTick(() => {
+ let strVal = ''
+ if (tagNo === 1007) {
+ strVal = this.rohsCreatePartData.umId
+ } else if (tagNo === 108) {
+ strVal = this.rohsCreatePartData.familyId
+ } else if (tagNo === 109) {
+ strVal = this.rohsCreatePartData.groupId
+ } else if (tagNo === 112) {
+ strVal = this.rohsCreatePartData.productGroupId3
+ } else if (tagNo === 113) {
+ strVal = this.rohsCreatePartData.productGroupId4
+ } else if (tagNo === 123) {
+ strVal = this.rohsCreatePartData.hazardCode
+ } else if (tagNo === 124) {
+ strVal = this.rohsCreatePartData.assetClass
+ } else if (tagNo === 125) {
+ strVal = this.rohsCreatePartData.partStatus
+ } else if (tagNo === 126) {
+ strVal = this.rohsCreatePartData.abcClass
+ } else if (tagNo === 127) {
+ strVal = this.rohsCreatePartData.countryOfOrigin
+ } else if (tagNo === 128) {
+ strVal = this.rohsCreatePartData.regionOfOrigin
+ } else if (tagNo === 129) {
+ strVal = this.rohsCreatePartData.customsStatNo
+ } else if (tagNo === 131) {
+ strVal = this.rohsCreatePartData.partCostGroupId
+ } else if (tagNo === 20) {
+ strVal = this.rohsCreatePartData.codeNo
+ } else if (tagNo === 132) {
+ strVal = this.rohsCreatePartData.planningMethod
+ }
+ this.$refs.baseList.init(tagNo, strVal)
+ })
+ },
+ applyRohsCreatePartBaseData (val) {
+ if (this.rohsCreatePartTagNo === 1007) {
+ this.rohsCreatePartData.umId = val.um_id
+ this.rohsCreatePartData.umName = val.um_name
+ } else if (this.rohsCreatePartTagNo === 108) {
+ this.rohsCreatePartData.familyId = val.family_id
+ this.rohsCreatePartData.familyName = val.family_name
+ } else if (this.rohsCreatePartTagNo === 109) {
+ this.rohsCreatePartData.groupId = val.group_id
+ this.rohsCreatePartData.groupName = val.group_name
+ } else if (this.rohsCreatePartTagNo === 112) {
+ this.rohsCreatePartData.productGroupId3 = val.product_group_id
+ this.rohsCreatePartData.productGroupName3 = val.product_group_name
+ } else if (this.rohsCreatePartTagNo === 113) {
+ this.rohsCreatePartData.productGroupId4 = val.product_group_id
+ this.rohsCreatePartData.productGroupName4 = val.product_group_name
+ } else if (this.rohsCreatePartTagNo === 123) {
+ this.rohsCreatePartData.hazardCode = val.hazard_code
+ this.rohsCreatePartData.hazardDesc = val.hazard_desc
+ } else if (this.rohsCreatePartTagNo === 124) {
+ this.rohsCreatePartData.assetClass = val.asset_class
+ this.rohsCreatePartData.assetClassDesc = val.asset_class_desc
+ } else if (this.rohsCreatePartTagNo === 125) {
+ this.rohsCreatePartData.partStatus = val.part_status
+ this.rohsCreatePartData.partStatusDesc = val.part_status_desc
+ } else if (this.rohsCreatePartTagNo === 126) {
+ this.rohsCreatePartData.abcClass = val.abc_class
+ this.rohsCreatePartData.abcClassDesc = val.abc_class_desc
+ } else if (this.rohsCreatePartTagNo === 127) {
+ this.rohsCreatePartData.countryOfOrigin = val.country_of_origin
+ this.rohsCreatePartData.countryOfOriginDesc = val.country_of_origin_desc
+ } else if (this.rohsCreatePartTagNo === 128) {
+ this.rohsCreatePartData.regionOfOrigin = val.region_of_origin
+ this.rohsCreatePartData.regionOfOriginDesc = val.region_of_origin_desc
+ } else if (this.rohsCreatePartTagNo === 129) {
+ this.rohsCreatePartData.customsStatNo = val.customs_stat_no
+ this.rohsCreatePartData.customsStatDesc = val.customs_stat_desc
+ } else if (this.rohsCreatePartTagNo === 131) {
+ this.rohsCreatePartData.partCostGroupId = val.part_cost_group_id
+ this.rohsCreatePartData.partCostGroupDesc = val.part_cost_group_desc
+ } else if (this.rohsCreatePartTagNo === 20) {
+ this.rohsCreatePartData.codeNo = val.Code_no
+ this.rohsCreatePartData.codeDesc = val.Code_desc
+ this.loadRohsPartItemListByCodeNo()
+ } else if (this.rohsCreatePartTagNo === 132) {
+ this.rohsCreatePartData.planningMethod = val.planning_method
+ this.rohsCreatePartData.planningMethodDesc = val.planning_method_desc
+ }
+ this.rohsCreatePartTagNo = 0
+ },
+ rohsCreateBaseFieldBlur (tagNo, codeKey, descKey, queryField, resultCodeField, resultDescField, withSite = true) {
+ this.rohsCreatePartData[codeKey] = (this.rohsCreatePartData[codeKey] || '').replace(/[\s\u00A0\u3000\u200B]/g, '')
+ if (!this.rohsCreatePartData[codeKey]) {
+ this.rohsCreatePartData[descKey] = ''
+ return
+ }
+ const site = this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site
+ let conditionSql = " and " + queryField + " = '" + this.rohsCreatePartData[codeKey] + "'"
+ if (withSite) {
+ conditionSql += " and site = '" + site + "'"
+ }
+ const tempData = {
+ tagno: tagNo,
+ conditionSql: conditionSql
+ }
+ verifyData(tempData).then(({data}) => {
+ if (data && data.code === 0 && data.baseListData.length > 0) {
+ this.rohsCreatePartData[codeKey] = data.baseListData[0][resultCodeField]
+ this.rohsCreatePartData[descKey] = data.baseListData[0][resultDescField]
+ } else {
+ this.rohsCreatePartData[descKey] = ''
+ }
+ }).catch(() => {
+ this.rohsCreatePartData[descKey] = ''
+ })
+ },
+ rohsCreateHazardCodeBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'hazardCode', 'hazardDesc', 'hazard_code', 'hazard_code', 'hazard_desc')
+ },
+ rohsCreateProductGroupId4Blur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'productGroupId4', 'productGroupName4', 'product_group_id', 'product_group_id', 'product_group_name')
+ },
+ rohsCreateProductGroupId3Blur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'productGroupId3', 'productGroupName3', 'product_group_id', 'product_group_id', 'product_group_name')
+ },
+ rohsCreateUmIdBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'umId', 'umName', 'um_id', 'um_id', 'um_name', false)
+ },
+ rohsCreateGroupIdBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'groupId', 'groupName', 'group_id', 'group_id', 'group_name')
+ },
+ rohsCreateFamilyIdBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'familyId', 'familyName', 'family_id', 'family_id', 'family_name')
+ },
+ rohsCreateAssetClassBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'assetClass', 'assetClassDesc', 'asset_class', 'asset_class', 'asset_class_desc')
+ },
+ rohsCreatePartStatusBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'partStatus', 'partStatusDesc', 'part_status', 'part_status', 'part_status_desc')
+ },
+ rohsCreateAbcClassBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'abcClass', 'abcClassDesc', 'abc_class', 'abc_class', 'abc_class_desc')
+ },
+ rohsCreateCountryOfOriginBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'countryOfOrigin', 'countryOfOriginDesc', 'country_of_origin', 'country_of_origin', 'country_of_origin_desc')
+ },
+ rohsCreateRegionOfOriginBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'regionOfOrigin', 'regionOfOriginDesc', 'region_of_origin', 'region_of_origin', 'region_of_origin_desc')
+ },
+ rohsCreateCustomsStatNoBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'customsStatNo', 'customsStatDesc', 'customs_stat_no', 'customs_stat_no', 'customs_stat_desc')
+ },
+ rohsCreatePartCostGroupIdBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'partCostGroupId', 'partCostGroupDesc', 'part_cost_group_id', 'part_cost_group_id', 'part_cost_group_desc')
+ },
+ rohsCreatePlanningMethodBlur (tagNo) {
+ this.rohsCreateBaseFieldBlur(tagNo, 'planningMethod', 'planningMethodDesc', 'planning_method', 'planning_method', 'planning_method_desc')
+ },
+ rohsCreateCodeNoBlur (tagNo) {
+ this.rohsCreatePartData.codeNo = (this.rohsCreatePartData.codeNo || '').replace(/[\s\u00A0\u3000\u200B]/g, '')
+ if (!this.rohsCreatePartData.codeNo) {
+ this.rohsCreatePartData.codeDesc = ''
+ this.$set(this.rohsCreatePartData, 'partItemList', [])
+ this.rohsPartItemSelections = []
+ return
+ }
+ const site = this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site
+ const tempData = {
+ tagno: tagNo,
+ conditionSql: " and Code_no = '" + this.rohsCreatePartData.codeNo + "'" + " and site = '" + site + "'"
+ }
+ verifyData(tempData).then(({data}) => {
+ if (data && data.code === 0 && data.baseListData.length > 0) {
+ this.rohsCreatePartData.codeNo = data.baseListData[0].Code_no
+ this.rohsCreatePartData.codeDesc = data.baseListData[0].Code_desc
+ this.loadRohsPartItemListByCodeNo()
+ } else {
+ this.rohsCreatePartData.codeDesc = ''
+ this.$set(this.rohsCreatePartData, 'partItemList', [])
+ this.rohsPartItemSelections = []
+ }
+ }).catch(() => {
+ this.rohsCreatePartData.codeDesc = ''
+ })
+ },
+ loadRohsPartItemListByCodeNo () {
+ if (!this.rohsCreatePartData.codeNo) {
+ this.$set(this.rohsCreatePartData, 'partItemList', [])
+ this.rohsPartItemSelections = []
+ return
+ }
+ const params = {
+ site: this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site,
+ codeNo: this.rohsCreatePartData.codeNo,
+ recordType: 'IP'
+ }
+ getPartItemListByCodeNo(params).then(({data}) => {
+ if (data && data.code === 0) {
+ this.$set(this.rohsCreatePartData, 'partItemList', (data.rows || []).map(item => ({
+ ...item,
+ numValue: item.numValue === null ? undefined : item.numValue
+ })))
+ } else {
+ this.$set(this.rohsCreatePartData, 'partItemList', [])
+ }
+ this.rohsPartItemSelections = []
+ }).catch(() => {
+ this.$set(this.rohsCreatePartData, 'partItemList', [])
+ this.rohsPartItemSelections = []
+ })
+ },
+ rohsPartItemSelectionChange (selection) {
+ this.rohsPartItemSelections = selection || []
+ },
+ openRohsCharacteristicDialog () {
+ this.rohsCharacteristicSelections = []
+ this.rohsCharacteristicQueryData = {
+ propertiesItemNo: '',
+ itemDesc: ''
+ }
+ this.queryRohsCharacteristicOptions()
+ this.rohsCharacteristicDialogFlag = true
+ },
+ removeRohsPartItemRows () {
+ if (!this.rohsPartItemSelections || this.rohsPartItemSelections.length === 0) {
+ this.$message.warning('请选择要删除的属性!')
+ return
+ }
+ this.$confirm('请是否确认删除该属性记录?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ const removeSet = new Set(this.rohsPartItemSelections.map(item => item.propertiesItemNo))
+ this.$set(this.rohsCreatePartData, 'partItemList', (this.rohsCreatePartData.partItemList || []).filter(item => !removeSet.has(item.propertiesItemNo)))
+ this.rohsPartItemSelections = []
+ }).catch(() => {})
+ },
+ queryRohsCharacteristicOptions () {
+ const itemNos = (this.rohsCreatePartData.partItemList || []).map(item => item.propertiesItemNo).filter(item => item).join(',')
+ const params = {
+ site: this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site,
+ recordType: 'IP',
+ propertiesItemNo: this.rohsCharacteristicQueryData.propertiesItemNo,
+ itemDesc: this.rohsCharacteristicQueryData.itemDesc,
+ itemNos: itemNos
+ }
+ getPartItemExclusionAlreadyExists(params).then(({data}) => {
+ if (data && data.code === 0) {
+ this.rohsCharacteristicList = data.rows || []
+ } else {
+ this.rohsCharacteristicList = []
+ }
+ }).catch(() => {
+ this.rohsCharacteristicList = []
+ })
+ },
+ rohsCharacteristicRowClick (row) {
+ if (this.$refs.rohsCharacteristicTable) {
+ this.$refs.rohsCharacteristicTable.toggleRowSelection(row)
+ }
+ },
+ rohsCharacteristicSelectionChange (selection) {
+ this.rohsCharacteristicSelections = selection || []
+ },
+ saveRohsCharacteristics () {
+ if (!this.rohsCharacteristicSelections || this.rohsCharacteristicSelections.length === 0) {
+ this.$message.warning('请选择属性!')
+ return
+ }
+ const currentList = Array.isArray(this.rohsCreatePartData.partItemList) ? this.rohsCreatePartData.partItemList : []
+ const existSet = new Set(currentList.map(item => item.propertiesItemNo))
+ const appendList = this.rohsCharacteristicSelections.filter(item => item && item.propertiesItemNo && !existSet.has(item.propertiesItemNo)).map(item => ({
+ ...item,
+ numValue: item.numValue === null ? undefined : item.numValue
+ }))
+ if (appendList.length === 0) {
+ this.$message.warning('所选属性已存在')
+ return
+ }
+ this.$set(this.rohsCreatePartData, 'partItemList', [...currentList, ...appendList])
+ this.rohsCharacteristicDialogFlag = false
+ this.rohsCharacteristicSelections = []
+ },
+ validateRohsCreatePart () {
+ this.rohsCreatePartData.partNo = (this.rohsCreatePartData.partNo || '').replace(/[\s\u00A0\u3000\u200B]/g, '')
+ if (!this.rohsCreatePartData.partNo) {
+ this.$message.warning('请填写物料编码')
+ return false
+ }
+ if (!/^[A-Za-z0-9._-]+$/.test(this.rohsCreatePartData.partNo)) {
+ this.$message.warning('物料编码只能包含字母、数字、-、_、.')
+ return false
+ }
+ if (!this.rohsCreatePartData.partDesc || !String(this.rohsCreatePartData.partDesc).trim()) {
+ this.$message.warning('请填写物料名称')
+ return false
+ }
+ if (!this.rohsCreatePartData.partType) {
+ this.$message.warning('请选择零件类型')
+ return false
+ }
+ if (!this.rohsCreatePartData.umId) {
+ this.$message.warning('请选择计量单位')
+ return false
+ }
+ if (!this.rohsCreatePartData.productGroupId1 || !this.rohsCreatePartData.productGroupId2) {
+ this.$message.warning('请先在RoHS单据中维护商品组1/2')
+ return false
+ }
+ if (!this.rohsCreatePartData.productGroupId3) {
+ this.$message.warning('请选择会计组')
+ return false
+ }
+ if (!this.rohsCreatePartData.productGroupId4) {
+ this.$message.warning('请选择计划人')
+ return false
+ }
+ return true
+ },
+ appendCreatedPartToRohsMaterial (createdPart) {
+ const appendResult = this.appendMaterialRows([{
+ site: this.modalData.site,
+ referenceNo: this.modalData.referenceNo,
+ projectId: this.modalData.projectId,
+ testPartNo: createdPart.partNo,
+ finalPartNo: createdPart.partNo,
+ partDesc: createdPart.partDesc,
+ partStatus: createdPart.partStatus || 'A'
+ }])
+ if (!appendResult.appendedCount) {
+ this.$message.warning('IFS料号创建成功,但该料号已存在于材料列表')
+ return Promise.resolve()
+ }
+ if (!this.shouldPersistMaterialsImmediately()) {
+ this.$set(this.modalData, 'materialList', appendResult.materialList)
+ this.$message.success('IFS料号创建成功,已加入材料列表')
+ return Promise.resolve()
+ }
+ return this.persistMaterialList(appendResult.materialList, 'IFS料号创建成功并已关联到RoHS材料')
+ },
+ saveRohsCreatePart () {
+ if (!this.validateRohsCreatePart()) {
+ return
+ }
+ const payload = {
+ ...this.rohsCreatePartData,
+ site: this.modalData.site || this.$store.state.user.site,
+ buNo: this.modalData.process || '',
+ createBy: this.$store.state.user.name || '',
+ updateBy: this.$store.state.user.name || '',
+ partDesc: (this.rohsCreatePartData.partDesc || '').trim(),
+ productGroupId1: this.modalData.commGroup1 || this.rohsCreatePartData.productGroupId1,
+ productGroupName1: this.modalData.commGroup1Desc || this.rohsCreatePartData.productGroupName1,
+ productGroupId2: this.modalData.commGroup2 || this.rohsCreatePartData.productGroupId2,
+ productGroupName2: this.modalData.commGroup2Desc || this.rohsCreatePartData.productGroupName2,
+ productGroupId3: this.rohsCreatePartData.productGroupId3,
+ productGroupName3: this.rohsCreatePartData.productGroupName3,
+ commGroup3: this.modalData.commGroup3 || this.rohsCreatePartData.commGroup3,
+ commGroup3Desc: this.modalData.commGroup3Desc || this.rohsCreatePartData.commGroup3Desc,
+ status: 'Y',
+ showInQueryFlag: 'Y',
+ temporaryPartFlag: 'N',
+ ifsPartNo: this.rohsCreatePartData.partNo,
+ plmPartNo: this.rohsCreatePartData.partNo,
+ partItemList: Array.isArray(this.rohsCreatePartData.partItemList) ? this.rohsCreatePartData.partItemList : []
+ }
+ this.rohsCreatePartLoading = true
+ createOfficialPartForRohs(payload).then(({data}) => {
+ if (data && data.code === 0) {
+ this.appendCreatedPartToRohsMaterial(payload).then(() => {
+ this.rohsCreatePartDialogFlag = false
+ })
+ } else {
+ this.$message.error((data && data.msg) || '创建IFS料号失败')
+ }
+ }).catch(() => {
+ this.$message.error('创建IFS料号失败')
+ }).finally(() => {
+ this.rohsCreatePartLoading = false
+ })
+ },
openProjectMaterialDialog () {
if (!this.canEditRohsMaterial()) {
this.$message.warning('当前状态不允许编辑材料')
@@ -3292,7 +4496,7 @@ export default {
projectId: this.modalData.projectId,
materialList: normalizedList
}
- api.updateRohsMaterials(payload).then(({data}) => {
+ return api.updateRohsMaterials(payload).then(({data}) => {
if (data && data.code === 0) {
this.$set(this.modalData, 'materialList', normalizedList)
this.materialSelections = []
@@ -3379,6 +4583,10 @@ export default {
},
// 列表方法的回调
getBaseData (val) {
+ if (this.rohsCreatePartDialogFlag && this.rohsCreatePartTagNo) {
+ this.applyRohsCreatePartBaseData(val)
+ return
+ }
if (this.tagNo === 102) {
if (this.tagNo1 === 1) {
if (val.Customer_no === this.modalData.endCustomer) {