Browse Source

page/productReceipt/job 文件迁移 8/8-10/25

hella_vue3
王志国 4 weeks ago
parent
commit
04890c1922
  1. 63
      src/pages/productReceipt/job/ccProductReceiptDetail.vue
  2. 14
      src/pages/productReceipt/job/ccProductReceiptJob.vue
  3. 439
      src/pages/productReceipt/job/completeReceiveJobDetail.vue
  4. 28
      src/pages/productReceipt/job/fgProductReceiptDetail.vue
  5. 27
      src/pages/productReceipt/job/fgProductReceiptJob.vue
  6. 54
      src/pages/productReceipt/job/productReceiptDetail.vue
  7. 113
      src/pages/productReceipt/job/productReceiptJob.vue
  8. 72
      src/pages/productReceipt/job/scrapReceiptDetail.vue
  9. 27
      src/pages/productReceipt/job/scrapReceiptJob.vue
  10. 437
      src/pages/productReceipt/job/semiProductReceiptDetail.vue
  11. 27
      src/pages/productReceipt/job/semiProductReceiptJob.vue

63
src/pages/productReceipt/job/ccProductReceiptDetail.vue

@ -35,8 +35,12 @@
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<comProductDetailCardBatch :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData"
:locationAreaTypeList='toLocationAreaTypeList' v-if="managementType=='BY_BATCH'">
</comProductDetailCardBatch>
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" :locationAreaTypeList="toLocationAreaTypeList">
@remove="updateData" @updateData="updateData" :locationAreaTypeList="toLocationAreaTypeList" v-else>
</comProductDetailCard>
</view>
</view>
@ -46,7 +50,7 @@
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%">
<view class="">
<<locationCompare ref="comScanLocation" title="收货库位" :isShowEdit="jobContent.allowModifyLocation=='TRUE'"
<locationCompare ref="comScanLocation" title="收货库位"
:recommendLocationCode="jobToLocationCode" :locationCode="toLocationCode" @getLocation='scanLocationCode'
:locationAreaTypeList="toLocationAreaTypeList">
</locationCompare>
@ -80,10 +84,9 @@
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comDetailCard from '@/mycomponents/detail/comDetailCard.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import comProductDetailCard from '@/pages/productReceipt/coms/comProductDetailCard.vue'
import comProductDetailCardBatch from "@/pages/productReceipt/coms/comProductDetailCardBatch.vue"
import { useCountStore } from '@/store'
// store
const store = useCountStore()
@ -97,6 +100,7 @@
const detailSource = ref([])//
const toLocationAreaTypeList = ref([])
const managementList = ref([])
const managementType = ref('')
const jobStatus = ref('')
const jobToLocationCode = ref('')
const scanedPackingNumber = ref('')
@ -189,14 +193,24 @@
subList.value = res.data.subList
jobStatus.value = res.data.status
jobToLocationCode.value = subList.value[0].toLocationCode
if (jobContent.value.allowModifyLocation == 'FALSE') {
toLocationCode.value = subList.value[0].toLocationCode
}
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes)
detailSource.value = getDataSource(subList.value)
if (scanMessage.value) {
scanPopup.value.simulateScan(scanMessage.value);
}
//
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
getManagementPrecisions(itemCodes, jobToLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
}
})
} else {
showMessage('列表数据为0')
}
@ -218,6 +232,7 @@
if (detail == undefined) {
showErrorMessage(`物料号【${itemCode}】不在列表中`)
} else {
detail.scaned = true
const itemDetail = detail.subList.find((r) => r.packingNumber == packingNumber && r.batch == batch)
if (itemDetail == undefined) {
showErrorMessage(`箱码[${packingNumber}]` + `批次[${batch}]不在任务列表中`)
@ -226,11 +241,10 @@
} else {
itemDetail.scaned = true
itemDetail.handleQty = Number(result.label.qty)
itemDetail.toLocationCode = toLocationCode.value
itemDetail.toLocationCode = toLocationCode.value?toLocationCode.value:jobToLocationCode.value
itemDetail.labelQty = Number(result.label.qty)
calcHandleQty(detailSource.value)
continueScan()
$forceUpdate()
}
}
}
@ -246,7 +260,7 @@
}
const updateData = () => {
calcHandleQty(detailSource.value)
// calcHandleQty(detailSource.value)
}
const openScanPopup = () => {
@ -258,12 +272,27 @@
}
const scanLocationCode = (location, code) => {
if(jobContent.value.allowModifyLocation=="TRUE"){
toLocationCode.value = code
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
detail.toLocationCode = code
})
})
}else {
//
if(code!=jobToLocationCode.value){
showMessageHint("任务中不允许修改库位\n扫描库位["+code+"]推荐库位是["+jobToLocationCode.value+"]",callBack=>{
})
}else {
toLocationCode.value = code
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
detail.toLocationCode = code
})
})
}
}
}
const checkLocation = () => {
@ -278,7 +307,7 @@
return isPass
}
const showMessageHint(hint, callback) {
const showMessageHint = (hint, callback)=> {
comMessageRef.value.showErrorMessage(hint, (res) => {
if (res) {
callback()
@ -298,9 +327,11 @@
return
}
}else{
this.toLocationCode = this.jobToLocationCode
this.toLocationCode = toLocationCode.value?toLocationCode.value:jobToLocationCode.value
}
if(!toLocationCode.value){
return;
}
//
if (scanCount.value == subList.value.length) {
if (checkCount()) {
@ -315,7 +346,7 @@
}
} else {
//
showMessage('请完成扫描后,再进行提交<br>' + `已经扫描[${scanCount.value}]总共[${subList.value.length}]`)
showMessage('请完成扫描后,再进行提交\n' + `已经扫描[${scanCount.value}]总共[${subList.value.length}]`)
}
}
}
@ -362,7 +393,7 @@
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + res.data)
showCommitSuccessMessage("提交成功\n生成装配收货记录<br>" + res.data)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -387,6 +418,8 @@
if (detail.scaned) {
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch)
detail.toPackingNumber = info.packingNumber
detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = info.packingNumber;
detail.toBatch = info.batch
detail.toContainerNumber = ''
detail.toInventoryStatus = detail.inventoryStatus

14
src/pages/productReceipt/job/ccProductReceiptJob.vue

@ -96,13 +96,13 @@
}
})
//
onNavigationBarButtonTap(e) {
onNavigationBarButtonTap((e) =>{
if (e.index === 0) {
goHome()
} else if (e.index == 1) {
filter.value.openFilter()
}
}
})
onReachBottom(() => {
//
@ -283,8 +283,14 @@
}
const showMessage = (message) => {
if(scanPopup.value){
scanPopup.value.packLoseFocus()
}
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
if(scanPopup.value){
scanPopup.value.packGetFocus()
}
}
})
}
@ -382,11 +388,11 @@
selectItem(list[0])
}
} else {
showMessage('未查找到任务<br>' + `扫描[${result.scanMessage}]`)
showMessage('未查找到任务\n' + `扫描[${result.scanMessage}]`)
}
})
.catch((error) => {
showMessage(`${error}<br>扫描[${result.scanMessage}]`)
showMessage(`${error}\n扫描[${result.scanMessage}]`)
})
} catch (e) {
showMessage(e.message)

439
src/pages/productReceipt/job/completeReceiveJobDetail.vue

@ -43,7 +43,7 @@
</view>
</template>
<script>
<script setup lang="ts">
import {
getManagementPrecisions
} from '@/common/balance.js';
@ -81,335 +81,308 @@
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue"
export default {
name: 'receipt_detail',
components: {
winScanButton,
comDetailCard,
locationCompare,
winScanPack,
jobTop,
comProductDetailCard
},
data() {
return {
id: '',
receiptJob: {},
toLocationCode: '',
isShowPackingCode: true,
scanCount: 0,
jobContent: {}, //
subList: [], //subList
detailSource: [], //
toLocationAreaTypeList: [],
managementList: [],
jobStatus:"",
jobToLocationCode:""
};
},
onLoad(option) {
this.id = option.id;
if (this.id != undefined) {
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { onLoad, onPullDownRefresh, onBackPress, onNavigationBarButtonTap } from '@dcloudio/uni-app';
//
const id = ref('');
const receiptJob = ref({});
const toLocationCode = ref('');
const isShowPackingCode = ref(true);
const scanCount = ref(0);
const jobContent = ref({}); //
const subList = ref([]); // subList
const detailSource = ref([]); //
const toLocationAreaTypeList = ref([]);
const managementList = ref([]);
const jobStatus = ref("");
const jobToLocationCode = ref("");
//
const scanPopupRef = ref(null);
const comMessageRef = ref(null);
const comScanLocationRef = ref(null);
//
onLoad((option) => {
id.value = option.id;
if (id.value !== undefined) {
//
if (option.status == "1") {
this.receive((callback => {
this.getDetail();
}));
if (option.status === "1") {
receive(() => {
getDetail();
});
} else {
this.getDetail();
getDetail();
}
}
},
//
onNavigationBarButtonTap(e) {
});
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {
});
onBackPress((e) => {
//
if (e.from == 'backbutton') {
if (this.jobStatus=="2") {
if (e.from === 'backbutton') {
if (jobStatus.value === "2") {
//
cancleTakeProductReceiptJob(this.id).then(res => {
cancleTakeProductReceiptJob(id.value).then(() => {
uni.navigateBack();
}).catch(error => {
}).catch(() => {
uni.navigateBack();
})
});
} else {
uni.navigateBack();
}
return true;
}
});
},
onPullDownRefresh() {
this.getDetail();
onPullDownRefresh(() => {
getDetail();
uni.stopPullDownRefresh();
},
mounted() {
});
},
methods: {
//
receive(callback) {
if (this.id != null) {
takeProductReceiptJob(this.id).then(res => {
//
const receive = (callback) => {
if (id.value !== null) {
takeProductReceiptJob(id.value).then(() => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}).catch((error) => {
showErrorMessage(error);
});
}
},
};
getDetail() {
var that = this;
const getDetail = () => {
uni.showLoading({
title: "加载中....",
mask: true
});
getProductReceiptJobDetail(that.id).then(res => {
getProductReceiptJobDetail(id.value).then((res) => {
uni.hideLoading();
if (res.data == null) {
that.showMessage('未获取到详情');
if (res.data === null) {
showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
that.jobContent = res.data;
that.subList = res.data.subList;
that.jobStatus = res.data.status
that.jobToLocationCode = that.subList[0].toLocationCode
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes)
that.detailSource = getDataSource(that.subList)
jobContent.value = res.data;
subList.value = res.data.subList;
jobStatus.value = res.data.status;
jobToLocationCode.value = subList.value[0].toLocationCode;
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes);
detailSource.value = getDataSource(subList.value);
} else {
that.showMessage('列表数据为0');
showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
getScanResult(result) {
let label = result.label;
var packingNumber = label.packingNumber;
var batch = label.batch;
var qty = label.qty;
var itemCode = label.itemCode;
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const getScanResult = (result) => {
const label = result.label;
const packingNumber = label.packingNumber;
const batch = label.batch;
const qty = label.qty;
const itemCode = label.itemCode;
const detail = detailSource.value.find((r) => r.itemCode === itemCode);
if (detail === undefined) {
showErrorMessage(`物料号【${itemCode}】不在列表中`);
} else {
var itemDetail = detail.subList.find(r =>
r.packingNumber == packingNumber &&
r.batch == batch);
if (itemDetail == undefined) {
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中")
const itemDetail = detail.subList.find((r) =>
r.packingNumber === packingNumber && r.batch === batch
);
if (itemDetail === undefined) {
showErrorMessage(`箱码[${packingNumber}]批次[${batch}]不在任务列表中`);
} else {
if (itemDetail.scaned) {
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描")
showErrorMessage(`箱码[${packingNumber}]批次[${batch}]已经扫描`);
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty);
itemDetail.toLocationCode = this.toLocationCode;
itemDetail.toLocationCode = toLocationCode.value;
itemDetail.labelQty = Number(result.label.qty);
calcHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
calcHandleQty(detailSource.value);
continueScan();
}
}
}
},
};
//
continueScan() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
const continueScan = () => {
scanCount.value = getScanCount(subList.value);
if (scanCount.value === subList.value.length) {
closeScanPopup();
} else {
this.scanPopupGetFocus();
scanPopupGetFocus();
}
},
updateData() {
calcHandleQty(this.detailSource);
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
};
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
const updateData = () => {
calcHandleQty(detailSource.value);
};
const openScanPopup = () => {
scanPopupRef.value.openScanPopup();
};
scanLocationCode(location, code) {
this.toLocationCode = code
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code
})
})
},
const closeScanPopup = () => {
scanPopupRef.value.closeScanPopup();
};
checkLocation() {
var isPass = true;
if (this.toLocationCode == "" || this.toLocationCode == null) {
this.showMessageHint('请扫描收货库位', callback => {
this.$refs.comScanLocation.showLocation();
})
const scanLocationCode = (location, code) => {
toLocationCode.value = code;
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
detail.toLocationCode = code;
});
});
};
return isPass = false;
const checkLocation = () => {
let isPass = true;
if (toLocationCode.value === "" || toLocationCode.value === null) {
showMessageHint('请扫描收货库位', () => {
comScanLocationRef.value.showLocation();
});
isPass = false;
}
return isPass;
},
};
showMessageHint(hint, callback) {
this.$refs.comMessage.showErrorMessage(hint, res => {
const showMessageHint = (hint, callback) => {
comMessageRef.value.showErrorMessage(hint, (res) => {
if (res) {
callback()
callback();
}
});
},
};
commit() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
const commit = () => {
scanCount.value = getScanCount(subList.value);
if (scanCount.value === 0) {
showErrorMessage("扫描数为0,请先扫描");
return;
}
//
if (!this.checkLocation()) {
return
if (!checkLocation()) {
return;
}
//
if (this.scanCount == this.subList.length) {
this.submitJob();
} else if (this.scanCount < this.subList.length) {
//
if (this.jobContent.allowPartialComplete == "TRUE") {
//
this.submitJob();
if (scanCount.value === subList.value.length) {
submitJob();
} else if (scanCount.value < subList.value.length) {
if (jobContent.value.allowPartialComplete === "TRUE") {
comMessageRef.value.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', (res) => {
if (res) {
submitJob();
}
});
} else {
//
this.showMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + "]总共[" + this.subList
.length +
"]");
showMessage("任务明细未全部完成,不允许部分提交!");
}
}
};
},
submitJob() {
const submitJob = () => {
uni.showLoading({
title: "提交中....",
mask: true
});
var itemCodes = []
this.detailSource.forEach(item => {
itemCodes.push(item.itemCode)
})
getManagementPrecisions(itemCodes, this.toLocationCode, res => {
const itemCodes = [];
detailSource.value.forEach((item) => {
itemCodes.push(item.itemCode);
});
getManagementPrecisions(itemCodes, toLocationCode.value, (res) => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams();
managementList.value = res.list;
const params = setParams();
console.log("提交参数", JSON.stringify(params));
productReceiptJobsubmit(params).then(res => {
uni.hideLoading()
productReceiptJobsubmit(params).then((res) => {
uni.hideLoading();
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成制品收货记录<br>" + res.data, )
showCommitSuccessMessage(`提交成功\n生成制品收货记录\n${res.data}`);
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
showErrorMessage(`提交失败[${res.msg}]`);
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
showErrorMessage(res.message);
}
});
},
};
setParams() {
var subList = []
var creator = this.$store.state.user.id
const setParams = () => {
const subList = [];
const creator = store.state.user.id;
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
if (detail.scaned) {
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
detail.packingNumber, detail.batch);
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch);
detail.toPackingNumber = info.packingNumber;
detail.toBatch = info.batch;
detail.toContainerNumber = '';
detail.toInventoryStatus = detail.inventoryStatus
detail.toLocationCode = this.toLocationCode
subList.push(detail)
detail.toInventoryStatus = detail.inventoryStatus;
detail.toLocationCode = toLocationCode.value;
subList.push(detail);
}
})
})
this.jobContent.subList = subList
this.jobContent.creator = creator;
return this.jobContent;
},
});
});
jobContent.value.subList = subList;
jobContent.value.creator = creator;
return jobContent.value;
};
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
const scanPopupGetFocus = () => {
if (scanPopupRef.value) {
scanPopupRef.value.getfocus();
}
},
};
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus();
const scanPopupLoseFocus = () => {
if (scanPopupRef.value) {
scanPopupRef.value.losefocus();
}
},
};
showMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
const showMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessageRef.value.showMessage(message, (res) => {
if (res) {
this.scanPopupGetFocus();
scanPopupGetFocus();
}
});
})
},
});
};
showErrorMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, res => {
const showErrorMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
this.scanPopupGetFocus();
scanPopupGetFocus();
}
});
})
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
}
}
});
};
const showCommitSuccessMessage = (hint) => {
comMessageRef.value.showSuccessMessage(hint, () => {
navigateBack(1);
});
};
</script>
<style scoped lang="scss">

28
src/pages/productReceipt/job/fgProductReceiptDetail.vue

@ -29,7 +29,7 @@
<view class="cell_info">
<view class="text_lightblue">班次</view>
<view>
{{jobContent.shift}}
{{jobContent.shiftName}}
</view>
</view>
</view>
@ -52,7 +52,7 @@
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<locationCompare title="收货库位" :isShowEdit="jobContent.allowModifyLocation=='TRUE'"
<locationCompare title="收货库位" ref="comScanLocation" :isShowEdit="jobContent.allowModifyLocation=='TRUE'"
:recommendLocationCode="jobToLocationCode" :locationCode="toLocationCode"
@getLocation='scanLocationCode' :locationTypeList="toLocationTypeList"></locationCompare>
</view>
@ -259,6 +259,7 @@ const calcFgQty = () => {
})
//
if (pack.scaned && pack.qty == pack.fgList.length) {
closeScanPopup()
commit()
}
})
@ -282,20 +283,34 @@ const closeScanPopup = () => {
}
const scanLocationCode = (location, code) => {
//
if (this.jobContent.allowModifyLocation == "TRUE") {
toLocationCode.value = code
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
detail.toLocationCode = code
})
})
} else {
//
if (code != this.jobToLocationCode) {
this.showMessageHint("任务中不允许修改库位\n扫描库位[" + code + "]推荐库位是[" + this.jobToLocationCode + "]",
callBack => {})
} else {
toLocationCode.value = code
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
detail.toLocationCode = code
})
})
}
}
}
const checkLocation = () => {
let isPass = true
if (toLocationCode.value == '' || toLocationCode.value == null) {
showMessageHint('请扫描收货库位', (callback) => {
comScanLocation.value.showLocation()
})
return (isPass = false)
}
return isPass
@ -390,6 +405,9 @@ const commit = () => {
}else{
this.toLocationCode = this.jobToLocationCode
}
if(!toLocationCode.value){
return;
}
detailSource.value.forEach((item) => {
item.subList.forEach((subitem) => {
if (valiDate) {
@ -429,7 +447,7 @@ const submitJob = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成装配收货记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成装配收货记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}

27
src/pages/productReceipt/job/fgProductReceiptJob.vue

@ -6,23 +6,42 @@
<script setup lang="ts">
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,
onHide, onUnload
} from '@dcloudio/uni-app'
import productReceiptJob from '@/pages/productReceipt/job/productReceiptJob.vue'
const productreceiptjobRef = ref()
const title = ref('')
onShow(() => {
nextTick(() => {
if (productreceiptjobRef.value != undefined) {
productreceiptjobRef.value.refresh()
if (productreceiptjobRef.value) {
productreceiptjobRef.value.timerRefresh()
}
})
})
onHide(()=>{
if (productreceiptjobRef.value) {
productreceiptjobRef.value.stopRefresh()
}
})
onUnload(()=>{
if (productreceiptjobRef.value) {
productreceiptjobRef.value.stopRefresh()
}
})
onLoad((option) => {
title.value = option.title
})
onPullDownRefresh(() => {
productreceiptjobRef.value.refresh()
productreceiptjobRef.value.timerRefresh()
})
onReachBottom(() => {
productreceiptjobRef.value.onReach()

54
src/pages/productReceipt/job/productReceiptDetail.vue

@ -31,7 +31,7 @@
<view class="cell_info">
<view class="text_lightblue">班次</view>
<view>
{{ jobContent.shift }}
{{ jobContent.shiftName }}
</view>
</view>
</view>
@ -40,7 +40,15 @@
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false" @remove="updateData" @updateData="updateData" :locationAreaTypeList="toLocationAreaTypeList"> </comProductDetailCard>
<comProductDetailCardBatch :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData"
:locationAreaTypeList='toLocationAreaTypeList' v-if="managementType=='BY_BATCH'">
</comProductDetailCardBatch>
<comProductDetailCard v-else :dataContent="item" :settingParam="jobContent"
:isShowLocation="false" @remove="updateData"
@updateData="updateData"
:locationAreaTypeList="toLocationAreaTypeList">
</comProductDetailCard>
</view>
</view>
</scroll-view>
@ -69,7 +77,7 @@ import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReach
import { getManagementPrecisions } from '@/common/balance.js'
import { getProductReceiptJobDetail, takeProductReceiptJob, cancleTakeProductReceiptJob, productReceiptJobsubmit } from '@/api/request2.js'
import { goHome, navigateBack, getPackingNumberAndBatch } from '@/common/basic.js'
import { goHome, navigateBack, getPackingNumberAndBatch ,getSwitchInfoByCode} from '@/common/basic.js'
import { getDirectoryItemArray, getInventoryStatusName } from '@/common/directory.js'
@ -82,6 +90,7 @@ import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comDetailCard from '@/mycomponents/detail/comDetailCard.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import comProductDetailCard from '@/pages/productReceipt/coms/comProductDetailCard.vue'
import comProductDetailCardBatch from "@/pages/productReceipt/coms/comProductDetailCardBatch.vue"
import { useCountStore } from '@/store'
// store
const store = useCountStore()
@ -96,6 +105,7 @@ const subList = ref([]) // 接口返回的任务subList
const detailSource = ref([]) //
const toLocationAreaTypeList = ref([])
const managementList = ref([])
const managementType = ref('')
const jobStatus = ref('')
const jobToLocationCode = ref('')
const status = ref('')
@ -179,14 +189,30 @@ const getDetail = () => {
jobToLocationCode.value = subList.value[0].toLocationCode
productionLineCode.value = jobContent.value.subList[0].productionLineCode
if (jobContent.value.allowModifyLocation == 'FALSE') {
toLocationCode.value = subList.value[0].toLocationCode
let valiDate = getSwitchInfoByCode("semiProductReceipCommitValidate")
if(valiDate){
jobContent.value.allowModifyLocation = 'TRUE'
}else{
jobContent.value.allowModifyLocation = 'FALSE'
}
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes)
detailSource.value = getDataSource(subList.value)
if (scanMessage.value) {
scanPopup.value.simulateScan(scanMessage.value)
}
//
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
getManagementPrecisions(itemCodes, jobToLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
}
})
} else {
showMessage('列表数据为0')
}
@ -207,11 +233,12 @@ const getScanResult = (result) => {
if (detail == undefined) {
showErrorMessage(`物料号【${itemCode}】不在列表中`)
} else {
detail.scaned = true
const itemDetail = detail.subList.find((r) => r.packingNumber == packingNumber && r.batch == batch)
if (itemDetail == undefined) {
showErrorMessage(`箱码[${packingNumber}]` + `批次[${batch}]不在任务列表中`)
showErrorMessage(`批次[${batch}]不在任务列表中`)
} else if (itemDetail.scaned) {
showErrorMessage(`箱码[${packingNumber}]` + `批次[${batch}]已经扫描`)
showErrorMessage(`批次[${batch}]已经扫描`)
} else {
itemDetail.scaned = true
itemDetail.handleQty = Number(result.label.qty)
@ -235,7 +262,7 @@ const continueScan = () => {
}
const updateData = () => {
calcHandleQty(detailSource.value)
// calcHandleQty(detailSource.value)
}
const openScanPopup = () => {
@ -281,10 +308,15 @@ const commit = () => {
showErrorMessage('扫描数为0,请先扫描')
return
}
let valiDate = getSwitchInfoByCode("semiProductReceipCommitValidate")
//
if(valiDate){
if (!checkLocation()) {
return
}
}else{
toLocationCode.value = jobToLocationCode.value
}
//
if (scanCount.value == subList.value.length) {
@ -300,7 +332,7 @@ const commit = () => {
}
} else {
//
showMessage('请完成扫描后,再进行提交<br>' + `已经扫描[${scanCount.value}]总共[${subList.value.length}]`)
showMessage('请完成扫描后,再进行提交\n' + `已经扫描[${scanCount.value}]总共[${subList.value.length}]`)
}
}
}
@ -344,7 +376,7 @@ const submitJob = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成预生产收货记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成预生产收货记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -369,6 +401,8 @@ const setParams = () => {
if (detail.scaned) {
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch)
detail.toPackingNumber = info.packingNumber
detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = info.packingNumber;
detail.toBatch = info.batch
detail.toContainerNumber = ''
detail.toInventoryStatus = detail.inventoryStatus

113
src/pages/productReceipt/job/productReceiptJob.vue

@ -27,7 +27,7 @@ import { getProductReceiptJobList, cancleTakeProductReceiptJob } from '@/api/req
import { goHome, updateTitle } from '@/common/basic.js'
import { getDetailOption, getDetailGiveupOption } from '@/common/array.js'
import {planRefreshTime} from '@/common/config.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
@ -72,15 +72,26 @@ const jobInfoPopupRef = ref()
const jobListPopupRef = ref()
const scanPopup = ref()
const jobListRef = ref()
const timer = ref(null)
onMounted(() => {
detailOptions.value = getDetailOption()
detailGiveupOptions.value = getDetailGiveupOption()
timerRefresh()
// getList('refresh')
})
const refresh = () => {
const timerRefresh = () => {
getList('refresh')
stopRefresh();
timer.value = setInterval(function() {
getList('refresh');
}, planRefreshTime)
}
const stopRefresh = ()=> {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
}
const getList = (type) => {
proxy.$modal.loading('加载中­....')
loadingType.value = 'loading'
@ -102,11 +113,6 @@ const getList = (type) => {
action: 'in',
value: status.value
})
filters.push({
column: 'accept_user_id',
action: '==',
value: store.id
})
filters.push({
column: 'type',
action: '==',
@ -151,20 +157,7 @@ const getList = (type) => {
}
const openJobDetail = (item, scanMessage = '') => {
if (props.type == 'predict') {
uni.navigateTo({
url: `./productReceiptDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}&title=${props.title}`
})
} else if (props.type == 'assemble') {
uni.navigateTo({
url: `./fgProductReceiptDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}&title=${props.title}}`
})
} else {
uni.navigateTo({
url: `./scrapReceiptDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}&title=${props.title}}`
})
}
scanMessage.value = ''
getJobInfoByNumber(item.number,scanMessage)
}
const showItemList = (itemList) => {
@ -239,11 +232,6 @@ const getDataListByType = (code) => {
action: '==',
value: code
})
filters.push({
column: 'accept_user_id',
action: '==',
value: store.id
})
const params = {
filters,
pageNo: 1,
@ -264,8 +252,14 @@ const getDataListByType = (code) => {
})
}
const showMessage = (message) => {
if(scanPopup.value){
scanPopup.value.packLoseFocus()
}
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
if(scanPopup.value){
scanPopup.value.packGetFocus()
}
}
})
}
@ -322,11 +316,6 @@ const getScanResult = (result) => {
action: 'in',
value: '1,2'
},
{
column: 'accept_user_id',
action: '==',
value: store.id
}
// {
// column: 'fromLocationCode',
// action: '==',
@ -358,15 +347,71 @@ const getScanResult = (result) => {
selectItem(list[0])
}
} else {
showMessage('未查找到任务<br>' + `扫描[${result.scanMessage}]`)
showMessage('未查找到任务\n' + `扫描[${result.scanMessage}]`)
}
})
.catch((error) => {
showMessage(error)
})
} catch (e) {
showMessage(`${error}<br>扫描[${result.scanMessage}]`)
showMessage(`${error}\n扫描[${result.scanMessage}]`)
}
}
const getJobInfoByNumber = (number,scanMessage)=>{
uni.showLoading({
title: "加载中....",
mask: true
});
let filters = []
filters.push({
column: "status",
action: "in",
value: '1,2'
})
filters.push({
column: "number",
action: "==",
value: number
})
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getProductReceiptJobList(params).then(res => {
uni.hideLoading();
if (res.data.list.length == 0) {
showMessage('未查找到' + '【' + number + '】的发料任务');
} else {
let result = res.data.list[0];
if(result.acceptUserId&&result.acceptUserId!=this.$store.state.user.id){
comMessageRef.value.showErrorMessage("任务号["+result.number+"]已经被["+result.acceptUserName+"]承接,无法执行", res => {
if (res) {
getList('refresh')
}
});
return;
}
if (props.type == 'predict') {
uni.navigateTo({
url: `./productReceiptDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}&title=${props.title}`
})
} else if (props.type == 'assemble') {
uni.navigateTo({
url: `./fgProductReceiptDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}&title=${props.title}}`
})
} else {
uni.navigateTo({
url: `./scrapReceiptDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}&title=${props.title}}`
})
}
scanMessage.value = ''
}
}).catch(error => {
uni.hideLoading();
showMessage(error);
})
}
defineExpose({
refresh,

72
src/pages/productReceipt/job/scrapReceiptDetail.vue

@ -13,7 +13,12 @@
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false" @remove="updateData" @updateData="updateData" :locationTypeList="toLocationTypeList"> </comProductDetailCard>
<comProductDetailCardBatch :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" :locationTypeList='toLocationTypeList' v-if="managementType=='BY_BATCH'">
</comProductDetailCardBatch>
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" :locationTypeList='toLocationTypeList' v-else>
</comProductDetailCard>
</view>
<u-line />
</view>
@ -55,6 +60,7 @@ import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comDetailCard from '@/mycomponents/detail/comDetailCard.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import comProductDetailCard from '@/pages/productReceipt/coms/comProductDetailCard.vue'
import comProductDetailCardBatch from "@/pages/productReceipt/coms/comProductDetailCardBatch.vue"
import { useCountStore } from '@/store'
// store
const store = useCountStore()
@ -66,6 +72,7 @@ const toLocationCode = ref('')
const subList = ref([]) // subList
const detailSource = ref([]) //
const managementList = ref([])
const managementType = ref('')
const jobStatus = ref('')
const toLocationTypeList = ref([])
const receiptJob = ref({})
@ -75,6 +82,7 @@ const scanPopup = ref()
const comScanLocation = ref()
const detailInfoPopupRef = ref()
const comMessageRef = ref()
const managementPrecision = ref()
onLoad((option) => {
uni.setNavigationBarTitle({
title: `${option.title}详情`
@ -135,7 +143,7 @@ const receive = (callback) => {
const getDetail = () => {
proxy.$modal.loading('加载中....')
getProductReceiptJobDetail(id.value)
.then((res) => {
.then(async (res) => {
uni.hideLoading()
if (res.data == null) {
showMessage('未获取到详情')
@ -145,7 +153,20 @@ const getDetail = () => {
subList.value = res.data.subList
jobToLocationCode.value = subList.value[0].toLocationCode
toLocationTypeList.value = getDirectoryItemArray(jobContent.value.toLocationTypes)
detailSource.value = getDataSource(subList.value)
detailSource.value = await getDataSource(subList.value)
//
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
await getManagementPrecisions(itemCodes, jobToLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
}
})
uni.hideLoading()
} else {
showMessage('列表数据为0')
@ -167,11 +188,17 @@ const getScanResult = (result) => {
if (detail == undefined) {
showErrorMessage(`物料号【${itemCode}】不在列表中`)
} else {
const itemDetail = detail.subList.find((r) => r.packingNumber == packingNumber && r.batch == batch)
let itemDetail
if(managementPrecision.value == 'BY_QUANTITY'){
itemDetail = detail.subList.find(r => r.itemCode == result.label.itemCode);
}else{
itemDetail = detail.subList.find(r => r.batch == batch);
}
if (itemDetail == undefined) {
showErrorMessage(`箱码[${packingNumber}]` + `批次[${batch}]不在任务列表中`)
} else if (itemDetail.scaned) {
showErrorMessage(`箱码[${packingNumber}]` + `批次[${batch}]已经扫描`)
showErrorMessage(`批次[${batch}]不在任务列表中`)
} else {
if(itemDetail.scaned){
showErrorMessage(`批次[${batch}]已经扫描`)
}else {
itemDetail.scaned = true
itemDetail.handleQty = Number(result.label.qty)
@ -182,6 +209,7 @@ const getScanResult = (result) => {
}
}
}
}
const continueScan = () => {
scanCount.value = getScanCount(subList.value)
if (scanCount.value == subList.value.length) {
@ -235,17 +263,38 @@ const commit = () => {
if (!checkLocation()) {
return
}
// //
if (scanCount.value == subList.value.length) {
checkCount();
} else if (scanCount.value < subList.value.length) {
//
if (jobContent.value.allowPartialComplete == "TRUE") {
//
checkCount();
} else {
//
showMessage("任务明细未全部完成,是否提交");
}
}
}
const checkCount = ()=>{
//
let str = ''
detailSource.value.forEach((item) => {
item.subList.forEach(cur => {
if (cur.qty != cur.handleQty) {
str += `包装号【${cur.packingNumber}】提交数量【${cur.handleQty}】与任务物料数量【${cur.qty}】不一致`
let tempHandleQty = 0
if(cur.handleQty){
tempHandleQty = cur.handleQty
}else {
tempHandleQty = 0
}
str += `包装号【${cur.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致`
}
})
})
if (str) {
str += ',是否确认提交?'
str = '任务明细未全部完成,是否提交?\n'+str
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
submitJob()
@ -269,12 +318,13 @@ const submitJob = () => {
getManagementPrecisions(itemCodes, toLocationCode.value, (res) => {
if (res.success) {
managementList.value = res.list
managementPrecision.value = managementList.value[0].ManagementPrecision
const params = setParams()
productReceiptJobsubmit(params)
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成制品上架记录:${res.data}`)
showCommitSuccessMessage(`提交成功\n生成制品上架记录:${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -298,6 +348,8 @@ const setParams = () => {
if (detail.scaned) {
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch)
detail.toPackingNumber = info.packingNumber
detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = info.packingNumber;
detail.toBatch = info.batch
detail.toContainerNumber = ''
detail.toInventoryStatus = detail.inventoryStatus

27
src/pages/productReceipt/job/scrapReceiptJob.vue

@ -6,23 +6,42 @@
<script setup lang="ts">
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,
onHide, onUnload
} from '@dcloudio/uni-app'
import productReceiptJob from '@/pages/productReceipt/job/productReceiptJob.vue'
const productreceiptjobRef = ref()
const title = ref('')
onShow(() => {
nextTick(() => {
if (productreceiptjobRef.value != undefined) {
productreceiptjobRef.value.refresh()
if (productreceiptjobRef.value) {
productreceiptjobRef.value.timerRefresh()
}
})
})
onHide(()=>{
if (productreceiptjobRef.value) {
productreceiptjobRef.value.stopRefresh()
}
})
onUnload(()=>{
if (productreceiptjobRef.value) {
productreceiptjobRef.value.stopRefresh()
}
})
onLoad((option) => {
title.value = option.title
})
onPullDownRefresh(() => {
productreceiptjobRef.value.refresh()
productreceiptjobRef.value.timerRefresh()
})
onReachBottom(() => {
productreceiptjobRef.value.onReach()

437
src/pages/productReceipt/job/semiProductReceiptDetail.vue

@ -43,7 +43,7 @@
</view>
</template>
<script>
<script setup lang="ts">
import {
getManagementPrecisions
} from '@/common/balance.js';
@ -81,335 +81,306 @@
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue"
export default {
name: 'receipt_detail',
components: {
winScanButton,
comDetailCard,
locationCompare,
winScanPack,
jobTop,
comProductDetailCard
},
data() {
return {
id: '',
receiptJob: {},
toLocationCode: '',
isShowPackingCode: true,
scanCount: 0,
jobContent: {}, //
subList: [], //subList
detailSource: [], //
toLocationTypeList: [],
managementList: [],
jobStatus:"",
jobToLocationCode:""
};
},
onLoad(option) {
this.id = option.id;
if (this.id != undefined) {
import {ref, onMounted, onBeforeUnmount} from 'vue';
import {onLoad, onPullDownRefresh, onBackPress, onNavigationBarButtonTap} from '@dcloudio/uni-app';
import {useCountStore} from '@/store'
const store = useCountStore()
const id = ref('');
const receiptJob = ref({});
const toLocationCode = ref('');
const isShowPackingCode = ref(true);
const scanCount = ref(0);
const jobContent = ref({}); //
const subList = ref([]); // subList
const detailSource = ref([]); //
const toLocationTypeList = ref([]);
const managementList = ref([]);
const jobStatus = ref("");
const jobToLocationCode = ref("");
const scanPopupRef = ref(null);
const comMessageRef = ref(null);
const comScanLocationRef = ref(null);
onLoad((option) => {
id.value = option.id;
if (id.value !== undefined) {
//
if (option.status == "1") {
this.receive((callback => {
this.getDetail();
}));
if (option.status === "1") {
receive(() => {
getDetail();
});
} else {
this.getDetail();
getDetail();
}
}
},
//
onNavigationBarButtonTap(e) {
});
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {
});
onBackPress((e) => {
//
if (e.from == 'backbutton') {
if (this.jobStatus=="2") {
if (e.from === 'backbutton') {
if (jobStatus.value === "2") {
//
cancleTakeProductReceiptJob(this.id).then(res => {
cancleTakeProductReceiptJob(id.value).then(() => {
uni.navigateBack();
}).catch(error => {
}).catch(() => {
uni.navigateBack();
})
});
} else {
uni.navigateBack();
}
return true;
}
});
},
onPullDownRefresh() {
this.getDetail();
onPullDownRefresh(() => {
getDetail();
uni.stopPullDownRefresh();
},
mounted() {
});
},
methods: {
//
receive(callback) {
if (this.id != null) {
takeProductReceiptJob(this.id).then(res => {
//
const receive = (callback) => {
if (id.value !== null) {
takeProductReceiptJob(id.value).then(() => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}).catch((error) => {
showErrorMessage(error);
});
}
},
};
getDetail() {
var that = this;
const getDetail = () => {
uni.showLoading({
title: "加载中....",
mask: true
});
getProductReceiptJobDetail(that.id).then(res => {
getProductReceiptJobDetail(id.value).then((res) => {
uni.hideLoading();
if (res.data == null) {
that.showMessage('未获取到详情');
if (res.data === null) {
showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
that.jobContent = res.data;
that.subList = res.data.subList;
that.jobStatus = res.data.status
that.jobToLocationCode = that.subList[0].toLocationCode
that.toLocationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes)
that.detailSource = getDataSource(that.subList)
jobContent.value = res.data;
subList.value = res.data.subList;
jobStatus.value = res.data.status;
jobToLocationCode.value = subList.value[0].toLocationCode;
toLocationTypeList.value = getDirectoryItemArray(jobContent.value.toLocationTypes);
detailSource.value = getDataSource(subList.value);
} else {
that.showMessage('列表数据为0');
showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
getScanResult(result) {
let label = result.label;
var packingNumber = label.packingNumber;
var batch = label.batch;
var qty = label.qty;
var itemCode = label.itemCode;
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const getScanResult = (result) => {
const label = result.label;
const packingNumber = label.packingNumber;
const batch = label.batch;
const qty = label.qty;
const itemCode = label.itemCode;
const detail = detailSource.value.find((r) => r.itemCode === itemCode);
if (detail === undefined) {
showErrorMessage(`物料号【${itemCode}】不在列表中`);
} else {
var itemDetail = detail.subList.find(r =>
r.packingNumber == packingNumber &&
r.batch == batch);
if (itemDetail == undefined) {
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中")
const itemDetail = detail.subList.find((r) =>
r.packingNumber === packingNumber && r.batch === batch
);
if (itemDetail === undefined) {
showErrorMessage(`箱码[${packingNumber}]批次[${batch}]不在任务列表中`);
} else {
if (itemDetail.scaned) {
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描")
showErrorMessage(`箱码[${packingNumber}]批次[${batch}]已经扫描`);
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty);
itemDetail.toLocationCode = this.toLocationCode;
itemDetail.toLocationCode = toLocationCode.value;
itemDetail.labelQty = Number(result.label.qty);
calcHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
calcHandleQty(detailSource.value);
continueScan();
}
}
}
},
};
//
continueScan() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
const continueScan = () => {
scanCount.value = getScanCount(subList.value);
if (scanCount.value === subList.value.length) {
closeScanPopup();
} else {
this.scanPopupGetFocus();
scanPopupGetFocus();
}
},
updateData() {
calcHandleQty(this.detailSource);
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
};
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
const updateData = () => {
calcHandleQty(detailSource.value);
};
const openScanPopup = () => {
scanPopupRef.value.openScanPopup();
};
scanLocationCode(location, code) {
this.toLocationCode = code
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code
})
})
},
const closeScanPopup = () => {
scanPopupRef.value.closeScanPopup();
};
checkLocation() {
var isPass = true;
if (this.toLocationCode == "" || this.toLocationCode == null) {
this.showMessageHint('请扫描收货库位', callback => {
this.$refs.comScanLocation.showLocation();
})
const scanLocationCode = (location, code) => {
toLocationCode.value = code;
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
detail.toLocationCode = code;
});
});
};
return isPass = false;
const checkLocation = () => {
let isPass = true;
if (toLocationCode.value === "" || toLocationCode.value === null) {
showMessageHint('请扫描收货库位', () => {
comScanLocationRef.value.showLocation();
});
isPass = false;
}
return isPass;
},
};
showMessageHint(hint, callback) {
this.$refs.comMessage.showErrorMessage(hint, res => {
const showMessageHint = (hint, callback) => {
comMessageRef.value.showErrorMessage(hint, (res) => {
if (res) {
callback()
callback();
}
});
},
};
commit() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
const commit = () => {
scanCount.value = getScanCount(subList.value);
if (scanCount.value === 0) {
showErrorMessage("扫描数为0,请先扫描");
return;
}
//
if (!this.checkLocation()) {
return
if (!checkLocation()) {
return;
}
//
if (this.scanCount == this.subList.length) {
this.submitJob();
} else if (this.scanCount < this.subList.length) {
//
if (this.jobContent.allowPartialComplete == "TRUE") {
//
this.submitJob();
if (scanCount.value === subList.value.length) {
submitJob();
} else if (scanCount.value < subList.value.length) {
if (jobContent.value.allowPartialComplete === "TRUE") {
comMessageRef.value.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', (res) => {
if (res) {
submitJob();
}
});
} else {
//
this.showMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + "]总共[" + this.subList
.length +
"]");
showMessage("任务明细未全部完成,不允许部分提交!");
}
}
};
},
submitJob() {
const submitJob = () => {
uni.showLoading({
title: "提交中....",
mask: true
});
var itemCodes = []
this.detailSource.forEach(item => {
itemCodes.push(item.itemCode)
})
getManagementPrecisions(itemCodes, this.toLocationCode, res => {
const itemCodes = [];
detailSource.value.forEach((item) => {
itemCodes.push(item.itemCode);
});
getManagementPrecisions(itemCodes, toLocationCode.value, (res) => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams();
managementList.value = res.list;
const params = setParams();
console.log("提交参数", JSON.stringify(params));
productReceiptJobsubmit(params).then(res => {
uni.hideLoading()
productReceiptJobsubmit(params).then((res) => {
uni.hideLoading();
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成制品收货记录<br>" + res.data, )
showCommitSuccessMessage(`提交成功\n生成制品收货记录\n${res.data}`);
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
showErrorMessage(`提交失败[${res.msg}]`);
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
showErrorMessage(res.message);
}
});
},
};
setParams() {
var subList = []
var creator = this.$store.state.user.id
const setParams = () => {
const subList = [];
const creator = store.id;
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
if (detail.scaned) {
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
detail.packingNumber, detail.batch);
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch);
detail.toPackingNumber = info.packingNumber;
detail.toBatch = info.batch;
detail.toContainerNumber = '';
detail.toInventoryStatus = detail.inventoryStatus
detail.toLocationCode = this.toLocationCode
subList.push(detail)
detail.toInventoryStatus = detail.inventoryStatus;
detail.toLocationCode = toLocationCode.value;
subList.push(detail);
}
})
})
this.jobContent.subList = subList
this.jobContent.creator = creator;
return this.jobContent;
},
});
});
jobContent.value.subList = subList;
jobContent.value.creator = creator;
return jobContent.value;
};
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
const scanPopupGetFocus = () => {
if (scanPopupRef.value) {
scanPopupRef.value.getfocus();
}
},
};
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus();
const scanPopupLoseFocus = () => {
if (scanPopupRef.value) {
scanPopupRef.value.losefocus();
}
},
};
showMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
const showMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessageRef.value.showMessage(message, (res) => {
if (res) {
this.scanPopupGetFocus();
scanPopupGetFocus();
}
});
})
},
});
};
showErrorMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, res => {
const showErrorMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
this.scanPopupGetFocus();
scanPopupGetFocus();
}
});
})
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
}
}
});
};
const showCommitSuccessMessage = (hint) => {
comMessageRef.value.showSuccessMessage(hint, () => {
navigateBack(1);
});
};
</script>
<style scoped lang="scss">

27
src/pages/productReceipt/job/semiProductReceiptJob.vue

@ -6,23 +6,42 @@
<script setup lang="ts">
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,
onHide, onUnload
} from '@dcloudio/uni-app'
import productReceiptJob from '@/pages/productReceipt/job/productReceiptJob.vue'
const productreceiptjobRef = ref()
const title = ref('')
onShow(() => {
nextTick(() => {
if (productreceiptjobRef.value != undefined) {
productreceiptjobRef.value.refresh()
if (productreceiptjobRef.value) {
productreceiptjobRef.value.timerRefresh()
}
})
})
onHide(()=>{
if (productreceiptjobRef.value) {
productreceiptjobRef.value.stopRefresh()
}
})
onUnload(()=>{
if (productreceiptjobRef.value) {
productreceiptjobRef.value.stopRefresh()
}
})
onLoad((option) => {
title.value = option.title
})
onPullDownRefresh(() => {
productreceiptjobRef.value.refresh()
productreceiptjobRef.value.timerRefresh()
})
onReachBottom(() => {
productreceiptjobRef.value.onReach()

Loading…
Cancel
Save