Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-uniapp into master_hella

hella_vue3
lijuncheng 8 months ago
parent
commit
3851d362da
  1. 155
      src/common/detail.js
  2. 146
      src/mycomponents/detail/detailList.vue
  3. 56
      src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue
  4. 9
      src/pages/purchaseReceipt/job/receiptDetail.vue
  5. 2
      src/static/config.js

155
src/common/detail.js

@ -1,83 +1,100 @@
import { import {
calc calc
} from '@/common/calc' } from '@/common/calc'
import { Decimal } from 'decimal.js';//引入 import {
export function getDataSource(subList) { Decimal
let items = []; } from 'decimal.js'; //引入
subList.forEach(detail => { export function getDataSource(dataList) {
var item = items.find(r => let items = [];
r.itemCode == detail.itemCode)
if (item == undefined) {
item = createItemInfo(detail);
let newDetail = createDetailInfo(detail); //
item.subList.push(newDetail);
items.push(item)
} else {
item.qty = calc.add(item.qty, detail.qty)
let newDetail = createDetailInfo(detail); //
item.subList.push(newDetail);
}
})
return items;
}
export function createItemInfo(detail) { let parentList = dataList.filter(r => r.parentPackingNumber == null || r
let item = { .parentPackingNumber == '');
itemCode: detail.itemCode, let childList = dataList.filter(r => r.parentPackingNumber != '' && r.parentPackingNumber != null);
itemName: detail.itemName,
stdPackQty: Number(detail.stdPackQty) || undefined, parentList.forEach(detail => {
stdPackUnit: detail.stdPackUnit, var item = items.find(r =>
qty: Number(detail.qty), r.itemCode == detail.itemCode)
handleQty: 0, if (item == undefined) {
uom: detail.uom, item = createItemInfo(detail);
subList: [] let newDetail = createDetailInfo(detail); //
item.subList.push(newDetail);
items.push(item)
} else {
item.qty = calc.add(item.qty, detail.qty)
let newDetail = createDetailInfo(detail); //
item.subList.push(newDetail);
} }
return item; })
}
if (childList.length > 0) {
items.forEach(r =>
r.subList.forEach(s => {
s.packList = childList.filter(c => c.parentPackingNumber == s.packingNumber)
})
export function createDetailInfo(data) { )
data.scaned = false;
// data.record = {};
let detail = data;
return detail;
} }
//根据明细创建记录 return items;
export function createRecordInfo(detail, balance) { }
var record = {}
// let record = JSON.parse(JSON.stringify(detail)); export function createItemInfo(detail) {
//克隆对象,深度克隆,防止双向绑定同一个变量 let item = {
Object.assign(record, detail) itemCode: detail.itemCode,
detail.scaned = true; itemName: detail.itemName,
detail.balance = balance; stdPackQty: Number(detail.stdPackQty) || undefined,
detail.recommendInventoryStatus = detail.inventoryStatus; stdPackUnit: detail.stdPackUnit,
detail.inventoryStatus = balance.inventoryStatus; qty: Number(detail.qty),
record.qty = Number(balance.qty); handleQty: 0,
return record; uom: detail.uom,
subList: []
} }
return item;
}
export function createDetailInfo(data) {
data.scaned = false;
let detail = data;
detail.packList = [];
return detail;
}
//根据明细创建记录
export function createRecordInfo(detail, balance) {
var record = {}
// let record = JSON.parse(JSON.stringify(detail));
//克隆对象,深度克隆,防止双向绑定同一个变量
Object.assign(record, detail)
detail.scaned = true;
detail.balance = balance;
detail.recommendInventoryStatus = detail.inventoryStatus;
detail.inventoryStatus = balance.inventoryStatus;
record.qty = Number(balance.qty);
return record;
}
//计算实际数量 //计算实际数量
export function calcHandleQty(detailSource) { export function calcHandleQty(detailSource) {
for (let item of detailSource) { for (let item of detailSource) {
item.handleQty = new Decimal(0).toNumber(); item.handleQty = new Decimal(0).toNumber();
item.qty = new Decimal(0).toNumber(); item.qty = new Decimal(0).toNumber();
for (let detail of item.subList) { for (let detail of item.subList) {
if (detail != undefined && detail.scaned) { if (detail != undefined && detail.scaned) {
item.handleQty = calc.add(item.handleQty,detail.handleQty); item.handleQty = calc.add(item.handleQty, detail.handleQty);
item.qty = calc.add(item.qty,detail.qty); item.qty = calc.add(item.qty, detail.qty);
}
} }
} }
} }
}
export function getScanCount(subList) { export function getScanCount(subList) {
let items = subList.filter(r => { let items = subList.filter(r => {
if (r.scaned) { if (r.scaned) {
return r; return r;
} }
}) })
let scanCount = items != null ? items.length : 0; let scanCount = items != null ? items.length : 0;
return scanCount; return scanCount;
} }

146
src/mycomponents/detail/detailList.vue

@ -0,0 +1,146 @@
<template>
<view class="" v-for="(item,index) in dataContent" :key="item.id">
<uni-collapse ref="collapse" @change="">
<uni-collapse-item :open="true">
<template v-slot:title>
<recommend :detail="item" :isShowLocation="false" :isShowFromLocation="false"></recommend>
</template>
<view v-for="(pack,index) in item.packList" :key="pack.id" style="margin-left: 20px;">
<recommend :detail="pack" :isShowLocation="false" :isShowFromLocation="false"
:isShowToLocation="false" :isShowBatch="false"></recommend>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import container from '@/mycomponents/container/container.vue'
import pack from '@/mycomponents/balance/pack.vue'
import location from '@/mycomponents/balance/location.vue'
import toLocation from '@/mycomponents/balance/toLocation.vue'
import batch from '@/mycomponents/balance/batch.vue'
import recommendQty from '@/mycomponents/qty/recommendQty.vue'
import compareQty from '@/mycomponents/qty/compareQty.vue'
import config from '@/static/config.js'
import recommend from '@/mycomponents/recommend/recommend.vue'
export default {
components: {
container,
pack,
location,
toLocation,
batch,
recommendQty,
compareQty,
recommend
},
data() {
return {
}
},
props: {
dataContent: {
type: Object,
default: {}
},
isShowContainer: {
type: Boolean,
default: true
},
isShowPack: {
type: Boolean,
default: true
},
isShowBatch: {
type: Boolean,
default: true
},
isShowFromLocation: {
type: Boolean,
default: true
},
isShowToLocation: {
type: Boolean,
default: false
},
isShowStatus: {
type: Boolean,
default: true
},
locationTitle: {
type: String,
default: '库位'
},
},
watch: {
},
methods: {
copy() {
// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100
var content = "HPQ;V1.0;I" + this.detail.itemCode + ";P" + this.detail.packingNumber + ";B" + this.detail
.batch + ";Q" + this.detail.qty
// #ifdef H5
this.$copyText(content).then(
res => {
uni.showToast({
title: '复制采购标签成功',
icon: 'none'
})
}
)
// #endif
// #ifndef H5
uni.setClipboardData({
data: content,
success: () => {
uni.showToast({
title: '复制采购标签成功'
})
}
})
// #endif
},
copyPro() {
// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100
var content = "HMQ;V1.0;I" + this.detail.itemCode + ";P" + this.detail.packingNumber + ";B" + this.detail
.batch + ";Q" + this.detail.qty
// #ifdef H5
this.$copyText(content).then(
res => {
uni.showToast({
title: '复制制品标签成功',
icon: 'none'
})
}
)
// #endif
// #ifndef H5
uni.setClipboardData({
data: content,
success: () => {
uni.showToast({
title: '复制制品标签成功'
})
}
})
// #endif
},
isDevlement() {
return config.isDevelopment;
}
}
}
</script>
<style>
</style>

56
src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue

@ -1,24 +1,16 @@
<template> <template>
<view class="" style="background-color: #fff;"> <view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1" @change=""> <uni-collapse ref="collapse" @change="" style="height: 500px;">
<uni-collapse-item :open="true"> <uni-collapse-item :open="true">
<template v-slot:title> <template v-slot:title>
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowPackUnit="false"></itemCompareQty> <itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowPackUnit="false"></itemCompareQty>
</template> </template>
<detail-list :dataContent="dataContent.subList"></detail-list>
<view class="" v-for="(item,index) in dataContent.subList" :key="item.id">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,item)"
:right-options="item.scaned?scanOptions:detailOptions">
<recommend :detail="item" :isShowLocation="false" :isShowFromLocation="false" :isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </uni-collapse>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" <recommend-qty-edit ref=" receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
@confirm="confirm">
</recommend-qty-edit> </recommend-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' <win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationTypeList="locationTypeList"></win-scan-location> :locationTypeList="locationTypeList"></win-scan-location>
@ -34,7 +26,9 @@
import jobDetailPopup from '@/mycomponents/detail/jobDetailPopup.vue' import jobDetailPopup from '@/mycomponents/detail/jobDetailPopup.vue'
import receiptDetailInfoPopup from '@/pages/purchaseReceipt/coms/receiptDetailInfoPopup.vue' import receiptDetailInfoPopup from '@/pages/purchaseReceipt/coms/receiptDetailInfoPopup.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import pack from '@/mycomponents/balance/pack.vue'
import detailList from '@/mycomponents/detail/detailList.vue'
import { import {
getDetailOption, getDetailOption,
getPurchaseReceiptOption getPurchaseReceiptOption
@ -47,7 +41,8 @@
recommendQtyEdit, recommendQtyEdit,
jobDetailPopup, jobDetailPopup,
receiptDetailInfoPopup, receiptDetailInfoPopup,
winScanLocation winScanLocation,
detailList
}, },
props: { props: {
dataContent: { dataContent: {
@ -62,8 +57,8 @@
type: Object, type: Object,
default: {} default: {}
}, },
}, },
watch: { watch: {
@ -77,7 +72,7 @@
} }
}, },
locatonItem:{}, locatonItem: {},
detailOptions: [], detailOptions: [],
scanOptions: [] scanOptions: []
} }
@ -88,17 +83,30 @@
this.detailOptions = getDetailOption(); this.detailOptions = getDetailOption();
} }
if (this.scanOptions.length == 0) { if (this.scanOptions.length == 0) {
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty,this.settingParam.allowModifyLocation) this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, this.settingParam
.allowModifyLocation)
} }
this.resizeCollapse();
}, },
methods: { methods: {
resizeCollapse() {
this.$nextTick(r => {
this.$refs.collapse.forEach(r => {
r.childrens.forEach(i => {
i.init();
})
r.resize();
})
});
},
swipeClick(e, item) { swipeClick(e, item) {
if (e.content.text == "详情") { if (e.content.text == "详情") {
this.detail(item) this.detail(item)
} else if (e.content.text == "编辑") { } else if (e.content.text == "编辑") {
this.edit(item) this.edit(item)
} else if (e.content.text == "库位") { } else if (e.content.text == "库位") {
this.showLocation(item) this.showLocation(item)
} else if (e.content.text == "移除") { } else if (e.content.text == "移除") {
this.remove(item) this.remove(item)
@ -106,15 +114,15 @@
}, },
edit(item) { edit(item) {
this.editItem = item; this.editItem = item;
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty,item.labelQty); this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
}, },
showLocation(item) { showLocation(item) {
this.locatonItem =item; this.locatonItem = item;
this.$refs.scanLocationCode.openScanPopup(); this.$refs.scanLocationCode.openScanPopup();
}, },
// //
getLocation(location, code) { getLocation(location, code) {
this.locatonItem.toLocationCode =code; this.locatonItem.toLocationCode = code;
this.$emit('updateData') this.$emit('updateData')
}, },
@ -142,4 +150,4 @@
</script> </script>
<style> <style>
</style> </style>

9
src/pages/purchaseReceipt/job/receiptDetail.vue

@ -46,8 +46,9 @@
</view> </view>
</view> </view>
<win-scan-pack ref="scanPopup" @getResult='getScanResult'></win-scan-pack>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
<winScanPackAndCont ref="scanPopup" @getResult='getScanResult'></winScanPackAndCont> <!-- <winScanPackAndCont ref="scanPopup" @getResult='getScanResult'></winScanPackAndCont> -->
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
@ -87,16 +88,17 @@
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackAndCont from '@/mycomponents/scan/winScanPackAndCont.vue' import winScanPackAndCont from '@/mycomponents/scan/winScanPackAndCont.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue' import locationCompare from '@/mycomponents/location/locationCompare.vue'
import comReceiptDetailCard from '@/pages/purchaseReceipt/coms/comReceiptDetailCard.vue' import comReceiptDetailCard from '@/pages/purchaseReceipt/coms/comReceiptDetailCard.vue'
import jobTopAsn from '@/mycomponents/job/jobTopAsn.vue' import jobTopAsn from '@/mycomponents/job/jobTopAsn.vue'
export default { export default {
name: 'receipt_detail', name: 'receipt_detail',
components: { components: {
winScanButton, winScanButton,
winScanPackAndCont, winScanPackAndCont,
winScanPack,
comReceiptDetailCard, comReceiptDetailCard,
locationCompare, locationCompare,
jobTopAsn jobTopAsn
@ -201,7 +203,7 @@
that.subList[0].containerNumber = "CN-00000001"; that.subList[0].containerNumber = "CN-00000001";
that.jobStatus = res.data.status that.jobStatus = res.data.status
that.jobToLocationCode = that.subList[0].toLocationCode that.jobToLocationCode = that.subList[0].toLocationCode
that.detailSource = getDataSource(that.subList) that.detailSource = getDataSource( that.subList)
console.log(JSON.stringify(this.detailSource)) console.log(JSON.stringify(this.detailSource))
} else { } else {
that.showMessage('列表数据为0'); that.showMessage('列表数据为0');
@ -217,6 +219,7 @@
getScanResult(result) { getScanResult(result) {
try { try {
var itemCode = result.label.itemCode; var itemCode = result.label.itemCode;
var detail = this.detailSource.find(r => r.itemCode == itemCode); var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) { if (detail == undefined) {

2
src/static/config.js

@ -1,7 +1,7 @@
let request_url = "http://192.168.0.211:12080/admin-api" let request_url = "http://192.168.0.211:12080/admin-api"
// let request_url = "http://dev.ccwin-in.com:25100/api/admin-api" // let request_url = "http://dev.ccwin-in.com:25100/api/admin-api"
let isDevelopment = true let isDevelopment = false
export default { export default {
request_url, request_url,

Loading…
Cancel
Save