Browse Source

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

hella_vue3
王志国 2 weeks ago
parent
commit
0ec30d4e53
  1. 3
      src/pages/deliver/job/deliverDetailBatch.vue
  2. 85
      src/pages/issue/coms/comIssueDetailCardBatch.vue
  3. 25
      src/pages/issue/coms/comScanIssuePack.vue
  4. 11
      src/pages/issue/job/issueDetail.vue
  5. 785
      src/pages/issue/job/issueDetailBatch.vue
  6. 32
      src/pages/issue/job/issueJob.vue

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

@ -220,7 +220,8 @@ const getScanResult = (result, managementTypeParams)=> {
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){ if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
setDataBatch(result) setDataBatch(result)
}else{ }else{
setData(result) //TODO
// setData(result)
} }
} }
const setDataBatch = (result)=> { const setDataBatch = (result)=> {

85
src/pages/issue/coms/comIssueDetailCardBatch.vue

@ -1,71 +1,55 @@
<template> <template>
<view>
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode"
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> -->
<view class="u-p-l-20 u-p-b-20 u-p-r-20"> <view class="u-p-l-20 u-p-b-20 u-p-r-20">
<view v-for="(item,index) in dataContent.Items">
<u-collapse ref="collapseRefs"> <u-collapse ref="collapseRefs">
<u-collapse-item :open="true"> <u-collapse-item :open="true" :class="dataContent.scaned?'scan_view':''">
<template #title> <template #title>
<view style="flex: 1;overflow: hidden"> <view style="flex: 1;overflow: hidden">
<view class="split_line"></view> <view class="split_line"></view>
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowBalanceQty='false'></item-qty>
<!-- 物品 --> <!-- 物品 -->
<u-swipe-action ref="swipeAction" :options="removeOptions"
@click="(...event)=>itemCoceClick(event,item,index)">
<item-qty :dataContent="item" :handleQty="item.handleQty"></item-qty>
</u-swipe-action>
</view> </view>
<!-- <com-issue-request-info :workShopCode="dataContent.workShopCode" :dataContent="dataContent"> <!-- <com-issue-request-info :workShopCode="dataContent.workShopCode" :dataContent="dataContent">
</com-issue-request-info> --> </com-issue-request-info> -->
</template> </template>
<view v-for="(loacation,locatonIndex) in item.Locations"> <u-swipe-action ref="swipeAction" :options="removeOptions"
<view v-if="locatonIndex ==0"> v-for="(item,index) in dataContent.subList"
<view class="uni-flex uni-row space-between"> @click="(...event)=>itemCoceClick(event,item,index)">
<!-- 推荐库位 --> <view class="" :class="item.scaned?'scan_view':''">
<location :locationCode="loacation.fromLocationCode"> <recommend :detail="item" :isShowLocation="false" :isShowFromLocation="true" :isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</location>
</view>
<view v-for="(batch,batchIndex) in loacation.Batchs">
<batch :batch="batch.detail.batch" v-if="batchIndex ==0"></batch>
</view>
</view>
</view> </view>
</u-swipe-action>
</u-collapse-item> </u-collapse-item>
</u-collapse> </u-collapse>
</view> </view>
</view> <recommend-qty-edit ref="receiptEdit" :dataContent="editItem"
</view> :settingParam="settingParam" @confirm="confirm">
<balance-qty-edit ref="receiptHint" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> </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>
<script lang="ts" setup> <script lang="ts" setup>
import {ref, onMounted, nextTick, watch} from 'vue'; import {ref, onMounted, nextTick, watch} from 'vue';
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 recommendBalance from '@/mycomponents/balance/recommendBalance.vue' import RecommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import handleBalance from '@/mycomponents/balance/handleBalance.vue' import DetailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import BalanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import location from '@/mycomponents/balance/location.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 {getDetailOption, getEditRemoveOption, getRemoveOption} from '@/common/array.js'; import {getDetailOption, getEditRemoveOption, getRemoveOption} from '@/common/array.js';
const emit = defineEmits(['updateData', "removeItemCode"]) const emit = defineEmits(['updateData', "removeItemCode"])
const props = defineProps({ const props = defineProps({
dataContent: { dataContent: {
type: Object, type: Array,
default: {} default: ()=>[]
}, },
settingParam: { settingParam: {
type: Object, type: Object,
default: {} default: {}
} },
isEdit: {
type: Boolean,
default: true
},
}) })
const option = ref([]); const option = ref([]);
@ -75,6 +59,7 @@ const batchItem = ref({});
const detailOptions = ref([]); const detailOptions = ref([]);
const scanOptions = ref([]); const scanOptions = ref([]);
const removeOptions = ref([]); const removeOptions = ref([]);
const editAndRemoveOptions = ref([])
const balanceQtyEdit = ref(null); const balanceQtyEdit = ref(null);
const receiptHint = ref(null); const receiptHint = ref(null);
@ -94,6 +79,7 @@ onMounted(() => {
detailOptions.value = getDetailOption(); detailOptions.value = getDetailOption();
scanOptions.value = getEditRemoveOption(); scanOptions.value = getEditRemoveOption();
removeOptions.value = getRemoveOption(); removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption()
}); });
// watch( // watch(
@ -111,10 +97,8 @@ onMounted(() => {
// ) // )
const resizeCollapse = ()=> { const resizeCollapse = ()=> {
nextTick(r => { nextTick(r => {
collapseRefs.value && collapseRefs.value.forEach(r => { collapseRefs.value.init();
r.childrens.forEach(i => { collapseRefs.value.childrens && collapseRefs.value.childrens.forEach(r => {
i.init();
})
r.init(); r.init();
}) })
}); });
@ -129,17 +113,18 @@ const swipeClick = (e, batch, record, recordIndex, batchIndex, Batchs, locatonIn
const itemCoceClick = (params, item) => { const itemCoceClick = (params, item) => {
const { text } = removeOptions.value[params[1]] const { text } = removeOptions.value[params[1]]
if (text == '移除') { if (text == "编辑") {
dataContent.value.Items.splice(params[0], 1) edit(item)
emit('removeItemCode') }else if (text == '移除') {
item.scaned = false
item.handleQty = 0
emit('updateData')
} }
} }
const edit = (batch, item) => { const edit = (item) => {
editItem.value = item; editItem.value = item;
batchItem.value = batch; balanceQtyEdit.value.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
item.balance.balanceQty = item.balance.qty;
balanceQtyEdit.value.openEditPopup(item.balance, item.qty);
}; };
const detail = (item) => { const detail = (item) => {
@ -163,7 +148,7 @@ const remove = (batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Lo
}; };
const confirm = (val) => { const confirm = (val) => {
editItem.value.qty = val; editItem.value.handleQty = Number(val);
emit('updateData', editItem.value); emit('updateData', editItem.value);
}; };
defineExpose({ defineExpose({

25
src/pages/issue/coms/comScanIssuePack.vue

@ -19,7 +19,9 @@
<view class=""> <view class="">
<view class=""> <view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" headerType="HPQ,HMQ" :isShowHistory="false"> </win-com-scan> <win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan"
:clearResult="true" headerType="HPQ,HMQ"
:isShowHistory="false" :locationCode='locationCode'> </win-com-scan>
<view style="width: 100%"> <view style="width: 100%">
<view style="width: 100%" v-if="issueRecord.length > 0"> <view style="width: 100%" v-if="issueRecord.length > 0">
@ -74,6 +76,10 @@ const props = defineProps({
title: { title: {
type: String, type: String,
default: '' default: ''
},
locationCode:{
type: String,
default: ''
} }
}) })
const dataContent = ref({}) const dataContent = ref({})
@ -187,7 +193,7 @@ const fromLocationUpdate = (fromlocation) => {
showErrorMessage(`发料库位【${fromlocation}】不存在`) showErrorMessage(`发料库位【${fromlocation}】不存在`)
} }
} }
const queryBalance = (result) => { const queryBalance = (result,managementType) => {
try { try {
// if (fromLocationCode.value == '') { // if (fromLocationCode.value == '') {
// showErrorMessage('', (res) => { // showErrorMessage('', (res) => {
@ -197,7 +203,12 @@ const queryBalance = (result) => {
// } // }
const packageInfoParams = result.package const packageInfoParams = result.package
const { itemCode } = result.label const { itemCode } = result.label
const packingCode = result.label.packingNumber let packingCode
if(managementType == 'BY_BATCH' || managementType == 'BY_QUANTITY'){
packingCode = ''
} else{
packingCode = result.label.packingNumber;
}
const lot = result.label.batch const lot = result.label.batch
const item = toLocation.value.Items.find((r) => r.itemCode == itemCode) const item = toLocation.value.Items.find((r) => r.itemCode == itemCode)
if (item == undefined) { if (item == undefined) {
@ -313,7 +324,7 @@ const getBalance = (label, packageInfoParams, callback) => {
showErrorMessage(err.message) showErrorMessage(err.message)
}) })
} }
const onScan = (result) => { const onScan = (result,managementType) => {
if (!result.package) { if (!result.package) {
showErrorMessage(`扫描数据错误[${result.label.code}]`, (res) => { showErrorMessage(`扫描数据错误[${result.label.code}]`, (res) => {
getfocus() getfocus()
@ -336,16 +347,16 @@ const onScan = (result) => {
getToLocationBalance(result) getToLocationBalance(result)
} }
}else{ }else{
queryBalance(result) queryBalance(result,managementType)
} }
} }
// //
const getToLocationBalance = (result)=> { const getToLocationBalance = (result,managementType)=> {
uni.showLoading({ uni.showLoading({
title: '查询中', title: '查询中',
mask: true mask: true
}) })
queryBalance(result) queryBalance(result,managementType)
// let filters = [] // let filters = []
// if (result.package.parentNumber) { // if (result.package.parentNumber) {
// let packingNumber = result.package.parentNumber + "," + result.package.number; // let packingNumber = result.package.parentNumber + "," + result.package.number;

11
src/pages/issue/job/issueDetail.vue

@ -20,20 +20,11 @@
<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 v-for="(toLocation, index) in detailSource"> <view v-for="(toLocation, index) in detailSource">
<!-- <view class="u-p-20">
<work-station :workshopCode="jobContent.workShopCode" :productionLineCode="toLocation.productionLineCode" :workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode"> </work-station>
</view> -->
<comIssueDetailCardBatch :dataContent="toLocation"
ref="comIssueDetailCard"
:settingParam="jobContent"
@updateData='updateData'
v-if="managementType == 'BY_BATCH'">
</comIssueDetailCardBatch>
<com-issue-detail-card <com-issue-detail-card
ref="comIssueDetailCard" ref="comIssueDetailCard"
:dataContent="toLocation" :dataContent="toLocation"
:settingParam="jobContent" :settingParam="jobContent"
@updateData='updateData' v-else> @updateData='updateData'>
</com-issue-detail-card> </com-issue-detail-card>
<view class="split_line"></view> <view class="split_line"></view>
</view> </view>

785
src/pages/issue/job/issueDetailBatch.vue

@ -0,0 +1,785 @@
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header-view">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
</view>
<work-station :workshopCode="jobContent.workShopCode"
:productionLineCode="jobContent.detailProductionLineCode"
:workStationCode="jobContent.detailWorkStationCode"
:rawLocationCode="jobContent.detailToLocationCode">
</work-station>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource">
<comIssueDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent"
@updateData='updateData'>
</comIssueDetailCardBatch>
<view class="split_line"></view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="autoCommit()">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
<!-- <com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'
@afterScan='afterScan' :locationCode='fromLocationCode'>
</com-scan-issue-pack> -->
<winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup"
@getResult='getScanResult' :noShowBalanceMessage="false" @confirm='confirmFromLocation'>
</winScanPackAndLocation>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script setup>
import {
takeIssueJob,
cancleTakeIssueJob,
getIssueJobDetail,
issueJobSubmit
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
goHome,
navigateBack,
getCurrDateTime,
compareAsc
} from '@/common/basic.js';
import {
getTreeDataSource,
calcTreeHandleQty,
getScanCount,
getThreeDataSource,
getDataSource,
calcHandleQty,
} from '@/common/detail.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import WinScanButton from '@/mycomponents/scan/winScanButton.vue'
import JobTop from '@/mycomponents/job/jobTop.vue'
import WinScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import {ref, nextTick, getCurrentInstance} from 'vue';
import {onLoad, onNavigationBarButtonTap, onBackPress} from '@dcloudio/uni-app';
const { proxy } = getCurrentInstance()
const id = ref('');
const jobContent = ref({});
const subList = ref([]);
const detailSource = ref([]);
const detailOptions = ref([]);
const scanOptions = ref([]);
const status = ref("");
const toLocationCode = ref("");
const jobStatus = ref("");
const dataContent = ref({})
const allowBiggerQty = ref('TRUE')
const managementType = ref('')
const scanCount = ref('')
const balanceinfo = ref('')
const fromLocationCode = ref('')
const scanMessage = ref('')
const managementList = ref([]);
const comMessageRef = ref(null);
const scanPopup = ref(null);
const comScanIssuePack = ref(null);
const comIssueDetailCardBatch = ref(null)
import {useCountStore} from '@/store'
const store = useCountStore();
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title + '详情'
});
id.value = option.id;
scanMessage.value = option.scanMessage || '';
if (id.value != undefined) {
//
if (option.status == "1") {
receive(() => {
getDetail();
});
} else {
getDetail();
}
}
});
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
}
});
onBackPress((e) => {
//
if (e.from == 'backbutton') {
if (jobStatus.value == "2") {
//
cancleTakeIssueJob(id.value).then(() => {
uni.navigateBack();
}).catch(() => {
uni.navigateBack();
});
} else {
uni.navigateBack();
}
return true;
}
});
const receive = (callback) => {
if (id.value != null) {
takeIssueJob(id.value).then(() => {
callback();
}).catch((error) => {
showErrorMessage(error);
});
}
};
const getDetail = () => {
uni.showLoading({
title: "加载中....",
mask: true
});
getIssueJobDetail(id.value).then((res) => {
uni.hideLoading();
if (res.data && res.data.subList.length > 0) {
jobContent.value = res.data;
jobStatus.value = res.data.status;
subList.value = res.data.subList;
// detailSource.value = res.data;
detailSource.value = getThreeDataSource(jobContent.value)
jobContent.value.detailToLocationCode = res.data.subList[0].toLocationCode
toLocationCode.value = subList.value[0].toLocationCode;
fromLocationCode.value = subList[0].value.fromLocationCode
//
if (scanMessage.value) {
openScanPopupSimulate(this.scanMessage);
}
setTimeout(()=>{
resizeCollapse();
},200)
} else {
showMessage('列表数据为0');
}
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const closeScan = () => {
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)
}
}
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 = () => {
uni.showLoading({
title: "提交中....",
mask: true
});
//
const itemCodes = [];
const locationCode = detailSource.value[0].subList[0].toLocationCode;
detailSource.value.forEach((item) => {
itemCodes.push(item.itemCode);
});
//
getManagementPrecisions(itemCodes, locationCode, (res) => {
if (res.success) {
managementList.value = res.list;
// managementType.value = managementList.value && managementList.value[0] ? managementList.value[0].ManagementPrecision : 'BY_PACKAGING'
submitJob();
} else {
uni.hideLoading();
showErrorMessage(res.message);
}
});
};
const checkCount = () => {
let str = "";
detailSource.value.forEach((item) => {
let taskQty = 0;
item.taskQty = calc.add(taskQty,item.qty)
let totalQty = 0;
item.Locations.forEach(lco => {
lco.Batchs.forEach(batch => {
batch.Records.forEach(record => {
if(record){
const hanleQty = record.qty?record.qty:0
totalQty = calc.add(totalQty,hanleQty)
}
})
})
})
//
item.totalQty = totalQty;
});
//
detailSource.value.forEach((detail) => {
detail.Items.forEach(item=>{
if(jobContent.value.allowPartialComplete=="FALSE"){
if(item.taskQty!=item.totalQty){
str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n`
}
}
})
});
if (str) {
str = '不允许提交\n' + str;
showErrorMessage(str);
}
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 params = setParams()
console.log("提交参数", params);
const isTrue = params.subList.some(item=>{
console.log(item.recordList.some(cur=>cur.scaned))
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;
// }
// }else{
// if (!checkCount()) {
// uni.hideLoading()
// return;
// }
// }
issueJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data)
} else {
showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
showErrorMessage(error)
})
};
const setParams = () => {
const subList = [];
const createTime = getCurrDateTime();
const creator = store.id;
detailSource.value.forEach(toLocationCode => {
let obj = {...toLocationCode}
delete obj.subList
obj.recordList = []
let obj1 ={}
let arr = toLocationCode.subList.filter(item=>item.scaned)
arr.forEach(record=>{
obj1.supplierCode = record.supplierCode;
obj1.batch = record.batch;
obj1.copyContent = record.copyContent;
obj1.fromInventoryStatus = record.fromInventoryStatus;
obj1.fromLocationCode = record.fromLocationCode;
obj1.handleQty = record.handleQty;
obj1.inventoryStatus = record.fromInventoryStatus;
obj1.packQty = record.packQty;
obj1.packUnit = record.packUnit;
obj1.packingNumber = record.packingNumber;
obj1.qty = record.qty;
obj1.scaned = record.scaned;
obj1.toLocationCode = record.toLocationCode;
obj1.fromPackingNumber = '';
obj1.fromBatch = record.batch;
obj1.toBatch = record.batch;
obj1.toInventoryStatus = record.inventoryStatus;
obj1.toPackingNumber = "";
obj1.packingNumber = "";
let single_price = record.balance.singlePrice == null ? 0 : record.balance.singlePrice;
obj1.singlePrice = single_price;
obj1.amount = single_price * record.qty;
obj.recordList.push(obj1)
})
subList.push(obj)
})
jobContent.value.subList = subList;
jobContent.value.createTime = createTime;
jobContent.value.creator = creator;
return jobContent.value;
};
const cancel = () => {
comMessageRef.value.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', (res) => {
if (res) {
clearInfo();
}
});
};
const clearInfo = () => {
dataContent.value.itemCodeList.forEach((res) => {
if (res.recommendList != null) {
res.recommendList.forEach((res1) => {
if (res1.locationCodeList != null) {
res1.locationCodeList.forEach((res2) => {
if (res2.packingCodeList != null) {
res2.packingCodeList.forEach((res3) => {
res3.itemCode = "";
res3.qty = 0;
});
}
});
}
});
}
});
};
const updateData = (record) => {
detailSource.value.forEach(item=>{
item.handleQty = 0
item.subList.forEach(cur=>{
item.handleQty = calc.add(cur.handleQty,item.handleQty)
})
})
};
const autoCommit = ()=> {
// this.$throttle(this.submit, 2000, this)()
let str = ""
let str1 = ""
let totalQty = 0;
let taskQty = 0;
detailSource.value.forEach(detail => {
detail.subList.forEach(item => {
if (item.scaned) {
taskQty = calc.add(taskQty, item.qty)
totalQty = calc.add(totalQty, item.handleQty)
if (item.handleQty < item.qty) {
str += `批次【${item.batch}】提交数量【${item.handleQty}】与任务物料数量【${item.qty}】不一致\n`
}
if (item.handleQty > item.balance.qty) {
str1 += `批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}`
}
}
})
})
if(str1){
comMessageRef.value.showMessage(str1, res => {
if (res) {
afterCloseMessage()
}
});
return
}
if(str){
str = '任务明细未全部完成,是否提交?\n' + str
}
if(totalQty!=taskQty){
str ="扫描数量["+totalQty+"]与任务数量不一致["+taskQty+"],是否提交"
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
//
proxy.$throttle(submit, 2000, proxy)()
} else {
// this.detailSource.forEach(detail => {
// detail.Items.forEach(item => {
// taskQty =calc.add(taskQty,item.qty)
// item.Locations.forEach(lco => {
// lco.Batchs.forEach(batch => {
// batch.Records = []
// })
// })
// })
// })
// this.$refs.comScanIssuePack.clearList()
scanPopupGetFocus()
}
});
}else {
//
proxy.$throttle(submit, 2000, proxy)()
}
}
const scanPopupGetFocus = () => {
if (scanPopup.value != undefined) {
scanPopup.value.packGetFocus();
}
};
const showMessage = (message) => {
comMessageRef.value.showMessage(message, (res) => {
if (res) {
afterCloseMessage();
}
});
};
const showErrorMessage = (message) => {
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
afterCloseMessage();
}
});
};
const showScanMessage = (message) => {
comMessageRef.value.showScanMessage(message);
};
const showCommitSuccess = () => {
comMessageRef.value.showCommitSuccess();
};
const showCommitSuccessMessage = (hint) => {
comMessageRef.value.showSuccessMessage(hint, (res) => {
navigateBack(1);
});
};
const showRescanMessage = (message) => {
comMessageRef.value.showRescanMessage(message);
};
const afterCloseMessage = () => {
scanPopupGetFocus();
};
const closeScanMessage = () => {
scanPopupGetFocus();
};
const confirm = (data) => {
dataContent.value = data;
};
const confirmResult = (result) => {
dataContent.value = result;
};
// const openScanDetailPopup = () => {
// const datacontent = {...detailSource.value}; //
// comScanIssuePack.value.openScanPopup(datacontent, jobContent.value);
// };
const closeScanPopup = () => {
// 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 openScanPopupSimulate = (scanMessage)=> {
comScanIssuePack.value.openScanPopupForJobSimulate(detailSource.value, jobContent.value, scanMessage);
}
const confirmFromLocation = (fromLocationCodeParams)=>{
fromLocationCode.value = fromLocationCodeParams
}
</script>
<style scoped lang="scss">
.uni-numbox__value {
width: 40px;
}
button[disabled] {
background-color: #3C9CFF;
color: #fff;
opacity: 0.7;
}
// /deep/ .input-value {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item__title-text {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 0px;
// border-bottom-color: #ebeef5;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 1px;
// border-bottom-color: #ebeef5;
// }
</style>

32
src/pages/issue/job/issueJob.vue

@ -17,7 +17,7 @@
<u-loadmore :status="loadingType" v-if="jobList.length > 0" /> <u-loadmore :status="loadingType" v-if="jobList.length > 0" />
</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>
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode"> <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance> </winComScanBalance>
<jobListView ref="jobListRef" @selectItem="selectItem"></jobListView> <jobListView ref="jobListRef" @selectItem="selectItem"></jobListView>
@ -30,7 +30,9 @@ import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { cancleTakeIssueJob, getIssueJobList, getIssueJobByProductionline, closeTakeIssueJob } from '@/api/request2.js' import { cancleTakeIssueJob, getIssueJobList, getIssueJobByProductionline, closeTakeIssueJob } from '@/api/request2.js'
import { goHome, updateTitle } from '@/common/basic.js' import { goHome, updateTitle } from '@/common/basic.js'
import {
getManagementPrecisions
} from '@/common/balance.js';
import { getDetailOption, getDetailGiveupOption, getDetailCloseOption } from '@/common/array.js' import { getDetailOption, getDetailGiveupOption, getDetailCloseOption } from '@/common/array.js'
import { import {
getBusinessType getBusinessType
@ -83,6 +85,9 @@ const fromAreaCode = ref('')
const toAreaCode = ref('') const toAreaCode = ref('')
const timer = ref(null) const timer = ref(null)
const productionLineCode = ref('') const productionLineCode = ref('')
const manageModel = import.meta.env.VITE_MANAGE_MODEL
const managementList = ref([])
const managementType = ref('')
onShow(() => { onShow(() => {
setTimeout(()=>{ setTimeout(()=>{
getList('refresh') getList('refresh')
@ -187,6 +192,9 @@ const getList = (type) => {
uni.hideLoading() uni.hideLoading()
if (type === 'refresh') { if (type === 'refresh') {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
if(manageModel!='BY_BATCH'){
openScanPopup()
}
} }
const { list } = res.data const { list } = res.data
@ -293,7 +301,7 @@ const setQueryParam = ()=>{
return filterParams; return filterParams;
} }
const openJobDetail = (item, scanMessage = '') => { const openJobDetail = (item, scanMessage = '') => {
getJobInfoByNumber(item.number, scanMessage) getJobInfoByNumber(item, scanMessage)
} }
const showItemList = (itemList)=> { const showItemList = (itemList)=> {
jobListPopupRef.value.openPopup(itemList); jobListPopupRef.value.openPopup(itemList);
@ -382,7 +390,7 @@ const closeJob = (id) => {
showMessage(error) showMessage(error)
}) })
} }
const getJobInfoByNumber = (number, scanMessageMes)=>{ const getJobInfoByNumber = (item, scanMessageMes)=>{
uni.showLoading({ uni.showLoading({
title: "加载中....", title: "加载中....",
mask: true mask: true
@ -396,7 +404,7 @@ const getJobInfoByNumber = (number, scanMessageMes)=>{
filters.push({ filters.push({
column: "number", column: "number",
action: "==", action: "==",
value: number value: item.number
}) })
var params = { var params = {
@ -422,11 +430,25 @@ const getJobInfoByNumber = (number, scanMessageMes)=>{
}); });
return; return;
} }
getManagementPrecisions([item.itemCode], item.fromLocationCode, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value && managementList.value[0] && managementList.value[0].ManagementPrecision
if (managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY') {
uni.navigateTo({
url: './issueDetailBatch?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' +
scanMessageMes + '&title=' + title.value
});
} else {
uni.navigateTo({ uni.navigateTo({
url: './issueDetail?id=' + result.masterId + '&status=' + result.status + url: './issueDetail?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' + '&scanMessage=' +
scanMessageMes + '&title=' + title.value scanMessageMes + '&title=' + title.value
}); });
}
}
})
scanMessage.value = "" scanMessage.value = ""
} }
}).catch(error => { }).catch(error => {

Loading…
Cancel
Save