fix(storegoods): 加工出仓去掉扫仓位流程

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
郭鸿轩 2026-07-24 17:03:13 +08:00
parent 066f1c623c
commit e1ac017a3c
4 changed files with 5 additions and 202 deletions

View File

@ -1,71 +0,0 @@
<template>
<view>
<view v-if="canScan" class="flex-white-plr26 ptb20 bdb_f5 fabric-out-scanRow process-in-binRow">
<text class="mr26 process-in-binLabel">仓位<text class="redXingh">*</text></text>
<input
type="text"
:value="code"
class="fabric-out-scanInput"
placeholder="请先扫描仓位"
@input="$emit('code-input', $event.detail.value)"
@confirm="$emit('confirm')"
/>
<text v-if="name" class="process-in-binName">{{ name }}</text>
<u-icon
v-if="showPhoneScan"
class="fabric-out-phoneScanIcon"
name="scan"
size="44"
color="#2979ff"
@click="$emit('phone-scan')"
/>
<text v-if="binId" class="process-in-binClear" @click="$emit('clear')">更换</text>
</view>
<view v-else-if="showDisabledTip" class="fabric-out-scanTip">{{ disabledTip }}</view>
<view v-if="canScan && !binId" class="fabric-out-scanTip">请先扫描仓位再扫描布匹二维码</view>
</view>
</template>
<script>
export default {
props: {
canScan: { type: Boolean, default: false },
binId: { type: [Number, String], default: 0 },
code: { type: String, default: '' },
name: { type: String, default: '' },
showPhoneScan: { type: Boolean, default: false },
showDisabledTip: { type: Boolean, default: true },
disabledTip: { type: String, default: '请先提交保存后再扫仓位' },
},
};
</script>
<style scoped lang="scss">
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
.process-in-binRow {
background: #fff;
}
.process-in-binLabel {
flex-shrink: 0;
}
.fabric-out-phoneScanIcon {
margin-left: 16rpx;
flex-shrink: 0;
}
.process-in-binName {
margin-left: 12rpx;
font-size: 26rpx;
color: #333;
max-width: 200rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.process-in-binClear {
margin-left: 16rpx;
font-size: 26rpx;
color: #2979ff;
flex-shrink: 0;
}
</style>

View File

@ -29,17 +29,6 @@
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
</view>
<ProcessOutBinBar
:can-scan="canScan"
:bin-id="warehouseBinId"
:code="warehouseBinCode"
:name="warehouseBinName"
:show-phone-scan="canScan"
@code-input="warehouseBinCode = $event"
@confirm="resolveWarehouseBin"
@phone-scan="handleBinPhoneScan"
@clear="clearWarehouseBin"
/>
<FabricOutScanBar
:can-scan="showQrScanBar"
:value="QRBarCode"
@ -83,7 +72,6 @@ import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
import ProcessOutScanDetail from '@/components/storegoods/ProcessOutScanDetail.vue';
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
import ProcessOutBinBar from '@/components/storegoods/ProcessOutBinBar.vue';
export default {
components: {
@ -92,7 +80,6 @@ export default {
FabricOutFooter,
ProcessOutScanDetail,
ProcessOutDetailList,
ProcessOutBinBar,
},
mixins: [formMixin],
onLoad() {

View File

@ -23,17 +23,6 @@
<text>{{ form.remark || '-' }}</text>
</view>
<ProcessOutBinBar
:can-scan="canScan"
:bin-id="warehouseBinId"
:code="warehouseBinCode"
:name="warehouseBinName"
:show-phone-scan="canScan"
@code-input="warehouseBinCode = $event"
@confirm="resolveWarehouseBin"
@phone-scan="handleBinPhoneScan"
@clear="clearWarehouseBin"
/>
<FabricOutScanBar
:can-scan="showQrScanBar"
:value="QRBarCode"
@ -67,7 +56,6 @@ import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
import ProcessOutScanDetail from '@/components/storegoods/ProcessOutScanDetail.vue';
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
import ProcessOutBinBar from '@/components/storegoods/ProcessOutBinBar.vue';
export default {
components: {
@ -76,7 +64,6 @@ export default {
FabricOutFooter,
ProcessOutScanDetail,
ProcessOutDetailList,
ProcessOutBinBar,
},
mixins: [formMixin],
onLoad(e) {

View File

@ -2,9 +2,8 @@
* 加工出仓单表单 mixin新增/编辑共用
*
* 1. 先填表头加工单位 / 仓库 / 备注提交 add拿到 id 后可扫码
* 2. 先扫仓位getWarehouseBin qr_code + warehouse_id校验后扫布匹二维码
* 3. 扫码走 updateFpmProcessOutOrderarrange_type: 1 录入 / 3 删除 warehouse_bin_id
* 4. 手机扫码成功展示详情后自动再次调起扫码形成连续扫
* 2. 扫码走 updateFpmProcessOutOrderarrange_type: 1 录入 / 3 删除不扫仓位
* 3. 手机扫码成功展示详情后自动再次调起扫码形成连续扫
*/
import util from '@/common/util';
import scanMixin from '@/common/scanMixin.js';
@ -51,14 +50,8 @@ export default {
processUnitOptions: [],
warehouseOptions: [],
dropdownLoading: false,
/** 仓位 */
warehouseBinId: 0,
warehouseBinCode: '',
warehouseBinName: '',
/** 手机连续扫码开关:成功后自动再调起;取消/失败则关闭 */
phoneContinuousScan: false,
/** 手机扫当前目标bin | qr */
phoneScanTarget: 'bin',
};
},
computed: {
@ -82,19 +75,14 @@ export default {
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS_NAME;
return AUDIT_STATUS_MAP[this.auditStatus] || '';
},
/** 录入需先选仓位;删除模式仅需单据可扫 */
canScanQr() {
if (!this.canScan) return false;
if (this.BarCodeDelStatus) return true;
return !!this.warehouseBinId;
return this.canScan;
},
/** 扫码栏在可扫状态下始终展示(含删除勾选) */
showQrScanBar() {
return this.canScan;
},
qrDisabledTip() {
if (!this.canScan) return '请先提交保存后再扫码';
if (!this.warehouseBinId && !this.BarCodeDelStatus) return '请先扫描仓位后再扫布匹二维码';
return '当前状态不可扫码';
},
},
@ -116,38 +104,11 @@ export default {
this.unregisterScanBroadcast();
},
methods: {
clearWarehouseBin() {
this.warehouseBinId = 0;
this.warehouseBinCode = '';
this.warehouseBinName = '';
this.phoneContinuousScan = false;
},
handleBinPhoneScan() {
if (!this.canScan || !this.orderId) {
this.showError('请先提交保存后再扫码');
return;
}
this.phoneContinuousScan = false;
this.phoneScanTarget = 'bin';
this.openPhoneScan({
callback: (scanResult) => {
this.warehouseBinCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
this.$nextTick(() => this.resolveWarehouseBin());
},
fail: () => {},
});
},
handlePhoneScan() {
if (!this.canScan || !this.orderId) {
this.showError('请先提交保存后再扫码');
return;
}
// 删除模式可直接扫布匹码;录入模式无仓位时先扫仓位
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
this.handleBinPhoneScan();
return;
}
this.phoneScanTarget = 'qr';
this.phoneContinuousScan = true;
this.openContinuousPhoneScan();
},
@ -179,60 +140,10 @@ export default {
this.registerScanBroadcast((scanResult) => {
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
if (!code) return;
// 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
this.warehouseBinCode = code;
this.$nextTick(() => this.resolveWarehouseBin());
return;
}
this.QRBarCode = code;
this.$nextTick(() => this.handleScan());
});
},
resolveWarehouseBin() {
const code = (this.warehouseBinCode || '').trim();
if (!this.canScan || !this.orderId) {
this.showError('请先提交保存后再扫码');
return;
}
if (!code) return;
if (!this.form.warehouse_id) {
this.showError('单据缺少仓库信息');
return;
}
uni.showLoading({ title: '识别仓位...' });
return this.$u.api.warehouseBin.getByQrCode({
qr_code: code,
warehouse_id: Number(this.form.warehouse_id),
})
.then((data) => {
uni.hideLoading();
if (!data || !data.id) {
throw new Error('未识别到仓位');
}
// 返回 physical_warehouse_id与单据仓库校验
if (
data.physical_warehouse_id
&& String(data.physical_warehouse_id) !== String(this.form.warehouse_id)
) {
this.warehouseBinId = 0;
this.warehouseBinName = '';
throw new Error('该仓位不属于当前仓库');
}
this.warehouseBinId = data.id;
this.warehouseBinCode = data.code || data.qr_code || code;
this.warehouseBinName = data.name || '';
this.BillDataMessage = '';
speak('仓位成功');
uni.showToast({ title: '仓位识别成功', icon: 'success' });
})
.catch((e) => {
uni.hideLoading();
this.warehouseBinId = 0;
this.warehouseBinName = '';
this.showError(e.message || '仓位识别失败');
});
},
syncCanScanFromStatus(status) {
const nextCanScan = this.isEditable && canScanAtStatus(status);
if (this.canScan && !nextCanScan) {
@ -316,7 +227,6 @@ export default {
this.auditStatus = order.audit_status;
this.headerSaved = true;
this.form = orderToFormFields(order);
this.clearWarehouseBin();
this.syncCanScanFromStatus(order.audit_status);
if (this.canScan) this.registerOrderScanBroadcast();
return order;
@ -402,9 +312,8 @@ export default {
const order = normalizeOrder(detail);
this.applyOrder(order);
this.headerSaved = true;
this.clearWarehouseBin();
this.syncCanScanFromStatus(order.audit_status);
this.showSuccess('保存成功,请先扫描仓位');
this.showSuccess('保存成功,请开始扫码');
this.registerOrderScanBroadcast();
})
.catch((e) => {
@ -426,19 +335,12 @@ export default {
this.phoneContinuousScan = false;
return;
}
const isDelete = this.BarCodeDelStatus;
if (!isDelete && !this.warehouseBinId) {
this.showError('请先扫描仓位');
this.QRBarCode = '';
this.phoneContinuousScan = false;
return;
}
if (!code) {
this.QRBarCode = '';
if (fromPhone) this.scheduleNextPhoneScan();
return;
}
const arrangeType = isDelete ? ARRANGE_TYPE.DEL : ARRANGE_TYPE.IN;
const arrangeType = this.BarCodeDelStatus ? ARRANGE_TYPE.DEL : ARRANGE_TYPE.IN;
this.doScanUpdate(code, arrangeType, { fromPhone });
},
BarCodeDelChange(e) {
@ -480,8 +382,6 @@ export default {
id: this.orderId,
scanCode,
arrangeType,
// 删除不强制仓位;录入带当前仓位
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
}))
.then((scanRes) => {
this.scanDetail = buildScanDetailFromScanResponse(scanRes);