|
|
|
@ -101,7 +101,7 @@ |
|
|
|
autocorrect="off" |
|
|
|
spellcheck="false" /> |
|
|
|
</el-form-item></el-col> |
|
|
|
<el-col :span="12"><el-form-item label="库位"><el-input v-model="recvItem.locationNo" placeholder="请输入库位" /></el-form-item></el-col> |
|
|
|
<el-col :span="12"><el-form-item label="库位"><el-input v-model="recvItem.locationNo" placeholder="请输入库位" @blur="validateLocation" /></el-form-item></el-col> |
|
|
|
<el-col :span="12"><el-form-item label="批号"><el-input v-model="recvItem.batchNo" placeholder="请输入批号" /></el-form-item></el-col> |
|
|
|
<el-col :span="8" style="margin-top: 10px"><el-form-item><el-button type="text" style="font-size: 16px;margin-left: 30px" @click="processFlag = 1">回退</el-button></el-form-item></el-col> |
|
|
|
<el-col :span="8" style="margin-top: 10px"><el-form-item><el-button type="text" style="font-size: 16px;margin-left: 20px" @click="receivePo">保存</el-button></el-form-item></el-col> |
|
|
|
@ -143,7 +143,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { getPoList, receivePo, printLabel, getNextItemNo } from "@/api/po/po.js"; |
|
|
|
import { getPoList, receivePo, printLabel, getNextItemNo, validateLocationForReceiveCase } from "@/api/po/po.js"; |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
@ -296,7 +296,32 @@ export default { |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
receivePo() { |
|
|
|
// 校验库位 |
|
|
|
async validateLocation() { |
|
|
|
if (!this.recvItem.locationNo || !this.recvItem.receiveCaseDB) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
const { data } = await validateLocationForReceiveCase({ |
|
|
|
site: this.site, |
|
|
|
locationId: this.recvItem.locationNo, |
|
|
|
receiveCaseDB: this.recvItem.receiveCaseDB |
|
|
|
}); |
|
|
|
|
|
|
|
if (data.code !== 0) { |
|
|
|
this.$message.error(data.msg || '库位校验失败'); |
|
|
|
// 清空库位输入 |
|
|
|
this.recvItem.locationNo = ''; |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('库位校验失败:', error); |
|
|
|
this.$message.error('库位校验失败,请重试'); |
|
|
|
// 清空库位输入 |
|
|
|
this.recvItem.locationNo = ''; |
|
|
|
} |
|
|
|
}, |
|
|
|
async receivePo() { |
|
|
|
if (this.fullscreenLoading) return; // 防止重复点 |
|
|
|
this.fullscreenLoading = true; |
|
|
|
const item = this.recvItem; |
|
|
|
@ -305,6 +330,24 @@ export default { |
|
|
|
return this.$message.error("请填写完整信息"); |
|
|
|
} |
|
|
|
|
|
|
|
// 提交前再次校验库位 |
|
|
|
try { |
|
|
|
const { data: validationData } = await validateLocationForReceiveCase({ |
|
|
|
site: this.site, |
|
|
|
locationId: item.locationNo, |
|
|
|
receiveCaseDB: item.receiveCaseDB |
|
|
|
}); |
|
|
|
|
|
|
|
if (validationData.code !== 0) { |
|
|
|
this.fullscreenLoading = false; |
|
|
|
return this.$message.error(validationData.msg || '库位校验失败'); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('库位校验失败:', error); |
|
|
|
this.fullscreenLoading = false; |
|
|
|
return this.$message.error('库位校验失败,请重试'); |
|
|
|
} |
|
|
|
|
|
|
|
// 构建符合服务端TransDetailDto结构的数据 |
|
|
|
const receiveData = { |
|
|
|
// 基本字段 |
|
|
|
|