Browse Source

补给品发货

intex_online20250220
张立 1 week ago
parent
commit
f2fe1fcdda
  1. 4
      .env.development
  2. 35
      src/mycomponents/job/jobPlanNumber.vue
  3. 603
      src/mycomponents/scan/winScanPackAndLocationNoShow.vue
  4. 58
      src/pages/issueSupplies/coms/comIssueDetailCardBatch.vue
  5. 57
      src/pages/issueSupplies/coms/comIssueJobCard.vue
  6. 58
      src/pages/issueSupplies/coms/jobInfoPopup.vue
  7. 46
      src/pages/issueSupplies/coms/jobListPopup.vue
  8. 552
      src/pages/issueSupplies/job/issueDetailBatch.vue
  9. 635
      src/pages/issueSupplies/job/issueJob.vue

4
.env.development

@ -1,5 +1,5 @@
#VITE_BASE_URL=http://192.168.1.49:12080/admin-api VITE_BASE_URL=http://192.168.0.228:12080/admin-api
VITE_BASE_URL=http://localhost:12080/admin-api #VITE_BASE_URL=http://localhost:12080/admin-api
#VITE_BASE_URL=http://dev.ccwin-in.com:28051/api/admin-api #VITE_BASE_URL=http://dev.ccwin-in.com:28051/api/admin-api
# VITE_BASE_URL_IMAGE=http://172.22.32.9:81/admin-api # VITE_BASE_URL_IMAGE=http://172.22.32.9:81/admin-api

35
src/mycomponents/job/jobPlanNumber.vue

@ -0,0 +1,35 @@
<template>
<view class="task_number">
<text> {{number}}</text>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
};
},
watch: {
},
props: {
number: {
type: String,
default: ''
},
},
methods: {}
}
</script>
<style lang="scss">
</style>
<style>
</style>

603
src/mycomponents/scan/winScanPackAndLocationNoShow.vue

@ -0,0 +1,603 @@
<template>
<view>
<uni-popup ref="popup" @change="change" :mask-click="false">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
扫描{{title}}
</view>
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()">
</image>
</view>
</view>
<!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
border-radius: 8rpx;
height: 30px;">
<view class="uni-center" style="width: 25%; font-size: 35rpx;">
来源库位
</view>
<view class="">
<view v-if='allowModifyLocation'>
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位" disabled
@confirm="handleConfirm" style='height: 30rpx;border:1px solid #fff ;'></uni-combox>
</view>
<view v-else>
<text style="padding: 5px;font-size: 40rpx;">
{{fromLocationCode}}
</text>
</view>
</view>
</view> -->
<view class="">
<view class="">
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :isShowHistory="isShowHistory"
:clearResult="true" :headerType="headerType" :locationCode='fromLocationCode'></win-com-scan>
</view>
</view>
</view>
</uni-popup>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
</view>
<comMessage ref="comMessage"></comMessage>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import {
getBalanceByManagementPrecisionByPacking,
} from '@/common/balance.js';
import {
getBasicLocationByCode,
} from '@/api/request2.js';
import {
getLabelInfo
} from '@/common/label.js';
import {
getListLocationAreaTypeDesc,
checkDirectoryItemExist,
getDirectoryItemArray,
getLocationAreaTypeName,
getInventoryStatusDesc
} from '@/common/directory.js';
export default {
name: 'winScanPack',
emits: ["getResult", "close", "getCountScanResult", "confirm"],
components: {
winComScan,
balanceSelect
},
props: {
title: {
type: String,
default: '箱标签'
},
isShowHistory: {
type: Boolean,
default: true
},
allowNullBalance: {
type: Boolean,
default: false
},
//
noShowBalanceMessage: {
type: Boolean,
default: false
},
//
isCount: {
type: Boolean,
default: false
},
//
allowModifyLocation: {
type: Boolean,
default: true
},
headerType: {
type: String,
default: "HPQ,HMQ"
},
queryBalance: {
type: Boolean,
default: true
},
balanceFromInventoryStatuses: { //fromInventoryStatuses
type: Boolean,
default: true
},
toLocationCode: {
type: String,
default: ""
},
//
isJustReplay: {
type: Boolean,
default: false
},
},
data() {
return {
scanResult: {},
show: false,
scanList: [],
expand: false,
showScanResult: {},
expendIcon: 'arrow-down',
fromLocationCode: '',
fromLocation: '',
fromLocationList: [],
fromLocationAreaTypeList: [],
locationOnFocus: false,
businessType: {},
inventoryStatus: [],
managementPrecision: '',
fromInventoryStatuses: "",
isCheck: false,
chooseWhich: '1',
fromWarehouseCode:""
}
},
created() {
},
methods: {
handleConfirm() {
this.$emit('confirm', this.fromLocationCode)
},
//
openScanPopupForType(fromLocationCode, businessType) {
this.businessType = businessType;
this.fromLocationCode = fromLocationCode;
this.fromInventoryStatuses = getDirectoryItemArray(this.businessType.outInventoryStatuses)
this.inventoryStatus = getDirectoryItemArray(this.businessType.outInventoryStatuses); //
this.fromLocationAreaTypeList = getDirectoryItemArray(this.businessType.outAreaTypes); //
this.$refs.popup.open('bottom')
setTimeout(res => {
if (fromLocationCode != '') {
this.packGetFocus();
} else {
this.locationGetFocus();
}
}, 500)
},
//
openScanPopupForJob( jobContent) {
console.log(99,jobContent)
// this.fromLocationCode = fromLocationCode;
// this.fromLocationList = fromLocationList;
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses)
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //; //
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //
this.$refs.popup.open('bottom')
setTimeout(res => {
if (this.fromLocationCode != '') {
this.packGetFocus();
} else {
if (this.fromLocationList.length == 0) {
this.locationGetFocus();
} else {
this.fromLocationCode = this.fromLocationList[0];
this.packGetFocus();
}
}
}, 500)
},
//
openScanPopupForJobSimulate(fromLocationCode, fromLocationList, jobContent, scanMessage) {
this.fromLocationCode = fromLocationCode;
this.fromLocationList = fromLocationList;
if (!fromLocationCode) {
if (this.fromLocationList.length == 0) {
// this.locationGetFocus();
alert('没有来源库位:List')
} else {
this.fromLocationCode = this.fromLocationList[0];
}
}
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses)
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //; //
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //
uni.showLoading({
title: "获取标签信息",
mask: true
})
getLabelInfo(scanMessage, this.headerType, callback => {
uni.hideLoading()
if (callback.success) {
this.getScanResult(callback);
} else {
this.showErrorMessage(callback.message, res => {})
}
})
},
closeScanPopup(content) {
this.packLoseFocus()
this.$refs.popup.close();
this.$emit("close", '');
},
scanLocation(scanResult) {
console.log(34,scanResult)
if(scanResult.label.location){
this.fromLocationCode = scanResult.label.location
}
var isCheck = false;
console.log(34,this.fromLocationCode )
if (this.fromLocationCode == '') {
this.showErrorMessage('来源库位不能为空', callback => {
this.locationGetFocus();
})
return;
}
if (this.fromLocationList.length > 0) {
if (!this.isInLocationList(this.fromLocationCode)) {
this.showErrorMessage("扫描库位【" + this.fromLocationCode + '】不在任务来源库位中', callback => {
this.locationGetFocus();
})
return;
}
}
uni.showLoading({
title: '扫描中...',
mask: true
});
getBasicLocationByCode(this.fromLocationCode).then(res => {
if (res.data.total > 0) {
let result = res.data.list[0];
if (result.code != this.fromLocationCode) {
this.showErrorMessage('未查询到库位[' + this.fromLocationCode + ']')
return;
}
var type = result.areaType;
var available = result.available;
if (available == "TRUE") {
if (checkDirectoryItemExist(this.fromLocationAreaTypeList, type)) {
this.location = result;
this.fromWarehouseCode=result.warehouseCode
// this.packGetFocus();
//
if(this.isJustReplay){
this.$emit("getResult",scanResult, this.managementPrecision);
uni.hideLoading()
}else{
this.checkPackage(scanResult);
}
} else {
uni.hideLoading();
var hint = getListLocationAreaTypeDesc(this.fromLocationAreaTypeList);
this.showErrorMessage("扫描库位[" + this.fromLocationCode + "]是[" +
getLocationAreaTypeName(result.areaType) + "],需要的库区是[" + hint + "]")
}
} else {
uni.hideLoading();
this.showErrorMessage("扫描库位[" + this.fromLocationCode + "]不可用", res => {
this.locationGetFocus();
})
}
} else {
uni.hideLoading();
this.showErrorMessage('未查询到库位[' + this.fromLocationCode + ']', res => {
this.locationGetFocus();
})
}
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error, res => {
this.locationGetFocus();
})
})
},
getScanResult(result,businessType) {
// console.log("", result)
// if (this.fromLocationCode == '' || this.fromLocationCode == null) {
// this.showMessage('', callback => {
// this.locationGetFocus();
// })
// return;
// } else
//
if(businessType){
this.businessType = businessType;
this.fromInventoryStatuses = getDirectoryItemArray(this.businessType.outInventoryStatuses)
this.inventoryStatus = getDirectoryItemArray(this.businessType.outInventoryStatuses); //
this.fromLocationAreaTypeList = getDirectoryItemArray(this.businessType.outAreaTypes); //
}
this.scanLocation(result);
// debugger
// if(this.isCheck){
// this.checkPackage(result);
// }
},
async checkPackage(result) {
if (result.label != null) {
this.scanResult = result;
if (this.queryBalance == true) {
// uni.showLoading({
// title: '...',
// mask: true
// })
// -- fromInventoryStatuses
//
await getBalanceByManagementPrecisionByPacking(result.label, result.package, this.fromLocationCode, this
.balanceFromInventoryStatuses ? this.fromInventoryStatuses : undefined,
res => {
uni.hideLoading();
if (res.success) {
this.managementPrecision = res.managementPrecision
if (this.managementPrecision == 'BY_BATCH') {
res.data.list.forEach(item => {
item.packingNumber = ''
})
}
this.chooseWhich = '2'
if(!result.label.itemCode){
this.showErrorMessage('扫描标签不对,请重新扫描')
return
}
if (res.data && res.data.list && res.data.list.length > 1) {
this.showBalanceSelect(res.data.list);
} else {
this.afterQueryBalance(res.data.list);
}
} else {
this.showErrorMessage(res.message, res => {
this.packGetFocus();
})
}
// uni.hideLoading();
});
} else {
uni.hideLoading();
this.packCallBack(null);
}
}
},
afterQueryBalance(datas) {
if (this.allowNullBalance) {
this.allowNoneBalance(datas);
} else if (this.noShowBalanceMessage) {
if (this.isCount) {
this.countCallBack(datas);
} else {
if (Array.isArray(datas)) {
this.countCallBack(datas[0]);
} else {
this.countCallBack(datas);
}
}
} else {
this.mustHavaBalance(datas);
}
uni.hideLoading();
},
//
async allowNoneBalance(datas) {
if (datas.length == 0) {
await this.packCallBack(null);
} else {
this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],已经查找到该包装的库存记录,请重新扫描', res => {
this.packGetFocus();
})
}
},
//
mustHavaBalance(datas) {
if (datas.length == 0) {
this.showErrorMessage(this.getQueryCondition() + '\n未查找到库存记录', res => {
this.$emit('clearItemCode',this.scanResult)
this.packGetFocus();
})
} else if (datas.length == 1) {
let balance = datas[0];
this.packCallBack(balance);
// 20231228
// if (balance.qty > 0) {
// this.packCallBack(balance);
// } else {
// this.showErrorMessage(this.getQueryCondition() + '\n[' + balance.qty + "],\n",
// res => {
// this.packGetFocus();
// })
// }
} else {
this.showBalanceSelect(datas);
this.chooseWhich = '1'
}
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
selectBalanceItem(balance) {
if (this.chooseWhich == 1) {
this.packCallBack(balance);
} else {
this.countCallBack(balance);
}
// this.packCallBack(balance);
// 20231228
// if (balance.qty > 0) {
// this.packCallBack(balance);
// } else {
// this.showErrorMessage(this.getQueryCondition() + '\n[' + balance.qty + "],",
// res => {
// this.packGetFocus();
// })
// }
},
//
countCallBack(datas) {
if (this.$refs.comscan) {
this.$refs.comscan.clear();
}
//
let data = {
label: this.scanResult.label,
package: this.scanResult.package,
fromWarehouseCode:this.fromWarehouseCode,
balance: datas,
fromLocationCode: this.fromLocationCode,
}
// this.packGetFocus();
//
if (this.managementPrecision == 'BY_BATCH'||this.managementPrecision == 'BY_QUANTITY') {
this.$emit("getResult", data, this.managementPrecision);
} else {
this.$emit("getResult", data);
}
this.$emit("getCountScanResult", data);
},
async packCallBack(item) {
if (this.$refs.comscan) {
this.$refs.comscan.clear();
}
//
let data = {
label: this.scanResult.label,
package: this.scanResult.package,
fromWarehouseCode:this.fromWarehouseCode,
balance: item,
fromLocationCode: this.fromLocationCode,
}
this.packGetFocus();
//
if (this.managementPrecision == 'BY_BATCH'||this.managementPrecision == 'BY_QUANTITY') {
this.$emit("getResult", data, this.managementPrecision);
} else {
this.$emit("getResult", data);
}
},
packGetFocus() {
if (this.$refs.comscan) {
this.$refs.comscan.getfocus();
}
},
packLoseFocus() {
if (this.$refs.comscan) {
this.$refs.comscan.losefocus();
}
},
locationGetFocus() {
this.fromLocationCode = '';
this.locationOnFocus = true;
},
getQueryCondition() {
let condition = '按照以下条件:\n';
let label = this.scanResult.label;
var isShowStatus = this.balanceFromInventoryStatuses ? this.fromInventoryStatuses : undefined
let status = ""
if (isShowStatus) {
status = getInventoryStatusDesc(isShowStatus);
}
switch (this.managementPrecision) {
case 'BY_PACKAGING':
condition = condition + '物料号=[' + label.itemCode + ']\n箱码=[' + label.packingNumber +
']\n批次=[' +
label.batch +
']\n库位=[' + this.fromLocationCode + ']'
break;
case 'BY_BATCH':
condition = condition + '物料号=[' + label.itemCode + ']\n批次=[' +
label.batch +
']\n库位=[' + this.fromLocationCode + ']'
break;
case 'BY_QUANTITY':
condition = condition + '物料号=[' + label.itemCode + ']\n库位=[' + this.fromLocationCode + ']'
break;
case 'BY_UNIQUEID':
condition = condition + '物料号=[' + label.itemCode + ']'
break;
}
if (status) {
condition = condition + '\n库存状态=[' + status + ']'
}
return condition;
},
showMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showMessage(message, callback);
})
},
showErrorMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showErrorMessage(message, callback)
})
},
change(e) {
this.show = e.show
},
isInLocationList(location) {
var item = this.fromLocationList.find(res => res == location)
if (item = undefined) {
return false
}
return true
},
addLocationCode(code) {
if (!this.isInLocationList(code)) {
this.fromLocationList.push(code)
}
}
}
}
</script>
<style lang="scss">
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
</style>

58
src/pages/issueSupplies/coms/comIssueDetailCardBatch.vue

@ -0,0 +1,58 @@
<template>
<view>
<view style="padding: 10rpx;" :class="dataContent.scaned?'scan_view':''">
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowBalanceQty='false'></item-qty>
</view>
</view>
<comMessage ref="message"></comMessage>
</template>
<script>
import itemQty from '@/mycomponents/item/itemQty.vue'
export default {
emits: ['updateData', "removeItemCode"],
components: {
itemQty,
},
props: {
dataContent: {
type: Object,
default: {}
},
settingParam: {
type: Object,
default: {}
},
isEdit: {
type: Boolean,
default: true
},
isShowPackingNumberProps: {
type: Boolean,
default: true
},
},
watch: {
},
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>
<style>
</style>

57
src/pages/issueSupplies/coms/comIssueJobCard.vue

@ -0,0 +1,57 @@
<template>
<job-com-main-card :dataContent="dataContent" :isShowPlanNumber='true'>
<jobComMainDetailCard :dataContent="dataContent" :isShowGoodsShelves='isShowGoodsShelves' :isShowToLocation='false' ></jobComMainDetailCard>
<view class="task_item" style="margin-left: 15px;">
<view class="task_text">
<text class="card_business ">生产线</text>
<text class="card_content ">{{dataContent.detailProductionLineCode}}</text>
</view>
</view>
<view class="task_item" style="margin-left: 15px;">
<view class="task_text">
<text class="card_packing_code ">工位</text>
<text class="card_content ">{{dataContent.detailWorkStationCode}}</text>
</view>
</view>
<view class='split_line' v-show="dataContent.acceptUserName"></view>
<jobAccept :dataContent="dataContent" v-show="dataContent.acceptUserName"></jobAccept>
</job-com-main-card>
</template>
<script>
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue'
import jobComMainDetailCard from '@/mycomponents/job/jobComMainDetailCard.vue'
import jobAccept from '@/mycomponents/job/jobAccept.vue'
export default {
components: {
jobComMainCard,
jobComMainDetailCard,
jobAccept
},
data() {
return {};
},
props: {
dataContent: {
type: Object,
default: {}
},
isShowGoodsShelves:{
type:Boolean,
default:false
}
},
methods: {
}
}
</script>
<style lang="scss">
</style>

58
src/pages/issueSupplies/coms/jobInfoPopup.vue

@ -0,0 +1,58 @@
<template>
<view class="">
<uni-popup ref="popup">
<job-common-info :dataContent="dataContent" @onClose="closePopup">
<view class="">
<view class="uni-flex uni-column">
<view class="item">
<text class="item_title">车间代码 : </text>
<text class="text_wrap">{{dataContent.WorkshopCode}} </text>
</view>
<view class="item">
<text class="item_title">使用在途库 : </text>
<text class="text_wrap">{{dataContent.UseOnTheWayLocation}} </text>
</view>
</view>
</view>
</job-common-info>
</uni-popup>
</view>
</template>
<script>
import jobCommonInfo from '@/mycomponents/job/jobCommonInfo.vue'
export default {
components: {
jobCommonInfo,
},
data() {
return {
dataContent: {
type: Object,
default: {}
}
}
},
mounted() {},
props: {},
methods: {
openPopup(val) {
this.dataContent = val;
setTimeout(res=>{
this.$refs.popup.open('bottom')
},300)
},
closePopup() {
this.$refs.popup.close()
},
}
}
</script>
<style>
</style>

46
src/pages/issueSupplies/coms/jobListPopup.vue

@ -0,0 +1,46 @@
<template>
<uni-popup ref="popupItems">
<com-popup @onClose="closePopup">
<view v-for="(item, index) in receiptList" :key="index">
<com-issue-job-card :dataContent="item" @click='selectItem(item)'></com-issue-job-card>
<view class='split_line'></view>
</view>
</com-popup>
</uni-popup>
</template>
<script>
import comPopup from '@/mycomponents/common/comPopup.vue'
import comIssueJobCard from '@/pages/issue/coms/comIssueJobCard.vue'
export default {
emits: ["selectedItem"],
components: {
comPopup,
comIssueJobCard
},
props: {
},
data() {
return {
receiptList: []
}
},
methods: {
openPopup(items) {
this.receiptList = items;
this.$refs['popupItems'].open("center");
},
closePopup() {
this.$refs.popupItems.close()
},
selectItem(item) {
this.$emit("selectedItem", item);
this.$refs['popupItems'].close();
},
}
}
</script>
<style>
</style>

552
src/pages/issueSupplies/job/issueDetailBatch.vue

@ -0,0 +1,552 @@
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header-view">
<view class="header_job_top">
<job-top :dataContent="jobContent" :isShowPlanNumber='true'></job-top>
</view>
<work-station :workshopCode="jobContent.workShopCode"
:productionLineCode="jobContent.detailProductionLineCode"
:workStationCode="jobContent.detailWorkStationCode"
:rawLocationCode="jobContent.detailToLocationCode"
:itemGroup="jobContent.itemGroup" :isShowItemGroup='false'>
</work-station>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource.subList">
<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>
<winScanPackAndLocationNoShow :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode"
ref="scanPopup" @getResult='getScanResult' :noShowBalanceMessage="false" :title="'补给品标签'" headerType="HEQ"></winScanPackAndLocationNoShow>
<balance-select ref="balanceSelect" ></balance-select>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
takeIssueJob,
cancleTakeIssueJob,
getIssueJobDetail,
issueJobSubmit,
issueCheck,
getBalanceByFilter
} from '@/api/request2.js';
import {
goHome,
navigateBack,
getRemoveOption,
getCurrDateTime,
getDirectoryItemArray,
getPackingNumberAndBatch,
deepCopyData,
compareAsc,
} from '@/common/basic.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import {
calc
} from '@/common/calc.js';
import {
getDataSource,
getTreeDataSource,
calcTreeHandleQty,
getScanCount,
getThreeDataSource
} from '@/common/detail.js';
import {
calcHandleQtyAdd
} from '@/common/record.js';
import {
getBusinessType
} from '@/common/record.js';
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comIssueDetailCardBatch from '@/pages/issueSupplies/coms/comIssueDetailCardBatch.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import workStation from '@/mycomponents/workStation/workStation.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winScanPackAndLocationNoShow from "@/mycomponents/scan/winScanPackAndLocationNoShow.vue"
export default {
name: 'issueSuppliesDetail',
components: {
jobDetailPopup,
winScanButton,
jobTop,
workStation,
balanceSelect,
comIssueDetailCardBatch,
winScanPackAndLocationNoShow
},
data() {
return {
id: '',
jobContent: {}, //
subList: [], //subList
detailSource:{}, //
detailOptions: [],
scanOptions: [],
jobStatus: "",
scanMessage: '',
managementList: [],
managementType: "",
fromLocationCode:'',
str1:''
};
},
props: {
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title + '详情'
});
this.id = option.id;
this.scanMessage = option.scanMessage || '';
if (this.id != undefined) {
//
if (option.status == "1") {
this.receive((callback => {
this.getDetail();
}));
} else {
this.getDetail();
}
}
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {
//
if (e.from === 'backbutton') {
if (this.jobStatus == "2") {
//
cancleTakeIssueJob(this.id).then(res => {
uni.navigateBack();
}).catch(error => {
uni.navigateBack();
})
} else {
uni.navigateBack();
}
return true;
}
},
watch: {
locationTypes(newVal) {
let value = newVal;
},
},
mounted: function() {
},
methods: {
//
receive(callback) {
if (this.id != null) {
takeIssueJob(this.id).then(res => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}
},
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getIssueJobDetail(that.id).then(res => {
uni.hideLoading();
if (res.data == null) {
that.showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
// res.data.allowModifyLocation = 'FALSE'
that.jobContent = res.data;
that.jobStatus = res.data.status
that.subList = res.data.subList;
that.detailSource = res.data
that.jobContent.detailToLocationCode = res.data.subList[0].toLocationCode
that.toLocationCode= res.data.subList[0].toLocationCode
that.fromLocationCode = that.subList[0].fromLocationCode
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
closeScan() {
},
getScanResult(result) {
console.log(333,result)
let label = result.label;
var qty = label.qty;
var itemCode = label.itemCode;
var fromLocationCode = label.location;
console.log( this.detailSource)
console.log( fromLocationCode)
var detail = this.detailSource.subList.find(r => r.itemCode == itemCode &&r.fromLocationCode == fromLocationCode);
if (detail == undefined) {
this.showErrorMessage("物料【" + itemCode + "】来源库位【" + fromLocationCode + "】不在列表中")
} else {
if(detail.scaned == true){
this.showErrorMessage("物料【" + itemCode + "】已经扫描")
return
}
if(qty>result.balance.qty){
this.showErrorMessage("物料【" + itemCode + "】库存不足")
return
}
detail.scaned = true
}
},
//
continueScan() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
} else {
this.scanPopupGetFocus();
}
},
submit() {
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.toLocationCode
this.detailSource.forEach(toLocation => {
itemCodes.push(toLocation.itemCode)
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
submitJob() {
var params = this.setParams()
// if (!params.subList || params.subList.length == 0) {
// uni.hideLoading()
// this.showErrorMessage("")
// return
// }
const isTrue = params.subList.some(item=>{
return item.recordList.some(cur=>cur.scaned) == true
})
if(!isTrue){
uni.hideLoading()
this.showErrorMessage("请扫描您需要提交的发料任务")
return
}
console.log("提交参数", params);
issueJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成发料记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
setParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => {
let arr = []
toLocationCode.subList.forEach(record=>{
if(record.scaned){
let obj = {...toLocationCode,...record}
obj.recordList = []
delete obj.balance
delete obj.subList
let obj1 ={}
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 =record.packingNumber;
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)
}
})
})
this.jobContent.subList = subList
this.jobContent.creator = creator;
return this.jobContent;
},
cancel() {
let that = this;
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => {
if (res) {
that.clearInfo();
}
});
},
clearInfo() {
this.dataContent.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;
})
}
})
}
})
}
})
},
updateData(record) {
this.detailSource.forEach(item=>{
item.handleQty = 0
item.subList.forEach(cur=>{
item.handleQty = calc.add(cur.handleQty,item.handleQty)
})
})
},
afterScan() {
// this.autoCommit()
},
async autoCommit(){
const array = this.detailSource.subList.filter(detail=>detail.scaned)
if(array.length < this.detailSource.subList.length){
this.showErrorMessage('任务明细为全部完成,无法提交')
return
}
let index = 0
await this.recursion(index)
if(this.str1){
console.log(this.str1)
}
},
async recursion(index){
let filters = []
filters.push({
column: "itemCode",
action: "==",
value: this.detailSource.subList[index].itemCode
})
filters.push({
column: "locationCode",
action: "==",
value: this.detailSource.subList[index].fromLocationCode
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
await getBalanceByFilter(params).then(res => {
const balance = res.data.list[0]
if(this.detailSource.subList[index].qty>balance.qty){
this.str1 += "物料【" + itemCode + "】、"
}
index++;
if(index < this.detailSource.subList.length){
this.recursion(index)
}else{
if(this.str1){
this.str1 = this.str1.substring(0,this.str1.length - 1)
this.showErrorMessage(`${str1}库存不足`)
}else{
this.submit()
}
}
}).catch(err => {
this.showErrorMessage(err.message);
})
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
showCommitSuccess() {
this.$refs.comMessage.showCommitSuccess();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
showRescanMessage(message) {
this.$refs.comMessage.showRescanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
confirm(data) {
this.dataContent = data;
},
confirmResult(result) {
this.dataContent = result;
this.$forceUpdate();
},
openScanPopup() {
this.$refs.scanPopup.openScanPopupForJob(this.jobContent);
},
closeScanPopup() {
// this.updateCommitBtn();
},
confirmFromLocation(fromLocationCodeParams){
this.fromLocationCode = 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>

635
src/pages/issueSupplies/job/issueJob.vue

@ -0,0 +1,635 @@
<template>
<view class="">
<com-empty-view v-if="jobList.length==0"></com-empty-view>
<job-filter :isShowFromLocationCode="false" :isWorkStationCode='true' :isShowFromAreaCode="false" :isShowToAreaCode="false"
:isShowProductionLineCode="true"
:productionline="productionlineList"
ref="filter" otherTitle="" :isShowItemCode="true"
@onQuery="getListByFilter" :isShowQurery='true'>
</job-filter>
<view v-if="jobList.length>0">
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item
:right-options="item.status=='2'?detailGiveupOptions:item.status=='1'?detailCloseOptions:detailOptions"
@click="swipeClick($event,item)">
<com-issue-job-card :dataContent="item" @click.stop='openJobDetail(item)' :isShowGoodsShelves='true'></com-issue-job-card>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref='jobInfoPopup'></job-info-popup>
<uni-load-more :status="loadingType" v-if="jobList.length>0" />
</view>
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button>
<!-- <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance> -->
<winScanPackJob title='备料计划单号' ref="scanPopup" @getResult='getScanResult'></winScanPackJob>
<jobList ref="jobList" @selectItem="selectItem"></jobList>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
cancleTakeIssueJob,
getIssueSuppliesList,
getIssueJobByProductionline,
closeTakeIssueJob
} from '@/api/request2.js';
import {
goHome,
updateTitle
} from '@/common/basic.js';
import {
getBusinessType
} from '@/common/record.js';
import {
planRefreshTime,
issueJobFilter
} from '@/common/config.js';
import {
getDetailOption,
getDetailGiveupOption,
getDetailCloseOption
} from '@/common/array.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comIssueJobCard from '@/pages/issueSupplies/coms/comIssueJobCard.vue'
import jobListPopup from '@/pages/issueSupplies/coms/jobListPopup.vue'
import jobInfoPopup from '@/pages/issueSupplies/coms/jobInfoPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue"
import jobList from '@/mycomponents/jobList/jobList.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
export default {
name: 'issueSupplies',
components: {
comEmptyView,
jobFilter,
comIssueJobCard,
jobListPopup,
jobInfoPopup,
winScanPackJob,
winScanButton,
jobList,
winComScanBalance
},
data() {
return {
jobList: [],
pageNo: 1,
pageSize: 10,
totalCount: 0,
loadingType: "nomore",
checkedToday: false,
checkedWaitTask: false,
todayTime: "",
status: '1,2', //
detailOptions: [],
detailGiveupOptions: [],
productionlineList: [],
detailCloseOptions: [],
title: '',
productionLine: "",
fromLocation: "",
fromAreaCode: '', //
toAreaCode: '', //
filterItemCode: "",
businessTypeCode: "Issue",
businessType: null,
timer: null,
productionLineCode:"",
manageModel:import.meta.env.VITE_MANAGE_MODEL
};
},
onLoad(option) {
this.title = option.title
this.getIssueJobByProductionline()
},
onShow() {
this.getList('refresh')
},
onHide() {
// this.stopRefresh();
},
onUnload() {
// this.stopRefresh();
},
onReady() {
this.detailOptions = getDetailOption();
this.detailGiveupOptions = getDetailGiveupOption();
this.detailCloseOptions = getDetailCloseOption();
},
onReachBottom() {
//
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
}
this.getList('more')
},
onPullDownRefresh() {
this.getList('refresh')
},
//退
onBackPress(options) {
if (options.from === 'navigateBack') {
uni.navigateBack({
delta: 1
})
return false;
}
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
} else if (e.index == 1) {
this.$refs.filter.openFilterParams(uni.getStorageSync(issueJobFilter));
}
},
methods: {
timerRefresh() {
this.getList('refresh')
this.stopRefresh();
var that = this;
this.timer = setInterval(function() {
that.getList('refresh')
console.log('发料刷新');
}, planRefreshTime)
},
stopRefresh() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
getBusinessTypeFunc() {
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromInventoryStatuses = res.fromInventoryStatuses.split(',');
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
// this.openScanPopup();
this.$refs.scanPopup.openScanPopup(this.businessType);
} else {
this.showErrorMessage(res.message)
}
});
},
getIssueJobByProductionline() {
getIssueJobByProductionline().then(res => {
if (res.code == 0) {
this.productionlineList = res.data.map(item => ({
value: item.value,
text: item.name
}))
this.productionlineList.unshift({
value: "",
text: "全部"
})
} else {
this.productionlineList = []
}
})
},
getList(type) {
let that = this;
uni.showLoading({
title: "加载中­....",
mask: true
});
this.loadingType = "loading";
if (type === "refresh") {
this.pageNo = 1;
this.jobList = [];
}
var queryFiltersParams =this.setQueryParam()
var params = {
filters: queryFiltersParams,
pageNo: this.pageNo,
pageSize: this.pageSize,
}
console.log("查询条件",JSON.stringify(params))
getIssueSuppliesList(params).then(res => {
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
if(this.manageModel!='BY_BATCH'){
this.openScanPopup()
}
}
var list = res.data.list;
this.totalCount = res.data.total
updateTitle(this.title + "(" + this.totalCount + ")");
this.loadingType = "loadmore";
if (list == null || list.length == 0) {
this.loadingType = "nomore";
return;
}
this.jobList = type === "refresh" ? list : this.jobList.concat(list);
this.pageNo++;
if (type === "refresh") {
uni.stopPullDownRefresh();
}
}).catch(error => {
if (type === "refresh") {
uni.stopPullDownRefresh();
}
updateTitle(this.title);
this.loadingType = "";
uni.hideLoading();
that.showMessage(error)
})
},
setQueryParam() {
var filterParams = []
var queryParams=uni.getStorageSync(issueJobFilter)
// if(!queryParams){
// queryParams={
// }
// queryParams.status="1,2"
// }
//
if (queryParams.creationTime ) {
filterParams.push({
column: "create_time",
action: "between",
value: queryParams.creationTime
})
}
//
if (queryParams.status) {
filterParams.push({
column: "status",
action: "in",
value: queryParams.status
})
}else {
filterParams.push({
column: "status",
action: "in",
value: "1,2"
})
}
//线
if (queryParams.productionLineCode) {
filterParams.push({
column: "detailProductionLineCode",
action: "==",
value: queryParams.productionLineCode
})
}
//
if (queryParams.itemCode) {
filterParams.push({
column: "itemCode",
action: "like",
value: queryParams.itemCode
})
}
//
if (queryParams.workStationCode) {
filterParams.push({
column: "detailWorkStationCode",
action: "like",
value: queryParams.workStationCode
})
}
filterParams.push({
column: "source_type",
action: "==",
value: "EOP"
})
return filterParams;
},
getListByFilter(params) {
// this.productionLineCode =params.productionLineCode
uni.setStorageSync(issueJobFilter,params)
this.getList('refresh')
},
openJobDetail(item, scanMessage = '') {
this.getJobInfoByNumber(item, scanMessage)
},
showItemList(itemList) {
this.$refs.jobListPopup.openPopup(itemList);
},
selectedItem(item) {
this.openJobDetail(item);
},
selectItem(item) {
this.$refs.scanPopup.closeScanPopup();
this.openJobDetail(item, this.scanMessage);
},
swipeClick(e, dataContent) {
if (e.content.text == "详情") {
this.openjobInfoPopup(dataContent);
} else if (e.content.text == "放弃") {
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?",
res => {
if (res) {
this.cancleJob(dataContent.masterId);
}
});
} else if (e.content.text == "关闭") {
this.$refs.comMessage.showQuestionMessage("确定要关闭当前任务?",
res => {
if (res) {
this.closeJob(dataContent.masterId);
}
});
}
},
openjobInfoPopup(item) {
this.$refs.jobInfoPopup.openPopup(item)
},
cancleJob(id) {
cancleTakeIssueJob(id).then(res => {
if (res.data) {
this.getList('refresh')
uni.showToast({
title: "放弃任务成功"
})
} else {
this.showMessage("放弃任务失败")
}
}).catch(error => {
this.showMessage(error)
})
},
closeJob(id) {
uni.showLoading({
title: "加载中....",
mask: true
});
closeTakeIssueJob(id).then(res => {
uni.hideLoading()
if (res.data) {
this.getList('refresh')
uni.showToast({
title: "关闭任务成功"
})
} else {
this.showMessage("关闭任务失败")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
getJobInfoByNumber(item, scanMessage) {
let that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
var filters = []
filters.push({
column: "status",
action: "in",
value: '1,2'
})
filters.push({
column: "number",
action: "==",
value: item.number
})
filters.push({
column: "source_type",
action: "==",
value: "EOP"
})
var params = {
filters: filters,
pageNo: 1,
pageSize: this.pageSize,
}
getIssueSuppliesList(params).then(res => {
uni.hideLoading();
if (res.data.list.length == 0) {
that.showMessage('未查找到' + '【' + number + '】的发料任务');
} else {
var result = res.data.list[0];
if (result.acceptUserId && result.acceptUserId != this.$store.state.user.id) {
this.$refs.comMessage.showErrorMessage("任务号[" + result.number + "]已经被[" + result
.acceptUserName + "]承接,无法执行", res => {
if (res) {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus()
}
this.getList('refresh')
}
});
return;
}
uni.navigateTo({
url: './issueDetailBatch?id=' + result.id + '&status=' + result.status +
'&scanMessage=' +
scanMessage + '&title=' + this.title
});
this.scanMessage = ""
}
}).catch(error => {
uni.hideLoading();
that.showMessage(error);
})
},
showMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus()
}
}
});
},
openScanPopup() {
if (this.businessType == null) {
this.getBusinessTypeFunc()
} else {
this.$refs.scanPopup.openScanPopup(this.businessType);
}
},
getScanResult(result) {
console.log(result)
uni.showLoading({
title:"查询中",
mask:true
})
var filters = [{
column: "status",
action: "in",
value: '1,2'
},
{
column: "preparetoissuePlanNumber",
action: "==",
value: result.label.code
},
]
getIssueSuppliesList({
filters: filters,
pageNo: 1,
pageSize: 1000,
sort: 'createTime',
by: 'asc'
}).then(res => {
this.scanMessage = result.scanMessage
let resultList = res.data.list;
if (resultList.length > 0) {
uni.hideLoading()
resultList.forEach(item => {
item.title = item.number;
item.selected = false
})
let list = []
resultList.forEach(item => {
if (!list.find(subItem => subItem.title == item.title)) {
list.push(item)
}
})
if (list.length > 0) {
this.selectItem(list[0])
}
} else {
this.queryByItemCode(result)
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error + "\n扫描[" + result.scanMessage + "]")
})
},
//
queryByItemCode(result) {
let balance = result.balance;
if (balance != null) {
this.scanMessage = ""
if (!result.label.batch) {
this.showMessage("批次为空")
return;
}
if (!result.label.itemCode) {
this.showMessage("物料号为空")
return;
}
var filters = [{
column: "status",
action: "in",
value: '1,2'
},
{
column: "itemCode",
action: "==",
value: result.label.itemCode
},
{
column: "fromLocationCode",
action: "==",
value: balance.locationCode
}
]
if(this.productionLineCode){
filters.push({
column: "productionLineCode",
action: "==",
value: this.productionLineCode
})
}
getIssueSuppliesList({
filters: filters,
pageNo: 1,
pageSize: 1000,
sort: 'createTime',
by: 'asc'
}).then(res => {
uni.hideLoading()
this.scanMessage = result.scanMessage
let resultList = res.data.list;
if (resultList.length > 0) {
resultList.forEach(item => {
item.title = item.number;
item.selected = false
})
let list = []
resultList.forEach(item => {
if (!list.find(subItem => subItem.title == item.title)) {
list.push(item)
}
})
if (list.length > 0) {
this.selectItem(list[0])
}
} else {
this.showMessage("按来源库位[" + balance.locationCode + "]批次[" + result.label.batch +
"]物料号[" + result.label.itemCode + "]未查找到任务\n" + "扫描[" + result
.scanMessage + "]")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error + "\n扫描[" + result.scanMessage + "]")
})
}
},
}
}
</script>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save