-
+
{
}
getFormSupplierList()
// 改变检验方式的时候
-function changeInspectType(e){
+function changeInspectType(e) {
if (e == 'SAMPLING') {
- formData.value.configuration.SampleMethod='QTY'
- formData.value.configuration.AqlList=[{
- FloorQty: 1,
- CeilingQty: 2,
- SampleValue: 1
- }]
+ formData.value.configuration.SampleMethod = 'QTY'
+ formData.value.configuration.AqlList = [
+ {
+ FloorQty: 1,
+ CeilingQty: 2,
+ SampleValue: 1
+ }
+ ]
}
}
// 改变抽检方式的时候
@@ -404,7 +423,7 @@ const open = async (type: string, strategyCode: string, id?: number) => {
formData.value.status = data.status == 0 ? true : false
if (formData.value.priority == 0) {
Butttondata.value = [
- defaultButtons.formSaveBtn({disabled:true}), // 保存
+ defaultButtons.formSaveBtn({ disabled: true }), // 保存
defaultButtons.formCloseBtn(null) // 关闭
]
} else {
@@ -436,21 +455,35 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
+const hasSameData = (array) => {
+ for (let k = 0; k < array.length; k++) {
+ for (let n = k + 1; n < array.length; n++) {
+ if(array[k].FloorQty <= array[n].FloorQty && array[n].FloorQty<=array[k].CeilingQty){
+ return true
+ }
+ }
+ }
+ return false
+}
const submitForm = async () => {
// 校验表单
inputNumberBlur()
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
- if(formData.value.priority == 0){
+ if (formData.value.priority == 0) {
message.error('优先级不可以为0')
return
}
+ if (hasSameData(formData.value.configuration.AqlList)) {
+ message.error('抽检规则数据范围重叠,请重新填写')
+ return
+ }
// 提交请求
formLoading.value = true
- if(formData.value.configuration.InspectType != 'SAMPLING'){
- formData.value.configuration.SampleMethod= ''
- formData.value.configuration.AqlList=[]
+ if (formData.value.configuration.InspectType != 'SAMPLING') {
+ formData.value.configuration.SampleMethod = ''
+ formData.value.configuration.AqlList = []
}
try {
let data = {
diff --git a/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue b/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue
index f5a867151..1d736d832 100644
--- a/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue
+++ b/src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue
@@ -103,6 +103,7 @@ import * as PurchasereturnRequestMainApi from '@/api/wms/purchasereturnRequestMa
import * as PurchasereturnRequestDetailApi from '@/api/wms/purchasereturnRequestDetail'
import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
+import { log } from 'console'
// 采购退货申请
defineOptions({ name: 'PurchasereturnRequestMain' })
@@ -128,6 +129,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
if (type == 'tableForm') {
// 明细查询页赋值
row[formField] = val[0][searchField]
+ row['supplierCode'] = val[0]['supplierCode']
row['poNumber'] = val[0]['poNumber']
row['poLine'] = val[0]['poLine']
row['itemCode'] = val[0]['itemCode']
@@ -187,7 +189,6 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
// item.fromLocationGroupCode = item.fromLocationGroupCode
})
isShowButton.value = false
- console.log('formSchema', PurchasereturnRequestMain.allSchemas.formSchema)
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'supplierCode') {
@@ -486,8 +487,18 @@ const handleDeleteTable = (item, index, formRef) => {
// 主子数据 提交
const submitForm = async (formType, data) => {
- console.log(formType)
data.subList = tableData.value // 拼接子表数据参数
+ let array =[]
+ data.subList.forEach((item,index) => {
+ if(item.supplierCode != data.supplierCode){
+ array.push(index+1)
+ }
+ })
+ if (array.length>0) {
+ formRef.value.formLoading = false
+ message.error(`第${array.join(',')}行数据的供应商代码与上方填写的供应商代码不一致`)
+ return
+ }
try {
if (formType === 'create') {
await PurchasereturnRequestMainApi.createPurchasereturnRequestMain(data)