陈薪名
3 months ago
32 changed files with 3336 additions and 440 deletions
@ -0,0 +1,274 @@ |
|||||
|
<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=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" |
||||
|
:headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<!-- 模拟扫描功能 --> |
||||
|
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType" |
||||
|
:isShowHistory="false" :clearResult="true"></win-com-scan> |
||||
|
<comMessage ref="comMessage" @afterClose="getfocus"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
import { |
||||
|
getBalanceByFilter |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'winScanParentPackage', |
||||
|
components: { |
||||
|
winComScan, |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '箱标签' |
||||
|
}, |
||||
|
isShowHistory: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
headerType: { |
||||
|
type: String, |
||||
|
default: 'HPQ,HMQ' |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
show: false, |
||||
|
businessType: null |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
simulateScan(item) { |
||||
|
this.$refs.comscansimulate.setItemCodeSimulate(item.copyContent) |
||||
|
this.$refs.comscansimulate.clickScanMsg(); |
||||
|
}, |
||||
|
openScanPopup() { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
setTimeout(res => { |
||||
|
this.getfocus() |
||||
|
}, 500) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
openScanPopupByBusinessType(businessType) { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
setTimeout(res => { |
||||
|
this.getfocus() |
||||
|
this.businessType = businessType; |
||||
|
}, 500) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.losefocus() |
||||
|
this.$refs.popup.close(); |
||||
|
this.$emit("close", ''); |
||||
|
}, |
||||
|
|
||||
|
scanClick() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.clickScanMsg(); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
cancelClick() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.clearScanValue(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
if (result.success) { |
||||
|
this.getBalance(result, res => { |
||||
|
result.balance = res; |
||||
|
this.$emit("getResult", result); |
||||
|
}) |
||||
|
} else { |
||||
|
this.showMessage(result.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getParams(label) { |
||||
|
let filters = [{ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: label.itemCode |
||||
|
}, { |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: label.batch |
||||
|
}]; |
||||
|
if (this.businessType.outInventoryStatuses != null) { |
||||
|
filters.push({ |
||||
|
column: "inventoryStatus", |
||||
|
action: "in", |
||||
|
value: this.businessType.outInventoryStatuses |
||||
|
}) |
||||
|
} |
||||
|
if (this.businessType.outAreaTypes != null) { |
||||
|
filters.push({ |
||||
|
column: "areaType", |
||||
|
action: "in", |
||||
|
value: this.businessType.outAreaTypes |
||||
|
}) |
||||
|
} |
||||
|
if (this.businessType.outAreaCodes != null) { |
||||
|
filters.push({ |
||||
|
column: "areaCode", |
||||
|
action: "in", |
||||
|
value: this.businessType.outAreaCodes |
||||
|
}) |
||||
|
} |
||||
|
return filters; |
||||
|
}, |
||||
|
|
||||
|
getBalance(result, callback) { |
||||
|
let filters = []; |
||||
|
let packageInfo = result.package; |
||||
|
let comfilters = this.getParams(packageInfo); |
||||
|
let balance = { |
||||
|
parentBalance: {}, |
||||
|
childBalance: [] |
||||
|
}; |
||||
|
|
||||
|
let parentPackingNumber = packageInfo.parentNumber; |
||||
|
let childPackingNumber = packageInfo.number; |
||||
|
|
||||
|
//packageInfo.subList子包装数量大于0扫描的就是父包装 |
||||
|
//1.当扫描箱时,同时查询箱和托的库存 |
||||
|
if (parentPackingNumber) { |
||||
|
let packingNumber = parentPackingNumber + "," + childPackingNumber; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packingNumber |
||||
|
}) |
||||
|
} else { |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: childPackingNumber |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters = filters.concat(comfilters); |
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
res.data.list.forEach(r => { |
||||
|
if (packageInfo.parentNumber) { |
||||
|
r.parentPackingNumber = parentPackingNumber |
||||
|
} else { |
||||
|
r.parentPackingNumber = childPackingNumber |
||||
|
} |
||||
|
}) |
||||
|
//如果扫描的是托标签,按托标签没查找到库存再按托标签下的子标签查询库存 |
||||
|
if (packageInfo.subList.length > 0) { |
||||
|
let packparams = ''; |
||||
|
packageInfo.subList.forEach(pack => { |
||||
|
packparams = packparams + pack.number + ',' |
||||
|
}) |
||||
|
packparams = packparams.trimEnd(','); |
||||
|
filters = []; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packparams |
||||
|
}) |
||||
|
filters = filters.concat(comfilters); |
||||
|
params.filters = filters; |
||||
|
getBalanceByFilter(params).then(res1 => { |
||||
|
if (res1.data.list.length == 0) { |
||||
|
this.showErrorMessage('未查找到该包装的库存余额', res => { |
||||
|
this.packGetFocus(); |
||||
|
}) |
||||
|
} else { |
||||
|
res1.data.list.forEach(r => r.parentPackingNumber = childPackingNumber) |
||||
|
|
||||
|
balance.parentBalance = res.data.list.filter(r => r.packingNumber == |
||||
|
childPackingNumber) |
||||
|
balance.childBalance = res1.data.list; |
||||
|
|
||||
|
callback(balance); |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
this.showErrorMessage(err.message); |
||||
|
}) |
||||
|
} else { |
||||
|
//扫描的是子包装 |
||||
|
//扫描的是父包装,(新加的) |
||||
|
balance.childBalance = res.data.list.filter(r => r.packingNumber == childPackingNumber) |
||||
|
balance.parentBalance = res.data.list.filter(r => r.packingNumber == parentPackingNumber) |
||||
|
callback(balance); |
||||
|
} |
||||
|
|
||||
|
}).catch(err => { |
||||
|
this.showErrorMessage(err.message); |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
getfocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
losefocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message); |
||||
|
}, |
||||
|
change(e) { |
||||
|
this.show = e.show |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.losefocus() |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.getfocus(); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,732 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<uni-popup ref="popup" :maskClick='false'> |
||||
|
<view class=""> |
||||
|
<view class="popup_box"> |
||||
|
|
||||
|
<view class="pop_title uni-flex space-between"> |
||||
|
<view class="" style="font-size: 35rpx;"> |
||||
|
扫描箱码 |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" |
||||
|
@click="closeScanPopup()"></image> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
||||
|
headerType="HPQ,HMQ" :isShowHistory="false"> |
||||
|
</win-com-scan> |
||||
|
|
||||
|
<view style="width: 100%;"> |
||||
|
<view style="width: 100%;" v-if="issueRecord.length>0"> |
||||
|
<view class="uni-flex uni-row space-between u-col-center"> |
||||
|
<view class="" style="padding: 10rpx;"> |
||||
|
历史记录 |
||||
|
</view> |
||||
|
<view class="" style="padding-right: 10rpx;"> |
||||
|
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'> |
||||
|
</u-line> |
||||
|
<scroll-view scroll-y="true" class="scroll-view" |
||||
|
v-if="expand&&issueRecord.length>0"> |
||||
|
<view class="uni-flex u-col" v-for="(record,index) in issueRecord"> |
||||
|
<view style="width: 100%;"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,record,index)" |
||||
|
:right-options="scanOptions"> |
||||
|
<view style="padding: 0px 10px"> |
||||
|
<balance :dataContent="record" :isShowFromLocation="false" |
||||
|
:isShowStdPack="false"></balance> |
||||
|
</view> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<u-line class='line_color'></u-line> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
||||
|
<!-- 模拟扫描功能 --> |
||||
|
<!-- <win-com-scan v-show="false" ref="comscansimulate" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
||||
|
headerType="HPQ,HMQ" :isShowHistory="false"> |
||||
|
</win-com-scan> --> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
import balance from '@/mycomponents/balance/balance.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
import { |
||||
|
getWorkShopLineStation, |
||||
|
getBalanceByFilter, |
||||
|
getBalanceByParams, |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
uniqueArray |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getLabelInfo |
||||
|
} from '@/common/label.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
getBalanceByManagementPrecision |
||||
|
} from '@/common/balance.js'; |
||||
|
import { |
||||
|
getDirectoryItemArray |
||||
|
} from '../../../common/directory.js'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'winScanPack', |
||||
|
emits: ["afterScan", "closeScan"], |
||||
|
components: { |
||||
|
winComScan, |
||||
|
balance, |
||||
|
balanceQtyEdit, |
||||
|
balanceSelect |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: {}, |
||||
|
jobContent: {}, |
||||
|
expendIcon: 'arrow-down', |
||||
|
show: false, |
||||
|
scanList: [], |
||||
|
toLocation: null, |
||||
|
toLocationCode: '', |
||||
|
fromLocationList: [], |
||||
|
fromLocationCode: '', |
||||
|
fromLocation: null, |
||||
|
issueRecord: [], //发料历史 |
||||
|
expand: true, |
||||
|
scanOptions: {}, |
||||
|
editItem: {}, |
||||
|
positionInfo: "请选择位置", |
||||
|
positionList: [], |
||||
|
defaultValueList: [], |
||||
|
fromInventoryStatuses: "", |
||||
|
packageInfo: {}, |
||||
|
label: {}, |
||||
|
inputStyleObject: { |
||||
|
fontSize: "100rpx" |
||||
|
}, |
||||
|
bussinessCode: 'Issue', |
||||
|
toLocationAreaTypeList: [] |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
|
||||
|
}, |
||||
|
watch: {}, |
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getDetailEditRemoveOption(); |
||||
|
}, |
||||
|
methods: { |
||||
|
openScanPopupForJobSimulate(content, jobcontent, scanMessage) { |
||||
|
this.issueRecord = []; |
||||
|
this.dataContent = content; |
||||
|
this.jobContent = jobcontent; |
||||
|
this.initData(); |
||||
|
getLabelInfo(scanMessage, "HPQ,HMQ", callback => { |
||||
|
if (callback.success) { |
||||
|
this.onScan(callback); |
||||
|
} else { |
||||
|
this.showErrorMessage(callback.message, res => {}) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
openScanPopup(content, jobcontent) { |
||||
|
this.issueRecord = []; |
||||
|
this.dataContent = content; |
||||
|
this.jobContent = jobcontent; |
||||
|
this.initData(); |
||||
|
// this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode + |
||||
|
// "-" + this.jobContent.subList[0].workStationCode |
||||
|
this.$refs.popup.open('bottom') |
||||
|
setTimeout(res => { |
||||
|
this.getfocus(); |
||||
|
}, 500) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.losefocus() |
||||
|
this.$refs.popup.close(); |
||||
|
this.$emit("closeScan") |
||||
|
//清除数据,恢复默认值 |
||||
|
// Object.assign(this.$data, this.$options.data()); |
||||
|
}, |
||||
|
|
||||
|
initData() { |
||||
|
let that = this; |
||||
|
that.fromLocationList = []; |
||||
|
if (that.dataContent != null) { |
||||
|
that.fromInventoryStatuses = this.jobContent.outInventoryStatuses |
||||
|
that.toLocation = that.dataContent[0]; |
||||
|
that.toLocationCode = that.dataContent[0].toLocationCode; |
||||
|
that.toLocationAreaTypeList = getDirectoryItemArray(this.jobContent.toAreaTypes) |
||||
|
// that.fromLocationList = that.getFromLocationList(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
showBalanceSelect(items) { |
||||
|
this.$refs.balanceSelect.openPopup(items); |
||||
|
}, |
||||
|
|
||||
|
// getFromLocationList() { |
||||
|
// let list = []; |
||||
|
// this.dataContent.forEach(location => { |
||||
|
// location.Items.forEach(item => { |
||||
|
// item.Locations.forEach(f => { |
||||
|
// let item = list.find(l => l == f.fromLocationCode); |
||||
|
// if (item == undefined) { |
||||
|
// list.push(f.fromLocationCode) |
||||
|
// } |
||||
|
// }) |
||||
|
// }) |
||||
|
// }); |
||||
|
// //去掉重复库位 |
||||
|
// list = uniqueArray(list); |
||||
|
// this.fromLocationCode = list[0]; |
||||
|
// return list; |
||||
|
// }, |
||||
|
|
||||
|
fromLocationUpdate(fromlocation) { |
||||
|
let location = this.fromLocationList.find(r => r == fromlocation) |
||||
|
if (location == undefined) { |
||||
|
this.fromLocationCode = '' |
||||
|
this.showErrorMessage('发料库位【' + fromlocation + '】不存在') |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
queryBalance(result) { |
||||
|
try { |
||||
|
let that = this; |
||||
|
let packageInfo = result.package; |
||||
|
let itemCode = result.label.itemCode; |
||||
|
let packingCode = result.label.packingNumber; |
||||
|
let lot = result.label.batch; |
||||
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
||||
|
if (item == undefined) { |
||||
|
that.showErrorMessage('未查找到物料【' + itemCode + '】的发料明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
return; |
||||
|
} else { |
||||
|
|
||||
|
var params = { |
||||
|
itemCode: result.package.itemCode, |
||||
|
batch: result.label.batch, |
||||
|
packingNumber: result.label.packingNumber, |
||||
|
parentPackingNumber: result.package.parentNumber, |
||||
|
inventoryStatus: this.jobContent.outInventoryStatuses.split(','), |
||||
|
areaType: this.jobContent.fromAreaTypes.split(','), |
||||
|
bussinessCode: this.jobContent.businessType |
||||
|
} |
||||
|
uni.showLoading({ |
||||
|
title: '查询中', |
||||
|
mask: true |
||||
|
}) |
||||
|
getBalanceByParams(params).then(res => { |
||||
|
if (res.data.length == 0) { |
||||
|
var status = getInventoryStatusDesc(params.inventoryStatus) |
||||
|
var areaType = getListLocationAreaTypeDesc(params.areaType) |
||||
|
var hint = |
||||
|
"按物料号 [" + params.itemCode + "] \n" + |
||||
|
"包装号 [" + params.packingNumber + "] \n" + |
||||
|
"批次 [" + params.batch + "] \n" + |
||||
|
"状态 [" + status + "] \n" + |
||||
|
"库区 [" + areaType + "] \n" + |
||||
|
"未查找到库存余额" |
||||
|
this.showErrorMessage(hint, |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
}) |
||||
|
} else if (res.data.length == 1) { |
||||
|
result.balance = res.data[0] |
||||
|
|
||||
|
if (result.label.packingNumber != result.balance.packingNumber) { |
||||
|
result.balance.qty = Number(result.label.qty) |
||||
|
} else { |
||||
|
result.balance.qty = Number(result.balance.qty) |
||||
|
} |
||||
|
this.afterGetBalance(result.label, result.balance, result.package); |
||||
|
} else { |
||||
|
//多条记录 |
||||
|
this.$refs.balanceSelect.openPopup(res.data); |
||||
|
} |
||||
|
uni.hideLoading() |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error, |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.stack, res => { |
||||
|
that.getfocus(); |
||||
|
}) |
||||
|
uni.hideLoading(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
getBalance(label, packageInfo, callback) { |
||||
|
var filters = [] |
||||
|
if (packageInfo.parentNumber) { |
||||
|
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packingNumber |
||||
|
}) |
||||
|
} else { |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: label.packingNumber |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: label.itemCode |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: label.batch |
||||
|
}) |
||||
|
|
||||
|
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") { |
||||
|
filters.push({ |
||||
|
column: "inventoryStatus", |
||||
|
action: "in", |
||||
|
value: this.fromInventoryStatuses |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
callback(res.data) |
||||
|
}).catch(err => { |
||||
|
this.showErrorMessage(err.message); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
onScan(result) { |
||||
|
if (!result.package) { |
||||
|
this.showErrorMessage('扫描数据错误[' + result.label.code + "]", |
||||
|
res => { |
||||
|
this.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
return; |
||||
|
} |
||||
|
if (this.toLocation && result.package.packUnit) { |
||||
|
let item = this.toLocation.Items.find(r => r.itemCode == result.package.itemCode); |
||||
|
if (!item) { |
||||
|
this.showErrorMessage('扫描物料【' + result.package.itemCode + '】不属于该任务'); |
||||
|
return |
||||
|
} |
||||
|
if (result.package.packUnit !== item.packUnit) { |
||||
|
this.$refs.comMessage.showQuestionMessage( |
||||
|
`扫描物料包装【${result.package.packUnit}】与任务推荐包装规格【${item.packUnit}】不一致.是否要继续发料?`, res => { |
||||
|
if (res) { |
||||
|
this.getToLocationBalance(result) |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
this.getToLocationBalance(result) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//查询到目标库位的库存余额 |
||||
|
getToLocationBalance(result) { |
||||
|
uni.showLoading({ |
||||
|
title: '查询中', |
||||
|
mask: true |
||||
|
}) |
||||
|
var filters = [] |
||||
|
if (result.package.parentNumber) { |
||||
|
var packingNumber = result.package.parentNumber + "," + result.package.number; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packingNumber |
||||
|
}) |
||||
|
} else { |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: result.package.number |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: result.package.itemCode |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: result.package.batch |
||||
|
}) |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "areaType", |
||||
|
action: "in", |
||||
|
value: this.toLocationAreaTypeList.join(',') |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data.list.length > 0) { |
||||
|
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); |
||||
|
} else { |
||||
|
this.queryBalance(result); |
||||
|
} |
||||
|
// callback(res.data) |
||||
|
}).catch(err => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(err.message); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
selectBalanceItem(balance) { |
||||
|
this.afterGetBalance(this.label, balance, this.packageInfo); |
||||
|
}, |
||||
|
|
||||
|
afterGetBalance(label, balance, packageInfo) { |
||||
|
let that = this; |
||||
|
try { |
||||
|
let itemCode = label.itemCode; |
||||
|
let packingCode = label.packingNumber; |
||||
|
let lot = label.batch; |
||||
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
||||
|
that.fromLocationCode = balance.locationCode; |
||||
|
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); |
||||
|
if (fromLocation != undefined) { |
||||
|
let batch = fromLocation.Batchs.find(r => r.batch == lot); |
||||
|
if (batch != undefined) { |
||||
|
if (batch.Records == undefined) { |
||||
|
batch.Records = []; |
||||
|
} |
||||
|
|
||||
|
let record = batch.Records.find(r => r.packingNumber == packingCode); |
||||
|
if (record == undefined) { |
||||
|
//如果有推荐箱码 |
||||
|
if (batch.Recommends != undefined && batch.Recommends.length > 0) { |
||||
|
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode); |
||||
|
if (recommend != undefined) { |
||||
|
that.addRecord(batch, label, balance, packageInfo) |
||||
|
} else { |
||||
|
//允许修改箱码 |
||||
|
if (this.jobContent.allowModifyPackingNumber == 'TRUE') { |
||||
|
that.addRecord(batch, label, balance, packageInfo); |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
return; |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
that.addRecord(batch, label, balance, packageInfo) |
||||
|
} |
||||
|
that.$emit("afterScan"); |
||||
|
} else { |
||||
|
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
if (this.jobContent.allowModifyBatch == "TRUE") { |
||||
|
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot + |
||||
|
'】的发料明细,是否要继续发料?', res => { |
||||
|
if (res) { |
||||
|
let batch = that.createBatchInfo(label, balance, packageInfo); |
||||
|
//新增加的批次赋值details |
||||
|
if (fromLocation.Batchs.length > 0) { |
||||
|
batch.detail = fromLocation.Batchs[0].detail; |
||||
|
} |
||||
|
fromLocation.Batchs.unshift(batch); |
||||
|
that.$emit("afterScan"); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到批次【' + lot + '】的发料明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
let locaion = that.createLocationInfo(label, balance, packageInfo); |
||||
|
item.Locations.push(locaion); |
||||
|
} |
||||
|
} catch (e) { |
||||
|
that.showErrorMessage(e.stack, |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//增加实际扫描的明细 |
||||
|
createLocationInfo(label, balance, packageInfo) { |
||||
|
let location = { |
||||
|
fromLocationCode: balance.locationCode, |
||||
|
qty: balance.qty, |
||||
|
uom: balance.uom, |
||||
|
handleQty: 0, |
||||
|
Batchs: [] |
||||
|
} |
||||
|
let batch = this.createBatchInfo(label, balance, packageInfo); |
||||
|
batch.detail = balance; |
||||
|
batch.detail.fromLocationCode = balance.locationCode; |
||||
|
location.Batchs.push(batch); |
||||
|
return location; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
createBatchInfo(data, balance, packageInfo) { |
||||
|
let batch = { |
||||
|
batch: data.batch, |
||||
|
qty: 0, |
||||
|
uom: data.uom, |
||||
|
handleQty: Number(balance.qty), |
||||
|
Records: [] |
||||
|
} |
||||
|
let record = this.creatRecord(data, balance, packageInfo); |
||||
|
batch.Records.push(record); |
||||
|
this.issueRecord.unshift(record) |
||||
|
return batch; |
||||
|
}, |
||||
|
|
||||
|
creatRecord(label, balance, packageInfo) { |
||||
|
balance.packQty = packageInfo.packQty |
||||
|
balance.packUnit = packageInfo.packUnit |
||||
|
let record = { |
||||
|
scaned: true, |
||||
|
itemCode: label.itemCode, |
||||
|
packingNumber: label.packingNumber, |
||||
|
parentPackingNumber: packageInfo.parentNumber, |
||||
|
batch: label.batch, |
||||
|
// qty: Number(balance.qty), |
||||
|
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), |
||||
|
qty: Number(balance.qty), |
||||
|
handleQty: Number(balance.qty), |
||||
|
uom: balance.uom, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
balance: balance, |
||||
|
toLocationCode: this.toLocationCode, |
||||
|
supplierCode: label.supplierCode, |
||||
|
packUnit: packageInfo.packUnit, |
||||
|
packQty: packageInfo.packQty |
||||
|
} |
||||
|
|
||||
|
return record; |
||||
|
}, |
||||
|
|
||||
|
calcBatchHandleQty(batch) { |
||||
|
let handleQty = 0; |
||||
|
batch.Records.forEach(res => { |
||||
|
handleQty = calc.add(handleQty, res.qty) |
||||
|
}) |
||||
|
batch.handleQty = handleQty; |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
addRecord(batch, label, balance, packageInfo) { |
||||
|
let record = this.creatRecord(label, balance, packageInfo); |
||||
|
batch.Records.push(record); |
||||
|
this.issueRecord.unshift(record) |
||||
|
this.calcBatchHandleQty(batch); |
||||
|
this.getfocus(); |
||||
|
}, |
||||
|
|
||||
|
getfocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
losefocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
expands() { |
||||
|
this.expand = !this.expand; |
||||
|
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up" |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, item, index) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item, index) |
||||
|
} |
||||
|
}, |
||||
|
edit(item) { |
||||
|
this.editItem = item; |
||||
|
// item.balance.balanceQty = item.balance.qty; |
||||
|
item.balance.balanceQty = item.balance.qty; |
||||
|
this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty); |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.$refs.receiptHint.openScanPopup() |
||||
|
}, |
||||
|
remove(record, index) { |
||||
|
this.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
record.qty = 0; |
||||
|
this.issueRecord.splice(index, 1) |
||||
|
|
||||
|
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode); |
||||
|
|
||||
|
if (item != undefined) { |
||||
|
|
||||
|
item.Locations.forEach(l => { |
||||
|
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b |
||||
|
.batch == record.batch); |
||||
|
|
||||
|
if (batch && batch.Records && batch.Records.length > 0) { |
||||
|
let rIndex = batch.Records.findIndex(r => r.packingNumber == record |
||||
|
.packingNumber && r.batch == record.batch); |
||||
|
batch.Records.splice(rIndex, 1); |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
this.$emit('updateData', item); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
packGetFocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
packLoseFocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
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); |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
showQuestionMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.packLoseFocus(); |
||||
|
this.$refs.comMessage.showQuestionMessage(message, callback); |
||||
|
}) |
||||
|
}, |
||||
|
confirm(val) { |
||||
|
this.editItem.qty = Number(val); |
||||
|
this.$emit('updateData', this.editItem) |
||||
|
}, |
||||
|
cancle() { |
||||
|
this.closeScanPopup() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
button { |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
button::after { |
||||
|
border: none |
||||
|
} |
||||
|
|
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
padding: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.my-combox { |
||||
|
font-size: 50px; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,608 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-header"> |
||||
|
<view class="header-view"> |
||||
|
<view class="header_job_top"> |
||||
|
<job-top :dataContent="jobContent"></job-top> |
||||
|
</view> |
||||
|
<work-station :workshopCode="jobContent.workShopCode" |
||||
|
:productionLineCode="jobContent.detailProductionLineCode" |
||||
|
:workStationCode="jobContent.detailWorkStationCode" |
||||
|
:rawLocationCode="jobContent.detailToLocationCode"> |
||||
|
</work-station> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view v-for="(toLocation, index) in detailSource"> |
||||
|
<!-- <work-station :workshopCode="jobContent.workShopCode" |
||||
|
:productionLineCode="toLocation.productionLineCode" |
||||
|
:workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode"> |
||||
|
</work-station> --> |
||||
|
<com-issue-detail-card ref='comIssueDetailCard' :dataContent="toLocation" @updateData='updateData'> |
||||
|
</com-issue-detail-card> |
||||
|
<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='openScanDetailPopup'></win-scan-button> |
||||
|
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData' |
||||
|
@afterScan='afterScan'> |
||||
|
</com-scan-issue-pack> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
takeIssueJob, |
||||
|
cancleTakeIssueJob, |
||||
|
getIssueJobDetail, |
||||
|
issueJobSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
navigateBack, |
||||
|
getRemoveOption, |
||||
|
getCurrDateTime, |
||||
|
getDirectoryItemArray, |
||||
|
getPackingNumberAndBatch, |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDataSource |
||||
|
} from '@/pages/issue/js/issue.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
||||
|
import jobTop from '@/mycomponents/job/jobTop.vue' |
||||
|
import workStation from '@/mycomponents/workStation/workStation.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'issueDetail', |
||||
|
components: { |
||||
|
jobDetailPopup, |
||||
|
winScanButton, |
||||
|
comIssueDetailCard, |
||||
|
comScanIssuePack, |
||||
|
jobTop, |
||||
|
workStation, |
||||
|
balanceSelect |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
jobContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
jobStatus: "", |
||||
|
scanMessage: '' |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
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() { |
||||
|
// this.resizeCollapse(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
resizeCollapse() { |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.comIssueDetailCard.forEach(r => { |
||||
|
r.resizeCollapse(); |
||||
|
}) |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
//接收 |
||||
|
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) { |
||||
|
that.jobContent = res.data; |
||||
|
that.jobStatus = res.data.status |
||||
|
that.subList = res.data.subList; |
||||
|
that.detailSource = getDataSource(that.detailSource, that.subList) |
||||
|
that.jobContent.detailToLocationCode = res.data.subList[0].toLocationCode |
||||
|
//任务中已经扫描,模拟扫描赋值 |
||||
|
if (this.scanMessage) { |
||||
|
this.openScanPopupSimulate(this.scanMessage); |
||||
|
|
||||
|
} |
||||
|
setTimeout(r => { |
||||
|
that.resizeCollapse(); |
||||
|
}, 100) |
||||
|
// that.detailSource.forEach(r => { |
||||
|
// r.subList.forEach(s => { |
||||
|
// if (this.scanedPackingNumber && this.scanedPackingNumber == s |
||||
|
// .packingNumber) { |
||||
|
// s.scaned = true |
||||
|
// s.cancleScanedHiht = true |
||||
|
// //模拟扫描功能 |
||||
|
// this.openScanPopupSimulate(s); |
||||
|
// this.scanedPackingNumber = '' |
||||
|
// } |
||||
|
// }) |
||||
|
// }) |
||||
|
|
||||
|
} else { |
||||
|
that.showMessage('列表数据为0'); |
||||
|
} |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScan() { |
||||
|
this.resizeCollapse(); |
||||
|
}, |
||||
|
|
||||
|
// submit() { |
||||
|
//3.如果是按批次先进先出发料提交时如果扫描的箱码不是先进的批次,则报错 |
||||
|
//:请扫描XXX批次,改批次满足先进先出规则。否则可以直接提交 |
||||
|
// var isOutIn = getApp().globalData.feed_configList.filter( |
||||
|
// res => { |
||||
|
// if (res.name == 'feed_isOutIn') { |
||||
|
// return res; |
||||
|
// } |
||||
|
// }); |
||||
|
|
||||
|
|
||||
|
// this.dataContent.itemCodeList.forEach(res => { |
||||
|
// if (res.handleQty > res.recommendQty) { |
||||
|
// this.$refs.modal.showConfirmMessageModal('实际数量大于需求数量,是否提交?', confirm => { |
||||
|
// if (confirm) { |
||||
|
// //提交 |
||||
|
// uni.showToast({ |
||||
|
// title: "提交" |
||||
|
// }) |
||||
|
// } |
||||
|
// }) |
||||
|
// } else { |
||||
|
// uni.showToast({ |
||||
|
// title: "扫描的数量" + res.handleQty + "]小于推荐数量[" + res.recommendQty + "]" |
||||
|
// }) |
||||
|
// } |
||||
|
// }) |
||||
|
// }, |
||||
|
|
||||
|
submit() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
//目前任务只到一个库位 |
||||
|
var itemCodes = [] |
||||
|
let locationCode = this.detailSource[0].toLocationCode |
||||
|
this.detailSource.forEach(toLocation => { |
||||
|
toLocation.Items.forEach(item => { |
||||
|
itemCodes.push(item.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 |
||||
|
} |
||||
|
console.log("提交参数", JSON.stringify(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 createTime = getCurrDateTime(); |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(toLocationCode => { |
||||
|
toLocationCode.Items.forEach(item => { |
||||
|
item.Locations.forEach(fromLocation => { |
||||
|
fromLocation.Batchs.forEach(batch => { |
||||
|
let subItem = batch.detail; |
||||
|
if (subItem != undefined) { |
||||
|
subItem.recordList = []; |
||||
|
if (batch.Records.length > 0) { |
||||
|
batch.Records.forEach(r => { |
||||
|
let record = {}; |
||||
|
record.handleQty = r.qty; |
||||
|
|
||||
|
record.fromPackingNumber = r |
||||
|
.packingNumber; |
||||
|
record.fromBatch = r.batch; |
||||
|
record.fromContainerNumber = r |
||||
|
.ContainerNumber; |
||||
|
|
||||
|
record.toContainerNumber = r |
||||
|
.ContainerNumber; |
||||
|
record.toInventoryStatus = r |
||||
|
.inventoryStatus; |
||||
|
// record.toLocationCode = subItem |
||||
|
// .toLocationCode; |
||||
|
|
||||
|
record.toLocationCode = this.jobContent |
||||
|
.detailToLocationCode; |
||||
|
|
||||
|
record.supplierCode = r.supplierCode; |
||||
|
|
||||
|
let single_price = r.balance |
||||
|
.singlePrice == null ? 0 : r |
||||
|
.balance |
||||
|
.singlePrice; |
||||
|
|
||||
|
record.singlePrice = single_price; |
||||
|
record.amount = single_price * r.qty; |
||||
|
|
||||
|
//使用在途库不改变管理模式 |
||||
|
if (item.onTheWayLocationCode) { |
||||
|
record.toPackingNumber = r |
||||
|
.packingNumber; |
||||
|
record.toBatch = r.batch; |
||||
|
} else { |
||||
|
var info = |
||||
|
getPackingNumberAndBatch( |
||||
|
this.managementList, r |
||||
|
.itemCode, |
||||
|
r.packingNumber, r |
||||
|
.batch); |
||||
|
record.toPackingNumber = info |
||||
|
.packingNumber; |
||||
|
record.toBatch = info.batch; |
||||
|
} |
||||
|
record.fromParentPackingNumber = r |
||||
|
.parentPackingNumber; |
||||
|
subItem.recordList.push(record); |
||||
|
}) |
||||
|
subList.push(deepCopyData(subItem)); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
this.jobContent.subList = subList |
||||
|
this.jobContent.createTime = createTime; |
||||
|
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) { |
||||
|
console.log('updateData', record) |
||||
|
console.log('this.detailSource', this.detailSource) |
||||
|
|
||||
|
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); |
||||
|
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode); |
||||
|
let itemHandleQty = 0; |
||||
|
|
||||
|
if (item != undefined) { |
||||
|
item.Locations.forEach(l => { |
||||
|
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b |
||||
|
.packingNumber == null || b.packingNumber == '') && b.batch == record.batch); |
||||
|
let handleQty = 0; |
||||
|
|
||||
|
if (batch != undefined) { |
||||
|
batch.Records.forEach(res => { |
||||
|
handleQty = calc.add(handleQty, res.qty) |
||||
|
}) |
||||
|
batch.handleQty = handleQty; |
||||
|
itemHandleQty = calc.add(itemHandleQty, handleQty) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
this.resizeCollapse(); |
||||
|
item.handleQty = itemHandleQty; |
||||
|
}, |
||||
|
|
||||
|
afterScan() { |
||||
|
this.resizeCollapse(); |
||||
|
this.autoCommit() |
||||
|
}, |
||||
|
|
||||
|
autoCommit(){ |
||||
|
let str="" |
||||
|
var totalQty =0; |
||||
|
var taskQty =0; |
||||
|
this.detailSource.forEach(detail => { |
||||
|
detail.Items.forEach(item => { |
||||
|
taskQty =calc.add(taskQty,item.qty) |
||||
|
item.Locations.forEach(lco => { |
||||
|
lco.Batchs.forEach(batch => { |
||||
|
batch.Records.forEach(record => { |
||||
|
if (batch.qty != record.qty) { |
||||
|
var tempHandleQty = 0 |
||||
|
if (record.qty) { |
||||
|
tempHandleQty = record.qty |
||||
|
} else { |
||||
|
tempHandleQty = 0 |
||||
|
} |
||||
|
if (batch.qty != 0) { |
||||
|
str += |
||||
|
`包装号【${record.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${batch.qty}】不一致\n` |
||||
|
} |
||||
|
} |
||||
|
if(record){ |
||||
|
var hanleQty =record.qty?record.qty:0 |
||||
|
totalQty = calc.add(totalQty,hanleQty) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
if(str){ |
||||
|
str = '任务明细未全部完成,是否提交?\n' + str |
||||
|
} |
||||
|
if(totalQty!=taskQty){ |
||||
|
str ="扫描数量["+totalQty+"]与任务数量不一致["+taskQty+"],是否提交" |
||||
|
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => { |
||||
|
if (res) { |
||||
|
//防止重复点击 |
||||
|
this.$throttle(this.submit, 2000, this)() |
||||
|
} else { |
||||
|
this.scanPopupGetFocus() |
||||
|
} |
||||
|
}); |
||||
|
}else { |
||||
|
//防止重复点击 |
||||
|
this.$throttle(this.submit, 2000, this)() |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.comScanIssuePack) { |
||||
|
this.$refs.comScanIssuePack.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
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(); |
||||
|
}, |
||||
|
openScanDetailPopup() { |
||||
|
var datacontent = {} |
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
||||
|
// Object.assign(datacontent, this.detailSource); |
||||
|
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent); |
||||
|
}, |
||||
|
|
||||
|
openScanPopupSimulate(scanMessage) { |
||||
|
this.$refs.comScanIssuePack.openScanPopupForJobSimulate(this.detailSource, this.jobContent, scanMessage); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.updateCommitBtn(); |
||||
|
}, |
||||
|
} |
||||
|
}; |
||||
|
</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> |
@ -0,0 +1,746 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
||||
|
<job-filter :isShowFromLocationCode="true" :isShowFromAreaCode="true" :isShowToAreaCode="true" :isShowProductionLineCode="true" :productionline="productionlineList" |
||||
|
ref="filter" otherTitle="" |
||||
|
:checkedToday="checkedToday" |
||||
|
:checkedWaitTask="checkedWaitTask" |
||||
|
@switchChangeWait="switchChangeWait" |
||||
|
@switchChangeToday="switchChangeToday" |
||||
|
:isShowItemCode="true" @onQuery="getListByFilter" :isShowQurery='true'> |
||||
|
<!-- <job-filter :isShowFromLocationCode="true" :isShowProductionLineCode="true" |
||||
|
:productionline="productionlineList" ref="filter" otherTitle="" @switchChangeToday="switchChangeToday" |
||||
|
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
||||
|
:checkedWaitTask="checkedWaitTask" @productionLineCode="productionLineCode" |
||||
|
@fromLocationCode="fromLocationCode"> --> |
||||
|
</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='openJobDetail(item)'></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 ref="scanPopup" @getResult='getScanResult'></winScanPackJob> --> |
||||
|
<jobList ref="jobList" @selectItem="selectItem"></jobList> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
cancleTakeIssueJob, |
||||
|
getIssueJobList, |
||||
|
getIssueJobByProductionline, |
||||
|
closeTakeIssueJob |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
planRefreshTime |
||||
|
} from '@/common/config.js'; |
||||
|
|
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailGiveupOption, |
||||
|
getDetailCloseOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
||||
|
import comIssueJobCard from '@/pages/issue/coms/comIssueJobCard.vue' |
||||
|
import jobListPopup from '@/pages/issue/coms/jobListPopup.vue' |
||||
|
import jobInfoPopup from '@/pages/issue/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: 'issue', |
||||
|
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 |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
this.title = option.title |
||||
|
this.getIssueJobByProductionline() |
||||
|
}, |
||||
|
onShow() { |
||||
|
this.timerRefresh(); |
||||
|
}, |
||||
|
|
||||
|
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', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
}, |
||||
|
|
||||
|
//后退按钮 |
||||
|
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.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
timerRefresh() { |
||||
|
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
this.stopRefresh(); |
||||
|
var that = this; |
||||
|
this.timer = setInterval(function() { |
||||
|
that.getList('refresh', that.fromLocation, that.productionLine, that.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
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, fromLocation = '', productionLine = '',filterItemCode='',fromAreaCode='',toAreaCode='') { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageNo = 1; |
||||
|
this.jobList = []; |
||||
|
} |
||||
|
var filters = [] |
||||
|
if (this.checkedToday) { |
||||
|
filters.push({ |
||||
|
column: "create_time", |
||||
|
action: "betweeen", |
||||
|
value: this.todayTime |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: this.status |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
if (fromLocation) { |
||||
|
// 来源库位 |
||||
|
filters.push({ |
||||
|
column: "fromLocationCode", |
||||
|
action: "==", |
||||
|
value: fromLocation |
||||
|
}) |
||||
|
} |
||||
|
if(fromAreaCode){ |
||||
|
//来源库区 |
||||
|
filters.push({ |
||||
|
column: "fromAreaCode", |
||||
|
action: "==", |
||||
|
value: fromAreaCode |
||||
|
}) |
||||
|
} |
||||
|
if(toAreaCode){ |
||||
|
//到库区 |
||||
|
filters.push({ |
||||
|
column: "toAreaCode", |
||||
|
action: "==", |
||||
|
value: toAreaCode |
||||
|
}) |
||||
|
} |
||||
|
if (productionLine) { |
||||
|
// 生产线 |
||||
|
filters.push({ |
||||
|
column: "productionLineCode", |
||||
|
action: "==", |
||||
|
value: productionLine |
||||
|
}) |
||||
|
} |
||||
|
if(filterItemCode){ |
||||
|
// 物料代码 |
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "like", |
||||
|
value: filterItemCode |
||||
|
}) |
||||
|
} |
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: this.pageNo, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getIssueJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
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) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getListByFilter(params) { |
||||
|
console.log('getListByFilter',params) |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
// var filters = [] |
||||
|
// if (this.checkedToday) { |
||||
|
// filters.push({ |
||||
|
// column: "create_time", |
||||
|
// action: "betweeen", |
||||
|
// value: this.todayTime |
||||
|
// }) |
||||
|
// } |
||||
|
|
||||
|
// filters.push({ |
||||
|
// column: "status", |
||||
|
// action: "in", |
||||
|
// value: this.status |
||||
|
// }) |
||||
|
if (params.status) { |
||||
|
this.status = params.status |
||||
|
|
||||
|
}else{ |
||||
|
this.status = "1,2" |
||||
|
} |
||||
|
if(params.creationTime==""){ |
||||
|
this.checkedToday = false; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (params.fromLocationCode) { |
||||
|
// 来源库位 |
||||
|
this.fromLocation = params.fromLocationCode |
||||
|
// filters.push({ |
||||
|
// column: "fromLocationCode", |
||||
|
// action: "==", |
||||
|
// value: params.fromLocationCode |
||||
|
// }) |
||||
|
}else{ |
||||
|
this.fromLocation = '' |
||||
|
} |
||||
|
if (params.productionLineCode) { |
||||
|
// 生产线 |
||||
|
this.productionLine = params.productionLineCode |
||||
|
// filters.push({ |
||||
|
// column: "productionLineCode", |
||||
|
// action: "==", |
||||
|
// value: params.productionLineCode |
||||
|
// }) |
||||
|
}else{ |
||||
|
this.productionLine = '' |
||||
|
} |
||||
|
if (params.itemCode) { |
||||
|
// 物料代码 |
||||
|
this.filterItemCode = params.itemCode |
||||
|
// filters.push({ |
||||
|
// column: "itemCode", |
||||
|
// action: "like", |
||||
|
// value: params.itemCode |
||||
|
// }) |
||||
|
}else{ |
||||
|
this.filterItemCode = '' |
||||
|
} |
||||
|
if (params.fromAreaCode) { |
||||
|
// 来源库区 |
||||
|
this.fromAreaCode = params.fromAreaCode |
||||
|
// filters.push({ |
||||
|
// column: "fromAreaCode", |
||||
|
// action: "==", |
||||
|
// value: params.fromAreaCode |
||||
|
// }) |
||||
|
}else{ |
||||
|
this.fromAreaCode = '' |
||||
|
} |
||||
|
if (params.toAreaCode) { |
||||
|
// 到库区 |
||||
|
this.toAreaCode = params.toAreaCode |
||||
|
// filters.push({ |
||||
|
// column: "toAreaCode", |
||||
|
// action: "==", |
||||
|
// value: params.toAreaCode |
||||
|
// }) |
||||
|
}else{ |
||||
|
this.toAreaCode = '' |
||||
|
} |
||||
|
// var params = { |
||||
|
// filters: filters, |
||||
|
// pageNo: 1, |
||||
|
// pageSize: 100, |
||||
|
// } |
||||
|
|
||||
|
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
// getIssueJobList(params).then(res => { |
||||
|
// uni.hideLoading(); |
||||
|
// if (res.data.total == 0) { |
||||
|
// that.showMessage('未查找到发料任务'); |
||||
|
// } else if (res.data.total == 1) { |
||||
|
// that.openJobDetail(res.data.list[0]); |
||||
|
// } else { |
||||
|
// that.showItemList(res.data.list); |
||||
|
// } |
||||
|
// }).catch(error => { |
||||
|
|
||||
|
// that.showMessage(error) |
||||
|
// }) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
fromLocationCode(fromLocation) { |
||||
|
this.fromLocation = fromLocation; |
||||
|
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
|
||||
|
}, |
||||
|
productionLineCode(productionLineCode) { |
||||
|
this.productionLine = productionLineCode |
||||
|
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
}, |
||||
|
getByAsnNumber(code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
getPurchasereceiptByAsnNumber(code).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.total == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
||||
|
} else if (res.data.total == 1) { |
||||
|
this.$refs.scanAsnNumber.closeScanPopup(); |
||||
|
that.openJobDetail(res.data.list[0]); |
||||
|
} else { |
||||
|
this.$refs.scanAsnNumber.closeScanPopup(); |
||||
|
that.showItemList(res.data.list); |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showErrorMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
openJobDetail(item, scanMessage = '') { |
||||
|
this.getJobInfoByNumber(item.number,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', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
|
||||
|
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) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
switchChangeToday(state, creationTime) { |
||||
|
this.checkedToday = state; |
||||
|
this.todayTime = creationTime; |
||||
|
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
switchChangeWait(state, jobStatus) { |
||||
|
this.checkedWaitTask = state; |
||||
|
this.status = jobStatus; |
||||
|
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
}, |
||||
|
getJobInfoByNumber(number,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: number |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getIssueJobList(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', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
return; |
||||
|
} |
||||
|
uni.navigateTo({ |
||||
|
url: './issueDetail?id=' + result.masterId + '&status=' + result.status + '&scanMessage=' + |
||||
|
scanMessage + '&title=' + this.title |
||||
|
}); |
||||
|
this.scanMessage="" |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
getScanNumber(code) { |
||||
|
this.getDataListByType(code) |
||||
|
}, |
||||
|
getDataListByType(code) { |
||||
|
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: code |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getIssueJobList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.list.length == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的发料任务'); |
||||
|
} else if (res.data.list.length == 1) { |
||||
|
that.openJobDetail(res.data.list[0]); |
||||
|
} |
||||
|
}).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) { |
||||
|
let balance = result.balance; |
||||
|
if (balance != null) { |
||||
|
this.scanMessage = "" |
||||
|
if (!result.label.batch) { |
||||
|
this.showMessage("批次为空") |
||||
|
return; |
||||
|
} |
||||
|
if (!result.label.itemCode) { |
||||
|
this.showMessage("物料号为空") |
||||
|
return; |
||||
|
} |
||||
|
try { |
||||
|
var filters = [{ |
||||
|
column: "status", |
||||
|
action: "in", |
||||
|
value: '1,2' |
||||
|
}, |
||||
|
{ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: result.label.batch |
||||
|
}, |
||||
|
{ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: result.label.itemCode |
||||
|
}, |
||||
|
{ |
||||
|
column: "fromLocationCode", |
||||
|
action: "==", |
||||
|
value: balance.locationCode |
||||
|
} |
||||
|
] |
||||
|
getIssueJobList({ |
||||
|
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) { |
||||
|
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 => { |
||||
|
this.showMessage(error + "\n扫描[" + result.scanMessage + "]") |
||||
|
}) |
||||
|
|
||||
|
} catch (e) { |
||||
|
this.showMessage(e.message) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
Loading…
Reference in new issue