Browse Source

deliver/job 文件迁移Vue2升级Vue3 10/25-11/8

hella_vue3
王志国 2 weeks ago
parent
commit
a57256000c
  1. 5
      src/pages/count/job/countJob.vue
  2. 2
      src/pages/count/job/fuzzyCountJob.vue
  3. 102
      src/pages/customerReturn/job/returnDetail.vue
  4. 2
      src/pages/customerReturn/job/returnJob.vue
  5. 55
      src/pages/customerReturn/record/returnRecord.vue
  6. 91
      src/pages/deliver/coms/comDeliverDetailCardBatch.vue
  7. 506
      src/pages/deliver/coms/comScanDeliverPackBatch.vue
  8. 433
      src/pages/deliver/job/deliverDetailBatch.vue

5
src/pages/count/job/countJob.vue

@ -23,7 +23,7 @@
<u-loadmore :status="loadingType" /> <u-loadmore :status="loadingType" />
</view> </view>
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button> <win-scan-button @goScan="openScanPopup" v-if="manageModel!='BY_BATCH' && jobList.length > 0"></win-scan-button>
<winScanPackJob title="库位" ref="scanPopup" @getResult="getScanResult"> </winScanPackJob> <winScanPackJob title="库位" ref="scanPopup" @getResult="getScanResult"> </winScanPackJob>
<jobListView ref="jobListRef" @selectItem="selectItem"></jobListView> <jobListView ref="jobListRef" @selectItem="selectItem"></jobListView>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
@ -77,6 +77,7 @@ const queryParams = reactive({
status: "1,2", status: "1,2",
fromLocationCode: "" fromLocationCode: ""
}) })
const manageModel = import.meta.env.VITE_MANAGE_MODEL
onShow(() => { onShow(() => {
setTimeout(()=>{ setTimeout(()=>{
getList('refresh') getList('refresh')
@ -180,7 +181,7 @@ const setQueryParam = ()=> {
if (queryParams.creationTime) { if (queryParams.creationTime) {
filterParams.push({ filterParams.push({
column: "create_time", column: "create_time",
action: "betweeen", action: "between",
value: queryParams.creationTime value: queryParams.creationTime
}) })
} }

2
src/pages/count/job/fuzzyCountJob.vue

@ -131,7 +131,7 @@ export default {
if (this.checkedToday) { if (this.checkedToday) {
filters.push({ filters.push({
column: 'create_time', column: 'create_time',
action: 'betweeen', action: 'between',
value: this.todayTime value: this.todayTime
}) })
} }

102
src/pages/customerReturn/job/returnDetail.vue

@ -58,7 +58,7 @@ import { getCustomerReturnJobDetail, takeCustomerReturnJob, cancleTakeCustomerRe
import { goHome, navigateBack, getPackingNumberAndBatch, getInventoryStatusName, getDirectoryItemArray } from '@/common/basic.js' import { goHome, navigateBack, getPackingNumberAndBatch, getInventoryStatusName, getDirectoryItemArray } from '@/common/basic.js'
import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js' import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js'
import { calc } from '@/common/calc'
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue' import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue' import locationCompare from '@/mycomponents/location/locationCompare.vue'
@ -67,7 +67,7 @@ import comDetailCardBatch from "@/mycomponents/detail/comDetailCardBatch.vue"
import detailInfoPopup from '@/pages/customerReturn/coms/detailInfoPopup.vue' import detailInfoPopup from '@/pages/customerReturn/coms/detailInfoPopup.vue'
import jobTop from '@/mycomponents/job/jobTop.vue' import jobTop from '@/mycomponents/job/jobTop.vue'
import { useCountStore } from '@/store' import { useCountStore } from '@/store'
// store
const store = useCountStore() const store = useCountStore()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const id = ref('') const id = ref('')
@ -205,13 +205,55 @@ const openDetail = (item) => {
detailInfoPopupRef.value.openPopup(item) detailInfoPopupRef.value.openPopup(item)
} }
const openScanPopup = () => { const openScanPopup = () => {
detailInfoPopupRef.value.openPopup() detailInfoPopupRef.value.openPopup(fromLocationCode.value)
} }
const closeScanPopup = () => { const closeScanPopup = () => {
scanPopup.value.closeScanPopup() scanPopup.value.closeScanPopup()
} }
const getScanResult = (result)=> { const getScanResult = (result)=> {
managementType.value == result.managementType
if(result.managementType == "BY_BATCH" || result.managementType == "BY_QUANTITY" ){
setDataBatch(result)
}else{
setData(result)
}
}
const setDataBatch = (result)=>{
try {
const packingNumber = result.package.number;
const batch = result.label.batch;
const qty = result.label.qty;
const itemCode = result.label.itemCode;
const detail = detailSource.value.find(r => r.itemCode == itemCode);
if (detail == undefined) {
showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
console.log(366,batch)
console.log(366,detail.subList)
let itemDetail = detail.subList.find(r => {
return r.batch == batch
})
if (itemDetail == undefined) {
showErrorMessage( "批次[" + batch + "]不在列表中")
} else {
if (itemDetail.scaned) {
// this.showErrorMessage("[" + packingNumber + "]" + "[" + batch + "]")
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty)
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty)
itemDetail.packQty = Number(result.package.packQty)
itemDetail.packUnit = result.package.packUnit
calcHandleQty();
}
}
}
} catch (e) {
showMessage(e.message)
}
}
const setData = (result) => {
try { try {
const { packingNumber } = result.label const { packingNumber } = result.label
const { batch } = result.label const { batch } = result.label
@ -255,12 +297,20 @@ const commit = () => {
// // // //
if (scanCount.value == subList.value.length) { if (scanCount.value == subList.value.length) {
if(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){
checkCountBatch()
}else{
checkCount(); checkCount();
}
} else if (scanCount.value < subList.value.length) { } else if (scanCount.value < subList.value.length) {
// //
if (jobContent.value.allowPartialComplete == "TRUE") { if (jobContent.value.allowPartialComplete == "TRUE") {
// //
if(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){
checkCountBatch()
}else{
checkCount(); checkCount();
}
} else { } else {
// //
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
@ -315,6 +365,50 @@ const checkCount = () => {
submitJob() submitJob()
} }
} }
const checkCountBatch = ()=>{
//
let str = ''
let str1 = ''
let str2 = ''
detailSource.value.forEach((item) => {
item.subList.forEach(cur => {
if (cur.qty != cur.handleQty) {
let tempHandleQty = 0
if(cur.handleQty){
tempHandleQty = cur.handleQty
}else {
tempHandleQty =0
}
str += `批次【${cur.batch}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致`
}
if(cur.handleQty > cur.qty){
str1 = `批次【${cur.batch}】提交数量【${ cur.handleQty}】不可以大于推荐数量【${cur.qty}`
}
if(cur.handleQty < cur.qty){
str2 = `批次【${cur.batch}】提交数量【${ cur.handleQty}】不可以小于推荐数量【${cur.qty}`
}
})
})
jobContent.value.allowBiggerQty = 'FALSE'
if(jobContent.value.allowBiggerQty == 'FALSE' &&str1){
comMessageRef.value.showConfirmWarningModal(str1)
return
}
if(jobContent.value.allowSmallerQty == 'FALSE' && str2){
comMessageRef.value.showConfirmWarningModal(str2)
return
}
if (str) {
str = '任务明细未全部完成,是否提交?\n'+str
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
submitJob()
}
});
} else {
submitJob()
}
}
const submitJob = () => { const submitJob = () => {
proxy.$modal.loading('提交中...') proxy.$modal.loading('提交中...')
const itemCodes = [] const itemCodes = []

2
src/pages/customerReturn/job/returnJob.vue

@ -111,7 +111,7 @@ const getList = (type) => {
if (checkedToday.value) { if (checkedToday.value) {
filters.push({ filters.push({
column: 'create_time', column: 'create_time',
action: 'betweeen', action: 'between',
value: todayTime.value value: todayTime.value
}) })
} }

55
src/pages/customerReturn/record/returnRecord.vue

@ -44,7 +44,7 @@ import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { getBasicCustomerList, customerReturnRecordSubmit } from '@/api/request2.js' import { getBasicCustomerList, customerReturnRecordSubmit } from '@/api/request2.js'
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js'
import { calc } from '@/common/calc.js';
import { getPrecisionStrategyList } from '@/common/balance.js' import { getPrecisionStrategyList } from '@/common/balance.js'
import { goHome, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js' import { goHome, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js'
@ -81,6 +81,7 @@ const comMessageRef = ref()
const scanPopup = ref() const scanPopup = ref()
const scanLocationCode = ref() const scanLocationCode = ref()
const toInventoryStatuses = ref('') const toInventoryStatuses = ref('')
const managementType = ref('')
onLoad((option) => { onLoad((option) => {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: option.title title: option.title
@ -103,7 +104,16 @@ onNavigationBarButtonTap((e) => {
goHome() goHome()
} }
}) })
const getScanResult = (result) => { const getScanResult = (result,managementTypeParams)=> {
managementType.value = managementTypeParams
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
setDataBatch(result)
} else {
setData(result)
}
}
const setData = (result) => {
const { balance } = result const { balance } = result
const { label } = result const { label } = result
const pack = result.package const pack = result.package
@ -133,11 +143,42 @@ const getScanResult = (result) => {
} }
handleCalcHandleQty() handleCalcHandleQty()
} }
const setDataBatch = (result)=>{
let balance = result.balance;
let label = result.label;
let pack = result.package;
let item = detailSource.value.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
const itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.packingNumber =pack.number
newDetail.handleQty =result.label.qty
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
const detail = item.subList.find(r => {
if (r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
handleCalcHandleQty();
}
const handleCalcHandleQty = () => { const handleCalcHandleQty = () => {
calcHandleQty(detailSource.value) calcHandleQty(detailSource.value)
} }
const removeItem = (index, item) => { const removeItem = (index, item) => {
detailSource.value.splice(index, 1) detailSource.value.splice(index, 1)
} }
@ -323,6 +364,12 @@ const showCommitSuccessMessage = (hint) => {
} }
}) })
} }
const showErrorMessage = (message)=> {
comMessageRef.value.showErrorMessage(message, res => {
if (res) {
}
});
}
const clearData = () => { const clearData = () => {
fromLocationCode.value = '' fromLocationCode.value = ''
subList.value = [] subList.value = []

91
src/pages/deliver/coms/comDeliverDetailCardBatch.vue

@ -1,21 +1,27 @@
<template> <template>
<view> <view>
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode" <u-collapse ref="collapse">
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> --> <u-collapse-item :open="true" :class="dataContent.scaned?'scan_view':''">
<template #title>
<view v-for="(item,index) in dataContent.subList" style="margin-bottom: 20rpx;"> <view class="split_line"></view>
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty>
</template>
<view v-for="(item,index) in dataContent.subList" style="margin-top: 10px;">
<u-swipe-action ref="swipeAction" <u-swipe-action ref="swipeAction"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" :options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="(...event)=>swipeClick(event,item,index)" @click="(...event)=>itemCoceClick(event,item,index)">
:class="item.scaned? 'scan_view':''"> <view class="" :class="item.scaned?'scan_view':''">
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty> <recommend :detail="item" :isShowLocation="false" :isShowFromLocation="true" :isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
<location :locationCode="item.fromLocationCode"></location> </view>
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false"
:isShowPack="item.packingNumber"></recommendBalanceBatch>
</u-swipe-action> </u-swipe-action>
</view> </view>
</u-collapse-item>
</u-collapse>
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode"
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> -->
</view> </view>
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit> <recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</recommend-qty-edit>
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> <detail-info-popup ref="detailInfoPopup"></detail-info-popup>
<comMessage ref="message"></comMessage> <comMessage ref="message"></comMessage>
</template> </template>
@ -23,18 +29,19 @@
<script setup lang="ts"> <script setup lang="ts">
import itemQty from '@/mycomponents/item/itemQty.vue' import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue' import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue' import RecommendBalance from '@/mycomponents/balance/recommendBalance.vue'
import handleBalance from '@/mycomponents/balance/handleBalance.vue' import handleBalance from '@/mycomponents/balance/handleBalance.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' import RecommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue' import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import location from '@/mycomponents/balance/location.vue' import location from '@/mycomponents/balance/location.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue'
import batch from '@/mycomponents/balance/batch.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue'
import { import {
getDetailOption, getDetailOption,
getPurchaseReceiptOption,
getRemoveOption, getRemoveOption,
getEditRemoveOption getEditRemoveOption
} from '@/common/array.js'; } from '@/common/array.js';
@ -43,8 +50,8 @@ import {ref, nextTick, onMounted} from 'vue';
const props = defineProps({ const props = defineProps({
dataContent: { dataContent: {
type: Object, type: Array,
default: () => ({}) default: () => ([])
}, },
settingParam: { settingParam: {
type: Object, type: Object,
@ -55,7 +62,7 @@ const props = defineProps({
default: true default: true
} }
}); });
const emit = defineEmits(['updateData']); const emit = defineEmits(['updateData','removeItemCode']);
const option = ref([]); const option = ref([]);
const showItem = ref({}); const showItem = ref({});
@ -66,36 +73,49 @@ const scanOptions = ref([]);
const removeOptions = ref([]); const removeOptions = ref([]);
const editAndRemoveOptions = ref([]); const editAndRemoveOptions = ref([]);
const collapse = ref(null); const collapse = ref(null);
const balanceQtyEdit = ref(null); const receiptEdit = ref(null);
const receiptHint = ref(null); const receiptHint = ref(null);
const message = ref(null); const message = ref(null);
onMounted(() => { onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getEditRemoveOption();
removeOptions.value = getRemoveOption(); removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption(); editAndRemoveOptions.value = getEditRemoveOption();
}); });
const resizeCollapse = () => { const resizeCollapse = () => {
nextTick(() => { nextTick(() => {
collapse.value.forEach(r => { collapse.value.init()
r.childrens.forEach(i => { collapse.value.childrens.forEach(r => {
i.init(); r.init();
});
r.resize();
}); });
}); });
}; };
const swipeClick = (e, batch,
const swipeClick = (e, item, index) => { record,recordIndex,
batchIndex,
Batchs,
locatonIndex,
Locations) => {
if (e.content.text == "编辑") {
edit(batch, record)
} else if (e.content.text == "移除") {
remove(batch, record, recordIndex,batchIndex,Batchs,locatonIndex,Locations)
}
}
const itemCoceClick = (e, item, index) => {
if (e.content.text === "编辑") { if (e.content.text === "编辑") {
edit(item); edit(item);
} else if (e.content.text === "移除") { } else if (e.content.text === "移除") {
remove(item, index); item.scaned = false
item.handleQty=0
emit('updateData')
} }
}; };
const edit = (item) => { const edit = (item) => {
editItem.value = item; editItem.value = item;
balanceQtyEdit.value.openEditPopup(item); receiptEdit.value.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
}; };
const detail = (item) => { const detail = (item) => {
@ -103,11 +123,18 @@ const detail = (item) => {
receiptHint.value.openScanPopup(); receiptHint.value.openScanPopup();
}; };
const remove = (item, index) => { const remove = (batch, record, recordIndex,batchIndex,Batchs,locatonIndex,Locations) => {
message.value.showQuestionMessage("确定移除扫描信息?", (res) => { message.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) { if (res) {
item.handleQty = 0; batch.Records.splice(recordIndex, 1);
item.scaned = false; if(batch.Records.length==0&&Batchs[batchIndex].isNewAdd){
Batchs.splice(batchIndex,1)
}
if(batch.Records.length==0&&Locations[locatonIndex].isNewAdd){
Locations.splice(locatonIndex,1)
}
resizeCollapse();
emit('updateData', record)
} }
}); });
}; };

506
src/pages/deliver/coms/comScanDeliverPackBatch.vue

@ -35,7 +35,7 @@
</view> </view>
<u-line class='line_color'></u-line> --> <u-line class='line_color'></u-line> -->
<view class="uni-flex uni-row" style="align-items: center; <!--<view class="uni-flex uni-row" style="align-items: center;
background-color: #fff; background-color: #fff;
margin-left: 20rpx; margin-left: 20rpx;
margin-right: 20rpx; margin-right: 20rpx;
@ -48,12 +48,12 @@
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" <uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位"
@confirm="fromLocationUpdate"></uni-combox> @confirm="fromLocationUpdate"></uni-combox>
</view> </view>
</view> </view>-->
<view class=""> <view class="">
<view class=""> <view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" <win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
:headerType="headerType" :isShowHistory="false"> headerType="HPQ,HMQ" :isShowHistory="false" :locationCode='locationCode'>
</win-com-scan> </win-com-scan>
<view style="width: 100%;"> <view style="width: 100%;">
@ -75,7 +75,7 @@
<u-swipe-action ref="swipeAction" :options="scanOptions" <u-swipe-action ref="swipeAction" :options="scanOptions"
@click="(...event)=>swipeClick(event,record,index)"> @click="(...event)=>swipeClick(event,record,index)">
<view style="padding: 0px 10px"> <view style="padding: 0px 10px">
<balance :dataContent="record" :isShowLocation="false" <balance :dataContent="record" :isShowFromLocation="false"
:isShowStdPack="false"></balance> :isShowStdPack="false"></balance>
</view> </view>
</u-swipe-action> </u-swipe-action>
@ -93,6 +93,10 @@
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> <balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> <balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
<!-- 模拟扫描功能 -->
<!-- <win-com-scan v-show="false" ref="comscansimulate" placeholder="箱标签" @getResult="onScan" :clearResult="true"
headerType="HPQ,HMQ" :isShowHistory="false">
</win-com-scan> -->
</view> </view>
</template> </template>
@ -109,14 +113,23 @@ import {
import { import {
getDirectoryItemArray, getDirectoryItemArray,
getListLocationAreaTypeDesc,
getInventoryStatusDesc
} from '@/common/directory.js'; } from '@/common/directory.js';
import {
getLabelInfo
} from '@/common/label.js';
import { import {
calc calc
} from '@/common/calc.js'; } from '@/common/calc.js';
import { import {
getWorkShopLineStation getWorkShopLineStation,
getBalanceByFilter,
getBalanceByParams,
} from '@/api/request2.js'; } from '@/api/request2.js';
import {
uniqueArray
} from '@/common/basic.js';
import { import {
getBalanceByManagementPrecision getBalanceByManagementPrecision
@ -124,7 +137,17 @@ import {
import {ref, onMounted} from 'vue'; import {ref, onMounted} from 'vue';
const props = defineProps({
title: {
type: String,
default: ''
},
locationCode:{
type: String,
default: ''
}
})
const emit = defineEmits(['closeScan','afterScan'])
const detailOptions = ref(getDetailOption()); const detailOptions = ref(getDetailOption());
const scanOptions = ref(getDetailEditRemoveOption()); const scanOptions = ref(getDetailEditRemoveOption());
const issueRecord = ref([]); const issueRecord = ref([]);
@ -149,20 +172,35 @@ const toLocationCombox = ref(null)
const comscan = ref(null) const comscan = ref(null)
const balanceQtyEdit = ref(null) const balanceQtyEdit = ref(null)
const receiptHint = ref(null) const receiptHint = ref(null)
const inputStyleObject = ref({
const emit = defineEmits(['closeScan','afterScan']) fontSize: "100rpx"
})
const bussinessCode = ref('Issue')
const toLocationAreaTypeList = ref([])
onMounted(() => { onMounted(() => {
detailOptions.value = getDetailOption(); detailOptions.value = getDetailOption();
scanOptions.value = getDetailEditRemoveOption(); scanOptions.value = getDetailEditRemoveOption();
}); });
const openScanPopupForJobSimulate = (content, jobcontent, scanMessage)=> {
issueRecord.value = [];
dataContent.value = content;
jobContent.value = jobcontent;
initData();
getLabelInfo(scanMessage, "HPQ,HMQ", callback => {
if (callback.success) {
onScan(callback);
} else {
showErrorMessage(callback.message, res => {})
}
})
}
const openScanPopup = (content, jobcontent) => { const openScanPopup = (content, jobcontent) => {
issueRecord.value = []; issueRecord.value = [];
dataContent.value = content; dataContent.value = content;
jobContent.value = jobcontent; jobContent.value = jobcontent;
initData(); initData();
positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode + // positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode +
"-" + jobContent.value.subList[0].workStationCode; // "-" + jobContent.value.subList[0].workStationCode;
show.value = true show.value = true
setTimeout(() => { setTimeout(() => {
getfocus(); getfocus();
@ -183,85 +221,239 @@ const initData = () => {
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses); fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses);
toLocation.value = dataContent.value.subList; toLocation.value = dataContent.value.subList;
toLocationCode.value = dataContent.value.subList[0].toLocationCode; toLocationCode.value = dataContent.value.subList[0].toLocationCode;
fromLocationList.value = getFromLocationList(); toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes)
// fromLocationList.value = getFromLocationList();
} }
}; };
const showBalanceSelect = (items, packageInfoValue) => { const showBalanceSelect = (items) => {
packageInfo.value = packageInfoValue;
balanceSelect.value.openPopup(items); balanceSelect.value.openPopup(items);
}; };
const getFromLocationList = () => { // const getFromLocationList = () => {
let list = []; // let list = [];
let location = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value); // let location = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value);
if (location != undefined) { // if (location != undefined) {
dataContent.value.subList.forEach(item => { // dataContent.value.subList.forEach(item => {
list.push(item.fromLocationCode); // list.push(item.fromLocationCode);
}); // });
fromLocationCode.value = list[0]; // fromLocationCode.value = list[0];
return list; // return list;
} else { // } else {
comMessage.value.showErrorMessages('需求库位【' + toLocationCode.value + '】不存在', res => { // comMessage.value.showErrorMessages('' + toLocationCode.value + '', res => {
toLocationCode.value = ''; // toLocationCode.value = '';
}); // });
} // }
}; // };
const fromLocationUpdate = (fromlocation) => { const fromLocationUpdate = (fromlocation) => {
let location = fromLocationList.value.find(r => r == fromlocation); let location = fromLocationList.value.find(r => r == fromlocation)
fromLocationCode.value = fromlocation; if (location == undefined) {
fromLocationCode.value = ''
showErrorMessage('发货库位【' + fromlocation + '】不存在')
}
}; };
const onScan = (result) => { const queryBalance = (result) => {
try { try {
if (fromLocationCode.value == '') { // if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', res => { // showErrorMessage('', res => {
toLocationCombox.value.onFocus(); // toLocationCombox.value.onFocus();
}); // });
return; // return;
} // }
let packageInfoValue = result.package; let packageInfoValue = result.package;
let itemCode = result.label.itemCode; let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber; let packingCode = result.label.packingNumber;
let lot = result.label.batch; let lot = result.label.batch;
let item = toLocation.value.find(r => r.itemCode == itemCode); let item = toLocation.value.Items.find(r => r.itemCode == itemCode);
if (item == undefined) { if (item == undefined) {
showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', res => { showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', res => {
getfocus(); getfocus();
}); });
return; return;
} else { } else {
const params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: jobContent.value.outInventoryStatuses.split(','),
areaType: jobContent.value.fromAreaTypes.split(','),
bussinessCode: jobContent.value.businessType
}
uni.showLoading({ uni.showLoading({
title: '加载中', title: '查询中',
mask: true mask: true
}); });
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value, getBalanceByParams(params).then(res => {
balanceRes => { if (res.data.length == 0) {
if (balanceRes.success) { const status = getInventoryStatusDesc(params.inventoryStatus)
if (balanceRes.data.list.length == 0) { const areaType = getListLocationAreaTypeDesc(params.areaType)
showErrorMessage('在来源库位[' + fromLocationCode.value + '],未查找到该包装的库存记录', res => { const hint =
packGetFocus(); "按物料号 [" + params.itemCode + "] \n" +
}); "包装号 [" + params.packingNumber + "] \n" +
} else if (balanceRes.data.list.length == 1) { "批次 [" + params.batch + "] \n" +
let balance = balanceRes.data.list[0]; "状态 [" + status + "] \n" +
afterGetBalance(result.label, balance, packageInfoValue); "库区 [" + areaType + "] \n" +
"未查找到库存余额"
showErrorMessage(hint,
res => {
getfocus();
})
} else if (res.data.length == 1) {
result.balance = res.data[0]
if (result.label.packingNumber != result.balance.packingNumber) {
result.balance.qty = Number(result.label.qty)
} else { } else {
label.value = result.label; result.balance.qty = Number(result.balance.qty)
showBalanceSelect(balanceRes.data.list, packageInfoValue);
} }
afterGetBalance(result.label, result.balance, result.package);
} else { } else {
showErrorMessage(balanceRes.message.message); //
balanceSelect.value.openPopup(res.data);
} }
uni.hideLoading(); uni.hideLoading()
}); }).catch(error => {
uni.hideLoading()
showErrorMessage(error,
res => {
getfocus();
})
})
} }
} catch (e) { } catch (e) {
showErrorMessage(e.stack); showErrorMessage(e.stack,res=>{
getfocus()
});
uni.hideLoading(); uni.hideLoading();
} }
}; };
const getBalance = (label, packageInfo, callback)=> {
let filters = []
if (packageInfo.parentNumber) {
const packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: label.packingNumber
})
}
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
if (fromInventoryStatuses.value != null && fromInventoryStatuses.value != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: fromInventoryStatuses.value
})
}
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
showErrorMessage(err.message);
})
}
const onScan = (result)=> {
if (!result.package) {
showErrorMessage('扫描数据错误[' + result.label.code + "]",
res => {
getfocus();
}
)
return;
}
if (toLocation.value) {
let item = toLocation.value.Items.find(r => r.itemCode == result.package.itemCode);
if (!item) {
showErrorMessage('扫描物料代码不属于该任务');
return
}
getToLocationBalance(result)
}
}
//
const getToLocationBalance = (result)=> {
uni.showLoading({
title: '查询中',
mask: true
})
let filters = []
if (result.package.parentNumber) {
const packingNumber = result.package.parentNumber + "," + result.package.number;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
})
}
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
})
filters.push({
column: "batch",
action: "==",
value: result.package.batch
})
filters.push({
column: "areaType",
action: "in",
value: toLocationAreaTypeList.value.join(',')
})
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
} else {
queryBalance(result);
}
// callback(res.data)
}).catch(err => {
uni.hideLoading()
showErrorMessage(err.message);
})
}
const selectBalanceItem = (balance) => { const selectBalanceItem = (balance) => {
afterGetBalance(balance, balance, packageInfo.value); afterGetBalance(balance, balance, packageInfo.value);
}; };
@ -271,55 +463,80 @@ const afterGetBalance = (labelValue, balance, packageInfoValue) => {
let itemCode = labelValue.itemCode; let itemCode = labelValue.itemCode;
let packingCode = labelValue.packingNumber; let packingCode = labelValue.packingNumber;
let lot = labelValue.batch; let lot = labelValue.batch;
let item = toLocation.value.find(r => r.itemCode == itemCode); let item = toLocation.value.Items.find(r => r.itemCode == itemCode);
let fromLocation = toLocation.value.find(l => l.fromLocationCode == fromLocationCode.value); fromLocationCode.value = balance.locationCode;
if (!fromLocation) { let fromLocation = item.Locations.find(l => l.fromLocationCode == fromLocationCode.value);
fromLocation = { if (fromLocation) {
Batchs: [{ let batch = fromLocation.Batchs.find(r => r.batch == lot);
Recommends: [],
Records: [],
batch: labelValue.batch,
detail: {
...packageInfoValue,
fromLocationCode: balance.locationCode,
toLocationCode: toLocationCode.value
},
handleQty: 0,
packingNumber: null,
qty: labelValue.qty,
uom: labelValue.uom
}],
toLocationCode: toLocationCode.value,
fromLocationCode: balance.locationCode,
handleQty: 0,
qty: labelValue.qty,
uom: labelValue.uom
};
item.Locations.push(fromLocation);
}
if (fromLocation != undefined) {
let batch = fromLocation.batch;
if(batch != undefined){ if(batch != undefined){
addRecord(item.batch, labelValue, balance, packageInfoValue); if (batch.Records == undefined) {
batch.Records = [];
}
let record = batch.Records.find(r => r.packingNumber == packingCode);
if (record == undefined) {
//
if (batch.Recommends != undefined && batch.Recommends.length > 0) {
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode);
if (recommend != undefined) {
addRecord(batch, label, balance, packageInfo)
} else {
//
if (this.jobContent.allowModifyPackingNumber == 'TRUE') {
addRecord(batch, label, balance, packageInfo);
} else {
showErrorMessage('未查找到该箱码【' + packingCode + '】的明细',
res => {
getfocus();
return;
}
)
}
}
} else {
addRecord(batch, label, balance, packageInfo)
}
} else {
addRecord(batch, label, balance, packageInfo)
}
}else { }else {
if (jobContent.value.allowModifyBatch == "TRUE") { if (jobContent.value.allowModifyBatch == "TRUE") {
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot + showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => { '】的发货明细,是否要继续发货?', res => {
if (res) { if (res) {
let batch = createBatchInfo(labelValue, balance, packageInfoValue); let batch = createBatchInfo(label, balance, packageInfo);
//details
if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
fromLocation.Batchs.unshift(batch); fromLocation.Batchs.unshift(batch);
getfocus();
emit("afterScan");
} }
}); })
} else { } else {
showErrorMessage('未查找到批次【' + lot + '】的发货明细', res => { showErrorMessage('未查找到批次【' + lot + '】的发货明细',
res => {
getfocus(); getfocus();
}); });
} }
} }
}else { }else {
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的发货明细', res => { //
if (jobContent.value.allowModifyLocation == "TRUE") {
showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value +
"】与推荐的库位不一致,是否要继续发货?", res => {
if (res) {
let locaion = createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
getfocus(); getfocus();
}); emit("afterScan");
}
})
} else {
showErrorMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value +
"】与推荐的库位不一致,不允许继续发货?")
}
} }
} catch (e) { } catch (e) {
showErrorMessage(e.stack, res => { showErrorMessage(e.stack, res => {
@ -327,28 +544,30 @@ const afterGetBalance = (labelValue, balance, packageInfoValue) => {
}); });
} }
}; };
//
const createLocationInfo = (label, balance, packageInfoValue)=> {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
isNewAdd: true,
Batchs: []
}
let batch = createBatchInfo(label, balance, packageInfoValue);
batch.detail = balance;
batch.detail.fromLocationCode = balance.locationCode;
location.Batchs.push(batch);
return location;
}
const createBatchInfo = (data, balance, packageInfoValue) => { const createBatchInfo = (data, balance, packageInfoValue) => {
let batch = { let batch = {
batch: data.lot || data.batch, isNewAdd: true,
batch: data.batch,
qty: 0, qty: 0,
uom: data.uom, uom: data.uom,
handleQty: Number(data.qty), handleQty: Number(balance.qty),
Records: [], Records: [],
detail: {
fromLocationCode: fromLocationCode.value, //balance.locationCode
toLocationCode: toLocationCode.value,
itemCode: data.itemCode,
handleQty: Number(data.qty),
packingNumber: data.packingNumber,
qty: 0,
uom: data.uom,
itemName: packageInfoValue.itemName,
itemDesc1: packageInfoValue.itemDesc1,
itemDesc2: packageInfoValue.itemDesc2,
singlePrice: balance.singlePrice,
amount: balance.amount
}
}; };
let record = creatRecord(data, balance, packageInfoValue); let record = creatRecord(data, balance, packageInfoValue);
batch.Records.push(record); batch.Records.push(record);
@ -366,7 +585,7 @@ const creatRecord = (labelValue, balance, packageInfoValue) => {
parentPackingNumber: packageInfoValue.parentNumber, parentPackingNumber: packageInfoValue.parentNumber,
batch: labelValue.batch, batch: labelValue.batch,
qty: Number(balance.qty), qty: Number(balance.qty),
handleQty: 0, handleQty: Number(balance.qty),
uom: balance.uom, uom: balance.uom,
inventoryStatus: balance.inventoryStatus, inventoryStatus: balance.inventoryStatus,
balance: balance, balance: balance,
@ -374,37 +593,69 @@ const creatRecord = (labelValue, balance, packageInfoValue) => {
supplierCode: labelValue.supplierCode, supplierCode: labelValue.supplierCode,
packUnit: packageInfoValue.packUnit, packUnit: packageInfoValue.packUnit,
packQty: packageInfoValue.packQty, packQty: packageInfoValue.packQty,
fromLocationCode: balance.locationCode
}; };
return record; return record;
}; };
const calcBatchHandleQty = (batch, labelValue, balance) => { const calcBatchHandleQty = (batch) => {
dataContent.value.subList.forEach(item => { let handleQty = 0;
if (item.itemCode == labelValue.itemCode && item.batch == labelValue.batch) { batch.Records.forEach(res => {
item.handleQty = item.handleQty || 0; handleQty = calc.add(handleQty, res.qty)
item.handleQty = calc.add(item.handleQty, labelValue.qty); })
} batch.handleQty = handleQty;
});
}; };
const addRecord = (batch, labelValue, balance, packageInfoValue) => { const addRecord = (batch, labelValue, balance, packageInfoValue) => {
let checkData = dataContent.value.subList.find(r => { if(packageInfoValue.parentNumber){
if (r.batch == balance.batch) { let checkData = batch.Records.find(r => {
if (r.packingNumber == packageInfoValue.parentNumber && r.batch == balance.batch) {
return r; return r;
} }
}); });
if (checkData) { if (checkData) {
checkData.scaned = true; showErrorMessage("箱码[" + packageInfoValue.number + "]批次[" + balance.batch +
calcBatchHandleQty(batch, labelValue, balance); "]的父包装已经扫描")
getfocus();
} else { } else {
let record = creatRecord(labelValue, balance, packageInfoValue); let record = creatRecord(labelValue, balance, packageInfoValue);
batch.Records.push(record);
issueRecord.value.unshift(record)
dataContent.value.subList.push(record); dataContent.value.subList.push(record);
calcBatchHandleQty(batch, labelValue, balance); calcBatchHandleQty(batch);
getfocus();
emit("afterScan");
}
}else {
//
let checkData = batch.Records.find(r => {
if (r.parentPackingNumber == packageInfoValue.number &&
r.batch == balance.batch) {
return r;
}
})
if (checkData) {
//
comMessage.value.showQuestionMessage("扫描箱码[" + checkData.parentPackingNumber + "]" + "批次[" +
balance
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
batch.Records = [];
let record = creatRecord(label, balance, packageInfoValue);
batch.Records.push(record);
issueRecord.value.unshift(record)
calcBatchHandleQty(batch);
getfocus();
emit("afterScan");
}
})
} else {
let record = creatRecord(label, balance, packageInfoValue);
batch.Records.push(record);
issueRecord.value.unshift(record)
calcBatchHandleQty(batch);
getfocus(); getfocus();
emit("afterScan"); emit("afterScan");
} }
}
}; };
const getfocus = () => { const getfocus = () => {
@ -454,8 +705,10 @@ const remove = (record, index) => {
if (item != undefined) { if (item != undefined) {
item.Locations.forEach(l => { item.Locations.forEach(l => {
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch); let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch);
if (batch && batch.Records && batch.Records.length > 0) {
let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch); let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch);
batch.Records.splice(rIndex, 1); batch.Records.splice(rIndex, 1);
}
}); });
} }
emit('updateData', item); emit('updateData', item);
@ -464,11 +717,15 @@ const remove = (record, index) => {
}; };
const packGetFocus = () => { const packGetFocus = () => {
if (comscan.value) {
comscan.value.getfocus(); comscan.value.getfocus();
}
}; };
const packLoseFocus = () => { const packLoseFocus = () => {
if (comscan.value) {
comscan.value.losefocus(); comscan.value.losefocus();
}
}; };
const showMessage = (message, callback) => { const showMessage = (message, callback) => {
@ -517,4 +774,7 @@ button::after {
max-height: 300rpx; max-height: 300rpx;
padding: 10rpx; padding: 10rpx;
} }
.my-combox {
font-size: 50px;
}
</style> </style>

433
src/pages/deliver/job/deliverDetailBatch.vue

@ -29,9 +29,12 @@
<view class="page-main"> <view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view> <view>
<comDeliverDetailCardBatch ref='comIssueDetailCard' :dataContent="detailSource" :settingParam="jobContent" <view v-for="(toLocation, index) in detailSource" :key="index">
@updateData='updateData'> <comDeliverDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent"
@updateData='updateData' :allowBiggerQty='allowBiggerQty'>
</comDeliverDetailCardBatch> </comDeliverDetailCardBatch>
<view class="split_line"></view>
</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -46,9 +49,11 @@
</view> </view>
</view> </view>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
<comScanDeliverPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'> <!-- <comScanDeliverPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'></comScanDeliverPackBatch>-->
</comScanDeliverPackBatch> <winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup"
@getResult='getScanResult' :noShowBalanceMessage="false" @confirm='confirmFromLocation'>
</winScanPackAndLocation>
<comMessage ref="comMessageRef"></comMessage> <comMessage ref="comMessageRef"></comMessage>
</view> </view>
</template> </template>
@ -72,12 +77,18 @@ import {
getRemoveOption, getRemoveOption,
getCurrDateTime, getCurrDateTime,
getPackingNumberAndBatch, getPackingNumberAndBatch,
deepCopyData deepCopyData,
compareAsc
} from '@/common/basic.js'; } from '@/common/basic.js';
import { import {
getDataSource getTreeDataSource,
} from '@/pages/issue/js/issue.js'; calcTreeHandleQty,
getScanCount,
getThreeDataSource,
getDataSource,
calcHandleQty,
} from '@/common/detail.js';
import { import {
getManagementPrecisions getManagementPrecisions
@ -85,13 +96,13 @@ import {
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import WinScanButton from '@/mycomponents/scan/winScanButton.vue'
import comDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue' import ComDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue'
import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue' import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue'
import jobTop from '@/mycomponents/job/jobTop.vue' import JobTop from '@/mycomponents/job/jobTop.vue'
import WinScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import {ref} from 'vue'; import {ref,nextTick} from 'vue';
import {onLoad, onNavigationBarButtonTap, onBackPress} from '@dcloudio/uni-app'; import {onLoad, onNavigationBarButtonTap, onBackPress} from '@dcloudio/uni-app';
const id = ref(''); const id = ref('');
@ -104,11 +115,17 @@ const status = ref("");
const toLocationCode = ref(""); const toLocationCode = ref("");
const jobStatus = ref(""); const jobStatus = ref("");
const dataContent = ref('') const dataContent = ref('')
const allowBiggerQty = ref('TRUE')
const managementType = ref('')
const scanCount = ref('')
const balanceinfo = ref('')
const fromLocationCode = ref('')
const managementList = ref([]); const managementList = ref([]);
const comMessageRef = ref(null); const comMessageRef = ref(null);
const scanPopup = ref(null); const scanPopup = ref(null);
const comScanIssuePack = ref(null); const comScanIssuePack = ref(null);
const comIssueDetailCardBatch = ref(null)
import {useCountStore} from '@/store' import {useCountStore} from '@/store'
const store = useCountStore(); const store = useCountStore();
@ -173,8 +190,10 @@ const getDetail = () => {
jobContent.value = res.data; jobContent.value = res.data;
jobStatus.value = res.data.status; jobStatus.value = res.data.status;
subList.value = res.data.subList; subList.value = res.data.subList;
detailSource.value = res.data; // detailSource.value = res.data;
detailSource.value = getThreeDataSource(jobContent.value)
toLocationCode.value = subList.value[0].toLocationCode; toLocationCode.value = subList.value[0].toLocationCode;
allowBiggerQty.value = res.data.allowBiggerQty;
resizeCollapse(); resizeCollapse();
} else { } else {
showMessage('未获取到详情'); showMessage('未获取到详情');
@ -190,9 +209,188 @@ const closeScan = () => {
}; };
const resizeCollapse = () => { const resizeCollapse = () => {
// nextTick(r => {
comIssueDetailCardBatch.value.forEach(r => {
r.resizeCollapse();
})
});
}; };
const getScanResult = (result, managementTypeParams)=> {
managementType.value = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
setDataBatch(result)
}else{
setData(result)
}
}
const setDataBatch = (result)=> {
try {
balanceinfo.value = result.balance
let packingNumber = result.label.packingNumber;
let batch = result.label.batch;
let qty = result.label.qty;
let itemCode = result.label.itemCode;
let locationCode = result.fromLocationCode;
if (!result.balance) {
showMessage("没有库存余额")
return;
}
// var inventoryStatus = "OK";
let detail = detailSource.value.find(r => r.itemCode == itemCode);
if (detail == undefined) {
showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
let itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail == undefined) {
let isExit;
for (let subItem of detail.subList) {
let item;
// for (let pack of subItem.packList) {
// if (pack.batch == batch) {
// item = pack;
// isExit = pack;
// break;
// }
// }
// if (item != undefined) {
// subItem.scaned = true
// subItem.handleQty = 0;
// item = undefined
// }
}
if (isExit == undefined) {
// this.showErrorMessage("" + batch + "" + result
// .fromLocationCode + "")
detail.subList.push({
scaned:true,
fromLocationCode:fromLocationCode.value,
toLocationCode:toLocationCode.value,
batch:result.label.batch,
handleQty:result.label.qty,
qty:result.balance.qty,
inventoryStatus:result.balance.inventoryStatus,
toLocation:result.balance.toLocation,
balance:result.balance,
balanceQty:result.balance.qty,
packQty:result.package.packQty,
packUnit:result.package.packUnit,
uom:result.balance.uom,
// packList:[{
// scaned : true,
// handleQty : Number(result.label.qty),
// toLocationCode : result.balance.toLocationCode,
// }]
})
detail.handleQty = 0
detail.qty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
detail.qty = calc.add(detail.qty,item.qty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
setTimeout(r => {
resizeCollapse();
}, 100)
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
// this.showMessage("" + batch + "")
} else {
isExit.scaned = true
let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else {
qty = Number(result.label.qty);
}
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = toLocationCode.value;
}
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.balance = result.balance
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
})
// calcHandleQtyAdd(this.detailSource, result.label);
}
continueScan()
} else {
let scanedLength = 0;
// itemDetail.packList.forEach(res => {
// if (res.scaned) {
// scanedLength++;
// }
// })
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (itemDetail.scaned ) {
// this.showMessage("" + packingNumber + "")
// calcHandleQtyAdd(this.detailSource, result.label);
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
})
} else {
itemDetail.scaned = true;
detailSource.value[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
itemDetail.scaned = true
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom
itemDetail.packQty=result.package.packQty
itemDetail.packUnit=result.package.packUnit
itemDetail.fromlocationCode=fromLocationCode.value
itemDetail.toLocationCode=toLocationCode.value
// itemDetail.toInventoryStatus = "OK"
// itemDetail.packList.forEach(pac => {
// pac.scaned = true
// pac.handleQty = Number(result.label.qty);
// pac.toLocationCode = result.balance.toLocationCode;
// })
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
// calcTreeHandleQty(this.detailSource);
continueScan()
}
}
}
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
detail.packingNumber = ''
})
})
} catch (e) {
showMessage(e.message)
}
}
//
const continueScan = ()=> {
scanCount.value = getScanCount(subList.value);
if (scanCount.value == subList.value.length) {
closeScanPopup();
} else {
scanPopupGetFocus();
}
}
const submit = () => { const submit = () => {
uni.showLoading({ uni.showLoading({
title: "提交中....", title: "提交中....",
@ -201,8 +399,8 @@ const submit = () => {
// //
const itemCodes = []; const itemCodes = [];
const locationCode = detailSource.value.subList[0].toLocationCode; const locationCode = detailSource.value[0].subList[0].toLocationCode;
detailSource.value.subList.forEach((item) => { detailSource.value.forEach((item) => {
itemCodes.push(item.itemCode); itemCodes.push(item.itemCode);
}); });
@ -210,68 +408,129 @@ const submit = () => {
getManagementPrecisions(itemCodes, locationCode, (res) => { getManagementPrecisions(itemCodes, locationCode, (res) => {
if (res.success) { if (res.success) {
managementList.value = res.list; managementList.value = res.list;
managementType.value = managementList.value && managementList.value[0] ? managementList.value[0].ManagementPrecision : 'BY_PACKAGING'
submitJob(); submitJob();
} else { } else {
uni.hideLoading(); uni.hideLoading();
showErrorMessage(res.message); // showErrorMessage(res.message);
} }
}); });
}; };
const checkCount = () => { const checkCount = () => {
let str = ""; let str = "";
detailSource.value.forEach((item) => {
let taskQty = 0; let taskQty = 0;
item.taskQty = calc.add(taskQty,item.qty)
let totalQty = 0; let totalQty = 0;
detailSource.value.subList.forEach((item) => { item.Locations.forEach(lco => {
taskQty = calc.add(taskQty, item.qty); lco.Batchs.forEach(batch => {
const handleQty = item.qty ? item.qty : 0; batch.Records.forEach(record => {
totalQty = calc.add(totalQty, handleQty); if(record){
const hanleQty = record.qty?record.qty:0
totalQty = calc.add(totalQty,hanleQty)
}
})
})
})
// //
item.totalQty = totalQty; item.totalQty = totalQty;
}); });
// //
detailSource.value.forEach((detail) => {
detail.Items.forEach(item=>{
if(jobContent.value.allowPartialComplete=="FALSE"){ if(jobContent.value.allowPartialComplete=="FALSE"){
detailSource.value.subList.forEach((detail) => { if(item.taskQty!=item.totalQty){
if (taskQty != totalQty) { str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n`
str += `物料号【${detail.itemCode}】任务数量【${taskQty}】与实际提交数量【${totalQty}】不一致\n`;
} }
});
} }
})
});
if (str) { if (str) {
str = '不允许提交\n' + str; str = '不允许提交\n' + str;
showErrorMessage(str); showErrorMessage(str);
} }
return str ? false : true; return str ? false : true;
}; };
const checkCountBatch = ()=> {
let str = ""
let str1 = ""
let str2 = ""
detailSource.value.forEach(detail => {
let taskQty = 0;
let totalQty = 0;
detail.subList.forEach(item => {
if (item.scaned) {
item.taskQty = 0
item.totalQty = 0
item.taskQty = calc.add(item.taskQty, item.qty)
item.totalQty = calc.add(item.totalQty, item.handleQty)
if (jobContent.value.allowPartialComplete == "FALSE") {
if (item.handleQty != item.taskQty) {
str += `批次【${item.batch}】提交数量【${item.handleQty}】与任务物料数量【${item.taskQty}】不一致\n`
}
}
if (allowBiggerQty.value == 'FALSE') {
if (item.taskQty < item.totalQty) {
str1 += '数量[' + item.totalQty + ']不允许大于任务数量[' + item.taskQty + ']'
}
}
if (item.handleQty > item.balance.qty) {
str2 += `批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}`
}
}
})
})
if (str) {
str = '不允许提交\n' + str
showErrorMessage(str)
}
if (str1) {
str1 = '不允许提交\n' + str1
showErrorMessage(str1)
}
if (str2) {
str2 = '不允许提交\n' + str2
showErrorMessage(str2)
}
return !(str || str1 || str2)
}
const submitJob = () => { const submitJob = () => {
const params = setParams(); const params = setParams()
console.log("提交参数", params); console.log("提交参数", params);
if (params.subList.length == 0) { const isTrue = params.subList.some(item=>{
uni.hideLoading(); console.log(item.recordList.some(cur=>cur.scaned))
comMessageRef.value.showConfirmMessageModal('请扫描箱码'); return item.recordList.some(cur=>cur.scaned) == true
})
if(!isTrue){
uni.hideLoading()
showErrorMessage("请扫描您需要提交的发货任务")
return
}
if(managementType.value == "BY_BATCH" || managementType.value == "BY_QUANTITY" ){
if (!checkCountBatch()) {
uni.hideLoading()
return; return;
} }
}else{
if (!checkCount()) { if (!checkCount()) {
uni.hideLoading(); uni.hideLoading()
return; return;
} }
}
deliverJobSubmit(params).then((res) => { deliverJobSubmit(params).then(res => {
uni.hideLoading(); uni.hideLoading()
if (res.data) { if (res.data) {
showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data); showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data)
} else { } else {
showErrorMessage("提交失败[" + res.msg + "]"); showErrorMessage("提交失败[" + res.msg + "]")
} }
}).catch((error) => { }).catch(error => {
uni.hideLoading(); uni.hideLoading()
showErrorMessage(error); showErrorMessage(error)
}); })
}; };
const setParams = () => { const setParams = () => {
@ -279,28 +538,33 @@ const setParams = () => {
const createTime = getCurrDateTime(); const createTime = getCurrDateTime();
const creator = store.id; const creator = store.id;
detailSource.value.subList.forEach((r) => { detailSource.value.forEach(toLocationCode => {
if (r.scaned) { let obj = {...toLocationCode}
const subItem = {...r}; delete obj.subList
subItem.recordList = []; obj.recordList = []
const record = {}; let obj1 ={}
record.handleQty = r.handleQty; let arr = toLocationCode.subList.filter(item=>item.scaned)
record.toContainerNumber = r.ContainerNumber; arr.forEach(record=>{
record.toInventoryStatus = r.inventoryStatus; obj1.scaned =record.scaned;
record.toLocationCode = subItem.toLocationCode; obj1.handleQty =record.handleQty;
record.supplierCode = r.supplierCode; obj1.fromLocationCode =record.fromLocationCode;
const info = getPackingNumberAndBatch(managementList.value, r.itemCode, r.packingNumber, r.batch); obj1.fromInventoryStatus =record.fromInventoryStatus;
record.toPackingNumber = info.packingNumber; obj1.copyContent =record.copyContent;
record.packingNumber = info.packingNumber; obj1.toContainerNumber = record.ContainerNumber;
record.fromPackingNumber = info.packingNumber; obj1.toInventoryStatus =record.inventoryStatus;
record.toBatch = info.batch; obj1.toLocationCode = record.toLocationCode;
subItem.toPackingNumber = info.packingNumber; obj1.supplierCode = record.supplierCode;
subItem.packingNumber = info.packingNumber; obj1.toPackingNumber ='';
subItem.fromPackingNumber = info.packingNumber; obj1.packingNumber = ''
subItem.recordList.push(record); obj1.fromPackingNumber = '';
subList.push(deepCopyData(subItem)); obj1.toBatch = record.batch;
} obj1.toPackingNumber = '';
}); obj1.packingNumber = '';
obj1.fromPackingNumber ='';
obj.recordList.push(obj1)
})
subList.push(obj)
})
jobContent.value.subList = subList; jobContent.value.subList = subList;
jobContent.value.createTime = createTime; jobContent.value.createTime = createTime;
@ -336,11 +600,12 @@ const clearInfo = () => {
}; };
const updateData = (record) => { const updateData = (record) => {
calcHandleQty(detailSource.value)
}; };
const scanPopupGetFocus = () => { const scanPopupGetFocus = () => {
if (scanPopup.value != undefined) { if (scanPopup.value != undefined) {
scanPopup.value.getfocus(); scanPopup.value.packGetFocus();
} }
}; };
@ -394,15 +659,39 @@ const confirmResult = (result) => {
dataContent.value = result; dataContent.value = result;
}; };
const openScanDetailPopup = () => { // const openScanDetailPopup = () => {
const datacontent = {...detailSource.value}; // // const datacontent = {...detailSource.value}; //
comScanIssuePack.value.openScanPopup(datacontent, jobContent.value); // comScanIssuePack.value.openScanPopup(datacontent, jobContent.value);
}; // };
const closeScanPopup = () => { const closeScanPopup = () => {
// updateCommitBtn(); // updateCommitBtn();
}; };
const openScanPopup = ()=> {
let fromLocationCodeMes = '';
let fromlocationList = [];
for (let i = 0; i < detailSource.value.length; i++) {
let item = detailSource.value[i];
item.subList.forEach(l => {
//
let location = fromlocationList.find(res => res == l.fromLocationCode)
if (location == undefined) {
fromlocationList.push(l.fromLocationCode);
}
//
if (fromLocationCode == '') {
if (!l.scaned) {
fromLocationCodeMes = l.fromLocationCode;
}
}
})
}
fromLocationCode.value = fromLocationCodeMes
scanPopup.value.openScanPopupForJob(fromLocationCodeMes, fromlocationList,jobContent.value);
}
const confirmFromLocation = (fromLocationCodeParams)=>{
fromLocationCode.value = fromLocationCodeParams
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

Loading…
Cancel
Save