浏览代码

大件复核-计算产品数量、设置默认打印机

zhaohuanhuan 8 月之前
父节点
当前提交
ae1e11cbfa
共有 1 个文件被更改,包括 35 次插入14 次删除
  1. 35 14
      src/views/outbound/check/large/index.vue

+ 35 - 14
src/views/outbound/check/large/index.vue

@@ -193,24 +193,41 @@ const orderList = computed(() => {
     })
 })
 
-// 计算总数
-const calculateCount = (key, compareValue = null) => {
+//订单产品总数
+const orderBarcodeCount = computed(() => {
   return dataList.value.reduce((sum, item) => {
-    if (item.qtyOrdered === compareValue) {
-      return sum + Number(item[key])
+    if (item.qtyOrdered != null) {
+      return sum + Number(item.oldQty)
     }
     return sum
   }, 0)
-}
-
-// 订单产品总数
-const orderBarcodeCount = computed(() => calculateCount('oldQty', null))
-
-// 扫描订单产品总数
-const scanOrderBarcodeCount = computed(() => calculateCount('oldQuantity', null))
-
-// 耗材总数
-const materialCount = computed(() => calculateCount('oldQty', undefined))
+})
+//扫描订单产品总数
+const scanOrderBarcodeCount = computed(() => {
+  return dataList.value.reduce((sum, item) => {
+    if (item.qtyOrdered != null) {
+      return sum + Number(item.oldQuantity)
+    }
+    return sum
+  }, 0)
+})
+//耗材总数
+const materialCount = computed(() => {
+  return dataList.value.reduce((sum, item) => {
+    if (item.qtyOrdered == null) {
+      return sum + Number(item.oldQty)
+    }
+    return sum
+  }, 0)
+})
+const scanMaterialCount = computed(() => {
+  return dataList.value.reduce((sum, item) => {
+    if (item.qtyOrdered == null) {
+      return sum + Number(item.quantity)
+    }
+    return sum
+  }, 0)
+})
 //匹配条码
 const matchBarcodeList = ref([])
 //扣除数量
@@ -417,6 +434,9 @@ const setPrinter=()=>{
   printerRef.value?.show(warehouse)
 }
 const printer=ref(null)
+if(localStorage.getItem('check-print')){
+  printer.value=JSON.parse(localStorage.getItem('check-print'))
+}
 const print=(templateCode,code)=>{
   if(!printer.value){
     scanError()
@@ -440,6 +460,7 @@ const print=(templateCode,code)=>{
 }
 const onPrint=(code)=>{
   printer.value=code
+  localStorage.setItem('check-print',JSON.stringify(code))
 }
 //设置订单号
 const setBarcode = (code) => {