feat(storegoods): 新增加工进仓模块并适配智盛ERP
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,17 +3,18 @@
|
||||
*
|
||||
* 业务说明:
|
||||
* 1. 后端当前仅提供「坯布其他出货单」一种类型的接口,故出仓类型固定为 other,
|
||||
* 表头保留接收单位(business_unit) / 出货日期 / 备注 等字段。
|
||||
* 表头保留染厂(business_unit) / 出货日期 / 备注 等字段。
|
||||
* 2. 用户先填写表头并「提交保存」(addGfmOtherDeliveryOrder),拿到出仓单 id 后即可扫码;
|
||||
* 扫码新增/删除细码走 updateGfmOtherDeliveryOrder;勾选锁定维度时附带 *_lock 字段,操作后用返回的最新详情刷新。
|
||||
* 3. 后端没有「修改表头」接口,保存成功或编辑进入后表头变为只读,仅可扫码维护细码。
|
||||
*/
|
||||
import util from '@/common/util';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import { initTts, speak } from '@/common/tts.js';
|
||||
import {
|
||||
AUDIT_STATUS_MAP,
|
||||
BILL_TYPES,
|
||||
BUSINESS_UNIT_TYPE_KNITTING_FACTORY,
|
||||
BUSINESS_UNIT_TYPE_DYE_FACTORY,
|
||||
normalizeOrder,
|
||||
mapToSelectOptions,
|
||||
getFineCodeScanCode,
|
||||
@@ -31,6 +32,7 @@ import {
|
||||
buildScanUpdateParams,
|
||||
getOrderDisplayWeight,
|
||||
getFineCodeDisplayWeight,
|
||||
resolveScanMismatchVoice,
|
||||
} from '@/common/storeFabricBusinessOut';
|
||||
|
||||
export default {
|
||||
@@ -92,6 +94,7 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
this.isPageActive = true;
|
||||
initTts();
|
||||
if (this.canScan && this.isEditable) {
|
||||
this.registerScanBroadcast((scanResult) => {
|
||||
this.QRBarCode = scanResult.trim().replace(/[\r\n]/g, '');
|
||||
@@ -136,7 +139,7 @@ export default {
|
||||
},
|
||||
ensureBusinessUnitOptions() {
|
||||
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_KNITTING_FACTORY })
|
||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_DYE_FACTORY })
|
||||
.then((res) => {
|
||||
this.businessUnitOptions = mapToSelectOptions(res);
|
||||
return this.businessUnitOptions;
|
||||
@@ -191,7 +194,7 @@ export default {
|
||||
this.selectList = list;
|
||||
this.selectShow = true;
|
||||
};
|
||||
if (type === '接收单位') {
|
||||
if (type === '染厂') {
|
||||
this.ensureBusinessUnitOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载单位列表失败'));
|
||||
@@ -199,7 +202,7 @@ export default {
|
||||
},
|
||||
selectConfirmFun(e) {
|
||||
const item = e[0];
|
||||
if (this.selectType === '接收单位') {
|
||||
if (this.selectType === '染厂') {
|
||||
this.form.business_unit_id = item.value;
|
||||
this.form.business_unit_name = item.label;
|
||||
}
|
||||
@@ -208,7 +211,7 @@ export default {
|
||||
this.form.delivery_time = e.detail.value;
|
||||
},
|
||||
validateForm() {
|
||||
if (!this.form.business_unit_id) return '请选择接收单位';
|
||||
if (!this.form.business_unit_id) return '请选择染厂';
|
||||
if (!this.form.delivery_time) return '请选择出货日期';
|
||||
return '';
|
||||
},
|
||||
@@ -334,12 +337,19 @@ export default {
|
||||
}
|
||||
this.BillDataMessage = scanType === 2 ? '删除成功' : '扫描成功';
|
||||
this.QRBarCode = '';
|
||||
if (scanType === 2) this.showSuccess('删除成功');
|
||||
else util.playSuccessAudio();
|
||||
if (scanType === 2) {
|
||||
speak('已删除出仓');
|
||||
uni.showToast({ title: '删除成功', icon: 'success' });
|
||||
} else {
|
||||
speak('成功');
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
this.showError(e.message || (scanType === 2 ? '删除失败' : '扫码失败'));
|
||||
const message = e.message || (scanType === 2 ? '删除失败' : '扫码失败');
|
||||
const mismatchVoice = resolveScanMismatchVoice(message);
|
||||
if (mismatchVoice) speak(mismatchVoice);
|
||||
this.showError(message, { skipErrorAudio: !!mismatchVoice });
|
||||
this.QRBarCode = '';
|
||||
});
|
||||
},
|
||||
@@ -383,8 +393,8 @@ export default {
|
||||
}),
|
||||
});
|
||||
},
|
||||
showError(message) {
|
||||
util.playErrorAudio();
|
||||
showError(message, options = {}) {
|
||||
if (!options.skipErrorAudio) util.playErrorAudio();
|
||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||
},
|
||||
showSuccess(message) {
|
||||
|
||||
Reference in New Issue
Block a user