|
|
@@ -115,9 +115,9 @@
|
|
|
</van-row>
|
|
|
</van-dialog>
|
|
|
<!-- 装箱-->
|
|
|
- <check-packing ref="checkPackingRef" @cancelOrder="cancelOrder" @resetPackingStatus="resetPackingStatus" @getOrderPacking="_getOrderPacking" @print="print"/>
|
|
|
+ <check-packing ref="checkPackingRef" @cancelOrder="cancelOrder" @resetPackingStatus="resetPackingStatus" @getOrderPacking="_getOrderPacking" @print-picking-list="printPickingList" @print="print"/>
|
|
|
<!-- 批量装箱-->
|
|
|
- <batch-packing ref="batchPackingRef" @print="print" @loadData="loadData" />
|
|
|
+ <batch-packing ref="batchPackingRef" @print="print" @loadData="loadData" @print-picking-list="printPickingList" />
|
|
|
<!-- 重置装箱-->
|
|
|
<packing-list ref="packingListRef" @loadData="loadData" />
|
|
|
</div>
|
|
|
@@ -129,7 +129,7 @@ import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
|
|
|
import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
|
|
|
import { useStore } from '@/store/modules/user'
|
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
|
-import { getOrderPacking, getPendingReviewTask, reversePicking } from '@/api/check'
|
|
|
+import { getOrderPacking, getPendingReviewTask, listEnableCheckDocumentPrint, reversePicking } from '@/api/check'
|
|
|
import { barcodeToUpperCase } from '@/utils/dataType'
|
|
|
import { showConfirmDialog, showDialog, showNotify, showToast } from 'vant'
|
|
|
import { fluxPrint } from '@/api/picking'
|
|
|
@@ -462,14 +462,88 @@ const print=(templateCode,code)=>{
|
|
|
.then(res => {
|
|
|
scanSuccess()
|
|
|
showNotify({ type: 'success', duration: 3000, message: '打印已发起,请检查打印情况' });
|
|
|
+ printPickingList(code,currPackingList.value)
|
|
|
})
|
|
|
.catch(err => {
|
|
|
scanError()
|
|
|
tips.value=err.message || '系统异常,请联系技术支持!'
|
|
|
}).finally(() => {
|
|
|
- closeLoading()
|
|
|
+ closeLoading()
|
|
|
})
|
|
|
-
|
|
|
+}
|
|
|
+// 打印装箱清单
|
|
|
+// 查询打印策略
|
|
|
+const printConfig=ref([])
|
|
|
+listEnableCheckDocumentPrint({ 'name': '', 'owner': '' }).then(res => {
|
|
|
+ printConfig.value= res.data
|
|
|
+})
|
|
|
+const printPickingList=(deliveryNo,curPackingList)=> {
|
|
|
+ // 打印装箱清单
|
|
|
+ let printData=[]
|
|
|
+ const findIndex = printConfig.value.findIndex(item => item.ownerList.includes(orderDetail.value.customerId));
|
|
|
+ // 检查质检数据并添加质检打印任务
|
|
|
+ const hasQualityCheck = curPackingList.some(item => item.qualityCheck === true);
|
|
|
+ if (hasQualityCheck) {
|
|
|
+ const qcData = {
|
|
|
+ warehouse: orderDetail.value.warehouseId,
|
|
|
+ code: deliveryNo,
|
|
|
+ printServer: printer.value.server,
|
|
|
+ printName: printer.value.printer,
|
|
|
+ templateCode: 'A3014_PACK_CARTON_QC'
|
|
|
+ };
|
|
|
+ printData.push(qcData);
|
|
|
+ }
|
|
|
+ if (findIndex === -1) {
|
|
|
+ printRequests(0, printData);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ printConfig.value.forEach((item,index) => {
|
|
|
+ const isOwner = item.ownerList.includes(orderDetail.value.customerId);
|
|
|
+ const printMap = item.printer && item.printer !== '' ? item.printer.split('+') : [printer.value.server,printer.value.printer];
|
|
|
+ // 判断 店铺和承运商是否匹配
|
|
|
+ const isShop = item.shop ? item.shop.includes(orderDetail.value.shop) : true;
|
|
|
+ const isCarrier =item.carriers? item.carriers.includes(orderDetail.value.carrierId):true
|
|
|
+ if (isOwner && isShop && isCarrier ) {
|
|
|
+ const data = {
|
|
|
+ warehouse: orderDetail.value.warehouseId,
|
|
|
+ code: deliveryNo,
|
|
|
+ printServer: printMap[0],
|
|
|
+ printName: printMap[1],
|
|
|
+ templateCode: item.templateCode
|
|
|
+ };
|
|
|
+ const printCount = Math.max(item.printNum, 1)
|
|
|
+ printData.push(...new Array(printCount).fill(data));
|
|
|
+ }
|
|
|
+ if(index==printConfig.value.length-1){
|
|
|
+ printRequests(0,printData)
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+const printRequests = async(index, dataList)=> {
|
|
|
+ if (index >= dataList.length) {
|
|
|
+ // if (this.orderList.length == 0) {
|
|
|
+ // this.getOrderList();
|
|
|
+ // }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const res = await _printMode(dataList[index]);
|
|
|
+ if (res) {
|
|
|
+ this.$message.success('打印成功');
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('打印请求发生错误:', error);
|
|
|
+ } finally {
|
|
|
+ closeLoading();
|
|
|
+ await printRequests(index + 1, dataList);
|
|
|
+ }
|
|
|
+}
|
|
|
+const _printMode=(data)=> {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ fluxPrint(data)
|
|
|
+ .then(res => resolve(res))
|
|
|
+ .catch(err => reject(`打印失败: ${err}`));
|
|
|
+ });
|
|
|
}
|
|
|
const onPrint=(code)=>{
|
|
|
printer.value=code
|