Browse Source

补料任务箱码改批次新增了批次组件和页面2024/9/18 19:41:50

syhx
zhang_li 2 months ago
parent
commit
50a7991538
  1. 77
      src/mycomponents/balance/recommendBalanceBatch.vue
  2. 2
      src/mycomponents/item/itemQty.vue
  3. 161
      src/mycomponents/qty/qtyEdit.vue
  4. 9
      src/pages.json
  5. 115
      src/pages/repleinsh/coms/comRepleishDetailCardBatch.vue
  6. 762
      src/pages/repleinsh/coms/comScanReplishPackBatch.vue
  7. 37
      src/pages/repleinsh/job/repleinshDetail.vue
  8. 504
      src/pages/repleinsh/job/repleinshDetailBatch.vue
  9. 28
      src/pages/repleinsh/job/repleinshJob.vue

77
src/mycomponents/balance/recommendBalanceBatch.vue

@ -0,0 +1,77 @@
<template>
<view>
<view class="uni-flex uni-row space-between center ">
<view class="uni-flex uni-row " style="width: 60%;" >
<view style=" width: 25rpx;color: #32C1E8;">
推荐
</view>
<view style="word-break: break-all">
<pack v-if="isShowPack" :packingCode="detail.packingNumber"></pack>
<batch v-if="isShowBatch" :batch="detail.batch"></batch>
<location v-if="isShowLocation" :locationCode="detail.fromLocationCode"></location>
</view>
</view>
</view>
</view>
</template>
<script>
import pack from '@/mycomponents/balance/pack.vue'
import location from '@/mycomponents/balance/location.vue'
import batch from '@/mycomponents/balance/batch.vue'
import recommendQty from '@/mycomponents/qty/recommendQty.vue'
import compareQty from '@/mycomponents/qty/compareQty.vue'
export default {
components: {
pack,
location,
batch,
recommendQty,
compareQty
},
data() {
return {
}
},
props: {
detail: {
type: Object,
default: {}
},
isShowPack: {
type: Boolean,
default: true
},
isShowBatch: {
type: Boolean,
default: true
},
isShowLocation: {
type: Boolean,
default: true
},
},
watch: {
},
methods: {
}
}
</script>
<style>
.recommend {
position: absolute;
left: 25px;
top: 70px;
width: 10px;
height: 30px;
opacity: 1;
}
</style>

2
src/mycomponents/item/itemQty.vue

@ -1,5 +1,5 @@
<template>
<view class="uni-flex uni-row space-between center" style="background-color:#fff; margin-left: 15px;">
<view class="uni-flex uni-row space-between center" style=" margin-left: 15px;">
<view>
<item :dataContent="dataContent"></item>
</view>

161
src/mycomponents/qty/qtyEdit.vue

@ -0,0 +1,161 @@
<template>
<view class="">
<uni-popup ref="popup">
<view class="uni-flex uni-column pop_customer">
<view class="" style="padding:10rpx">
<view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx">
<view class="" style="font-size: 35rpx;">
{{title}}
</view>
<image style="width: 35rpx;height: 35rpx;" src="/static/icons/icons_close.svg"
@click="closeEditPopup"></image>
</view>
<view class='split_line'></view>
<view class="uni-flex uni-column" style="background-color: white; height:60%;">
<view class="uni-flex uni-column ">
<view class="uni-flex uni-row space-between padding title u-col-center">
<text>数量 : </text>
<view class="uni-flex uni-row uni-center" style="align-items: center;">
<input class="qty_input" v-model="allQty" :focus="true" type="number"
@confirm="confirm()" />
<uom :uom="dataContent.uom"></uom>
</view>
</view>
</view>
</view>
</view>
<view class="uni-flex uni-row hide_border">
<button class="btn_edit_big_cancle" hover-class="btn_edit_big_after" @click="cancel()">取消</button>
<button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button>
</view>
</view>
</uni-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import uom from '@/mycomponents/qty/uom.vue'
import StdUom from '@/mycomponents/qty/StdUom.vue'
import balanceStatus from '@/mycomponents/status/balanceStatus.vue'
// import {
// getInspectReasonList
// } from '@/common/directory.js';
export default {
components: {
uom,
StdUom,
balanceStatus,
},
data() {
return {
allQty: 0,
stdCount: 1,
stateData: 0,
balanceQty: 0,
inventoryStatus: "",
originalInventoryStatus: "",
dataContent: {},
handleQty: 0,
FailedQty: 0,
reasonList: [],
reason: ""
}
},
watch: {
},
created() {
// this.reasonList = getInspectReasonList();
},
props: {
title: {
type: String,
default: "编辑数量"
},
settingParam: {
type: Object,
default: {}
},
isShowStatus: {
type: Boolean,
default: true
},
allowEditStatus: {
type: Boolean,
default: false
}
},
methods: {
openEditPopup(item, handleQty) {
this.dataContent = item
this.allQty = Number(handleQty)
setTimeout(res => {
this.$refs.popup.open('bottom')
}, 100)
},
closeEditPopup() {
this.$refs.popup.close()
},
confirm() {
this.setValue();
},
cancel() {
this.dataContent.inventoryStatus = this.originalInventoryStatus;
this.closeEditPopup();
},
calcQty(val) {
this.allQty = val * Number(this.dataContent.packQty);
},
setValue() {
var balanceQty = Number(this.dataContent.qty);
if (this.allQty == 0) {
this.$refs.comMessage.showConfirmWarningModal('数量必须大于0',
res => {
this.allQty = balanceQty;
})
} else if (this.allQty > balanceQty) {
this.$refs.comMessage.showConfirmWarningModal('数量[' + this.allQty + ']不允许大于库存数量[' + balanceQty + ']',
res => {
this.allQty = balanceQty;
})
} else {
console.log(33,this.allQty)
this.$emit("confirm", Number(this.allQty));
this.closeEditPopup();
}
},
updateStatus(value) {
this.inventoryStatus = value
console.log(this.inventoryStatus)
}
}
}
</script>
<style lang="scss">
.uni-popup .uni-popup__wrapper {
width: 100% !important;
padding: 30rpx;
}
.hide_border {
button {
border: none;
}
button::after {
border: none;
}
}
.title {
font-size: 30rpx;
}
</style>

9
src/pages.json

@ -802,6 +802,15 @@
"autoBackButton": "true"
}
}
},{
"path": "pages/repleinsh/job/repleinshDetailBatch",
"style": {
"navigationBarTitleText": "补料详情",
"enablePullDownRefresh": true,
"titleNView": {
"autoBackButton": "true"
}
}
},
{
"path": "pages/repleinsh/record/repleinshRecord",

115
src/pages/repleinsh/coms/comRepleishDetailCardBatch.vue

@ -3,55 +3,20 @@
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode"
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> -->
<view v-for="(item,index) in dataContent.Items">
<uni-collapse ref="collapse">
<uni-collapse-item :open="true" :show-animation="true">
<template v-slot:title>
<!-- 物品 -->
<view v-for="(item,index) in dataContent.subList">
<uni-swipe-action ref="swipeAction" :class="item.scaned? 'scan_view':''">
<uni-swipe-action-item
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="swipeClick($event,item,index)" style='padding:0px 0px 5px 0px;align-items: center;'>
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty>
</template>
<view v-for="(loacation,index) in item.Locations">
<view>
<view class="uni-flex uni-row space-between">
<!-- 推荐库位 -->
<location :locationCode="loacation.fromLocationCode">
</location>
</view>
<view v-for="(batch,index) in loacation.Batchs">
<recommend-balance style='margin-left: 20px;' :detail="batch" :isShowLocation="false"
:isShowPack="batch.packingNumber!=null && batch.packingNumber!=''">
</recommend-balance>
<view class="uni-flex uni-row" v-if='batch.Records.length>0'>
<view class="center " style=" width: 20px;background-color: #0CC2B6; color: #fff; margin-left: 40px; padding: 0px 2px;">
实际
</view>
<view class="uni-flex uni-column scan_view" style="width: 100%;">
<view v-for="(record,index) in batch.Records">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,batch,record,index)"
:right-options="settingParam.allowModifyQty=='TRUE'?scanOptions:removeOptions">
<!-- <view class="card_view" v-if="record.parentPackingNumber" >
<text class="card_packing_code card_content ">外包装</text>
<text class="card_content ">{{record.parentPackingNumber}}</text>
</view> -->
<handle-balance :detail="record" :isShowLocation="false"
:isShowStatus='true'
:isShowBatch="batch.packingNumber!=null">
<!-- :isShowBatch="batch.packingNumber!=null" -->
</handle-balance>
<location :locationCode="item.fromLocationCode"></location>
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false"
:isShowPack="item.packingNumber"></recommendBalanceBatch>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</view>
</view>
</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</view>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit>
<detail-info-popup ref="detailInfoPopup"></detail-info-popup>
<comMessage ref="message"></comMessage>
</template>
@ -60,18 +25,21 @@
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue'
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue'
import handleBalance from '@/mycomponents/balance/handleBalance.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue'
import location from '@/mycomponents/balance/location.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import {
getDetailOption,
getEditRemoveOption,
getRemoveOption
getPurchaseReceiptOption,
getRemoveOption,
getEditRemoveOption
} from '@/common/array.js';
export default {
@ -85,7 +53,9 @@
requiredLocation,
balanceQtyEdit,
location,
detailInfoPopup
detailInfoPopup,
recommendBalanceBatch,
qtyEdit
},
props: {
dataContent: {
@ -96,6 +66,10 @@
type: Object,
default: {}
},
isEdit: {
type: Boolean,
default: true
},
},
watch: {
@ -109,60 +83,57 @@
batchItem: {},
detailOptions: [],
scanOptions: [],
removeOptions:[]
options: [],
removeOptions: [],
editAndRemoveOptions: []
}
},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getEditRemoveOption();
this.removeOptions = getRemoveOption()
this.removeOptions = getRemoveOption();
this.editAndRemoveOptions = getEditRemoveOption()
},
methods: {
resizeCollapse() {
this.$nextTick(() => {
this.$refs.collapse.forEach(r => {
r.childrens.forEach(i => {
i.init();
})
r.resize();
})
});
},
swipeClick(e, batch, record, index) {
swipeClick(e, item, index) {
if (e.content.text == "编辑") {
this.edit(batch, record)
this.edit(item)
} else if (e.content.text == "移除") {
this.remove(batch, record, index)
this.remove(item, index)
}
},
edit(batch, record) {
edit(item) {
console.log(item)
let that = this;
that.editItem = record;
that.batchItem = batch;
record.balance.balanceQty = record.balance.qty;
that.$refs.balanceQtyEdit.openEditPopup(record.balance, record.qty);
that.editItem = item;
// that.batchItem = batch;
// record.balance.balanceQty = record.balance.qty;
that.$refs.balanceQtyEdit.openEditPopup(item);
},
detail(item) {
this.showItem = item;
this.$refs.receiptHint.openScanPopup()
},
remove(batch, record, index) {
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
batch.Records.splice(index, 1);
this.resizeCollapse();
this.$emit('updateData', record)
item.handleQty = 0;
item.scaned = false ;
// this.$emit('updateData', record)
}
});
},
confirm(val) {
this.editItem.qty = val;
console.log(val)
this.editItem.handleQty = val;
this.$emit('updateData', this.editItem)
// let qty = 0;
// this.batchItem.Records.forEach(r => {

762
src/pages/repleinsh/coms/comScanReplishPackBatch.vue

@ -0,0 +1,762 @@
<template>
<view>
<uni-popup ref="popup" :maskClick='false'>
<view class="">
<view class="popup_box">
<view class="pop_title">
扫描箱码
<text class="fr" @click="closeScanPopup()">关闭</text>
</view>
<!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
margin-top: 8rpx;
border-radius: 8rpx;">
<view class="uni-center" style="width: 25%; ">
来源库位
</view>
<view class="" style="width: 75%; padding: 8rpx;">
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位"
@confirm="fromLocationUpdate"></uni-combox>
</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"
:isShowStatus='true' :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>
</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 {
calc
} from '@/common/calc.js';
import {
uniqueArray
} from '@/common/basic.js';
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
import {
getDirectoryItemArray
} from '../../../common/directory.js';
import {
getLabelInfo
} from '@/common/label.js';
export default {
name: 'winScanPack',
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: {},
positionList: [],
defaultValueList: [],
label: {},
fromInventoryStatuses: "",
packageInfo: {},
toLocationAreaTypeList: []
}
},
created() {
},
watch: {},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getDetailEditRemoveOption();
},
methods: {
openScanPopup(content, jobcontent) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus();
}, 500)
},
openScanPopupForJobSimulate(content, jobcontent, scanMessage) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
getLabelInfo(scanMessage, this.headerType, callback => {
if (callback.success) {
this.onScan(callback);
} else {
this.showErrorMessage(callback.message)
}
})
},
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.subList;
that.toLocationCode = that.dataContent.subList[0].toLocationCode;
that.toLocationAreaTypeList = getDirectoryItemArray(this.jobContent.toAreaTypes)
// that.fromLocationList = that.getFromLocationList();
}
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
// getFromLocationList() {
// let list = [];
// let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode);
// if (location != undefined) {
// location.Items.forEach(item => {
// item.Locations.forEach(f => {
// list.push(f.fromLocationCode)
// })
// })
// //
// list = uniqueArray(list);
// this.fromLocationCode = list[0];
// return list;
// } else {
// this.$refs.comMessage.showErrorMessages('' + this.toLocationCode + '', res => {
// this.toLocationCode = '';
// });
// }
// },
fromLocationUpdate(fromlocation) {
let location = this.fromLocationList.find(r => r == fromlocation)
if (location == undefined) {
this.fromLocationCode = ''
this.showErrorMessage('发料库位【' + fromlocation + '】不存在', res => {
this.getfocus();
})
}
},
onScan(result) {
console.log(11,result)
if (!result.package) {
this.showErrorMessage('扫描数据错误[' + result.label.code + "]",
res => {
this.getfocus();
}
)
return;
}
if (this.toLocation && result.package.packUnit) {
let item = this.toLocation.find(r => r.itemCode == result.package.itemCode);
if (!item) {
this.showErrorMessage('扫描物料代码不属于该任务',
res => {
this.getfocus();
});
return
}
if (result.package.packUnit !== item.packUnit) {
// this.$refs.comMessage.showQuestionMessage(
// `${result.package.packUnit}${item.packUnit}.`, res => {
// if (res) {
// this.getToLocationBalance(result)
// }
// });
this.getToLocationBalance(result)
} else {
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()
this.queryBalance(result);
// if (res.data.list.length > 0) {
// this.showErrorMessage("" + res.data.list[0].locationCode + "",
// res => {
// this.getfocus();
// });
// } else {
// this.queryBalance(result);
// }
// callback(res.data)
}).catch(err => {
uni.hideLoading()
this.showErrorMessage(err.message,
res => {
this.getfocus();
});
})
},
queryBalance(result) {
try {
let that = this;
// if (that.fromLocationCode == '') {
// that.showErrorMessage('', res => {
// that.$refs.toLocationCombox.onFocus();
// });
// return;
// }
let packageInfo = result.package;
let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber;
let lot = result.label.batch;
let item = that.toLocation.find(r => r.itemCode == itemCode);
if (item == undefined) {
that.showErrorMessage('未查找到物料【' + itemCode + '】的发料明细',
res => {
that.getfocus();
}
)
return;
} else {
item.scaned = true
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 => {
this.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 => {
this.getfocus();
})
})
}
} catch (e) {
uni.hideLoading();
this.showErrorMessage(e.stack,
res => {
this.getfocus();
})
}
},
selectBalanceItem(balance) {
this.afterGetBalance(balance, balance, this.packageInfo);
},
afterGetBalance(label, balance, packageInfo) {
try {
let that = this;
let itemCode = label.itemCode;
let packingCode = label.packingNumber;
let lot = label.batch;
let item = that.toLocation.find(r => r.itemCode == itemCode);
item.scaned =true
that.fromLocationCode = balance.locationCode;
// let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode);
//
if (item.fromLocation!=that.fromLocationCode) {
// let batch = fromLocation.Batchs.find(r => r.batch == lot);
if (item.batch != undefined) {
// if (batch.Records == undefined) {
// batch.Records = [];
// }
// let record = batch.Records.find(r => r.packingNumber == packingCode);
that.addRecord(item.batch, label, balance, packageInfo)
} else {
if (this.jobContent.allowModifyBatch == "TRUE") {
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,批次【' + lot +
'】不是推荐批次,是否要继续发料?', res => {
if (res) {
let batch = that.createBatchInfo(label, balance, packageInfo);
if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
fromLocation.Batchs.unshift(batch);
this.getfocus();
}
})
} else {
that.showErrorMessage('未查找到批次【' + lot + '】的发料明细',
res => {
that.getfocus();
});
}
}
} else {
if (this.jobContent.allowModifyLocation == "TRUE") {
this.showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode +
"】与推荐的库位不一致,是否要继续发料?", res => {
if (res) {
let locaion = that.createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
this.getfocus();
that.$emit("afterScan");
}
})
} else {
this.showErrorMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode +
"】与推荐的库位不一致,不允许继续发料?")
}
}
} catch (e) {
this.showErrorMessage(e.stack,
res => {
this.getfocus();
}
)
}
},
//
createLocationInfo(label, balance, packageInfo) {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
isNewAdd: true,
Batchs: []
}
let batch = this.createBatchInfo(label, balance, packageInfo);
batch.detail = balance;
batch.detail.fromLocationCode = balance.locationCode;
location.Batchs.push(batch);
return location;
},
createBatchInfo(label, balance, packageInfo) {
let batch = {
batch: label.batch,
qty: 0,
uom: label.uom,
handleQty: Number(balance.qty),
Records: []
}
let record = {}
if (balance != null) {
record = this.creatRecordByBalance(balance, packageInfo);
batch.handleQty = Number(label.qty)
} else {
record = this.creatRecordByLabel(label, packageInfo);
batch.handleQty = Number(balance.qty)
}
batch.Records.push(record);
this.issueRecord.unshift(record)
return batch;
},
creatRecordByLabel(label, packageInfo) {
let record = {
scaned: true,
itemCode: label.itemCode,
packingNumber: label.packingNumber,
parentPackingNumber: packageInfo.parentNumber,
batch: label.batch,
qty: Number(label.qty),
// qty: Number(label.qty)>Number(balance.qty)?Number(balance.qty):Number(label.qty),
uom: label.uom,
inventoryStatus: "OK",
balance: null,
toLocationCode: this.toLocationCode,
supplierCode: label.supplierCode,
packUnit: packageInfo.packUnit,
packQty: packageInfo.packQty,
}
return record;
},
creatRecordByBalance(balance, packageInfo) {
balance.packQty = packageInfo.packQty
balance.packUnit = packageInfo.packUnit
let record = {
scaned: true,
itemCode: balance.itemCode,
packingNumber: packageInfo.number,
parentPackingNumber: packageInfo.parentNumber,
batch: packageInfo.batch,
qty: Number(balance.qty),
// qty: Number(label.qty)>Number(balance.qty)?Number(balance.qty):Number(label.qty),
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
toLocationCode: this.toLocationCode,
supplierCode: balance.supplierCode
}
return record;
},
calcBatchHandleQty(balance) {
// let handleQty = 0;
// batch.Records.forEach(res => {
// handleQty = calc.add(handleQty, res.qty)
// })
// batch.handleQty = handleQty;
this.dataContent.subList.forEach(item => {
if(item.itemCode == balance.itemCode){
item.handleQty = balance.qty;
}
// toLocationCode.Items.forEach(item => {
// var itemCodeHandleQty = 0;
// item.Locations.forEach(batch => {
// batch.Batchs.forEach(batchHandleQty => {
// itemCodeHandleQty = calc.add(itemCodeHandleQty,
// batchHandleQty.handleQty)
// })
// })
// item.handleQty = itemCodeHandleQty;
// })
})
},
addRecord(batch, label, balance, packageInfo) {
let record = {};
if (balance == null) {
record = this.creatRecordByLabel(label, packageInfo);
} else {
record = this.creatRecordByBalance(balance, packageInfo);
}
if (packageInfo.parentNumber) {
// var checkData = batch.Records.find(r => {
// if (r.packingNumber == packageInfo.parentNumber &&
// r.batch == packageInfo.batch) {
// return r;
// }
// })
if (checkData) {
//
this.showErrorMessage("箱码[" + packageInfo.number + "]批次[" + packageInfo.batch +
"]的父包装已经扫描")
} else {
// batch.Records.push(record);
// this.issueRecord.unshift(record)
this.calcBatchHandleQty(balance);
this.getfocus();
}
} else {
//
// var checkData = batch.Records.find(r => {
// if (r.parentPackingNumber == packageInfo.number &&
// r.batch == packageInfo.batch) {
// return r;
// }
// })
// if (checkData) {
// //
// this.$refs.comMessage.showQuestionMessage("[" + checkData.parentPackingNumber + "]" + "[" +
// packageInfo
// .batch + "]", res => {
// if (res) {
// batch.Records = []
// batch.Records.push(record);
// this.issueRecord.unshift(record)
// this.calcBatchHandleQty(batch);
// this.getfocus();
// }
// })
// console.log("")
// } else {
// batch.Records.push(record);
// this.issueRecord.unshift(record)
this.calcBatchHandleQty(balance);
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(item, index) {
this.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
item.handleQty = 0;
item.scaned = false ;
this.$emit('updateData', record);
}
});
},
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;
}
</style>

37
src/pages/repleinsh/job/repleinshDetail.vue

@ -14,10 +14,8 @@
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource">
<comRepleishDetailCardBatch ref='comIssueDetailCard' :dataContent="toLocation"
@updateData='updateData' v-if="managementType=='BY_BATCH'"></comRepleishDetailCardBatch>
<com-repleish-detail-card ref='comIssueDetailCard' :dataContent="toLocation"
@updateData='updateData' v-else>
@updateData='updateData'>
</com-repleish-detail-card>
</view>
</scroll-view>
@ -78,7 +76,6 @@
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comRepleishDetailCard from '@/pages/repleinsh/coms/comRepleishDetailCard.vue'
import comRepleishDetailCardBatch from '@/pages/repleinsh/coms/comRepleishDetailCardBatch.vue'
import comScanReplishPack from '@/pages/repleinsh/coms/comScanReplishPack.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
@ -91,7 +88,6 @@
comScanReplishPack,
requiredLocation,
jobTop,
comRepleishDetailCardBatch,
},
data() {
return {
@ -105,8 +101,6 @@
toLocationAreaTypeList: [],
jobStatus: "",
scanMessage: "",
managementList:[],
managementType:''
};
},
@ -202,19 +196,7 @@
this.$refs.comScanIssuePack.openScanPopupForJobSimulate(this.detailSource, this
.jobContent, that.scanMessage);
}
//
var itemCodes = []
this.detailSource.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
await getManagementPrecisions(itemCodes, that.toLocationCode, res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
}
})
let timer = setTimeout(r => {
that.resizeCollapse();
if (timer) {
@ -353,12 +335,7 @@
itemCodes.push(cur.itemCode)
})
})
//
getManagementPrecisions(itemCodes, this.toLocationCode, res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
var params = this.setParams()
if (!params.subList || params.subList.length == 0) {
uni.hideLoading()
@ -377,8 +354,7 @@
uni.hideLoading()
this.showErrorMessage(error)
})
}
})
},
setParams() {
@ -411,11 +387,6 @@
record.toPackingNumber = r.packingNumber;
record.toPackUnit = r.packUnit;
record.toBatch = r.batch;
if(this.managementType == 'BY_BATCH'){
record.toPackingNumber = '';
record.packingNumber = '';
record.fromPackingNumber = '';
}
subItem.recordList.push(record);
})
commitSubList.push(deepCopyData(subItem));

504
src/pages/repleinsh/job/repleinshDetailBatch.vue

@ -0,0 +1,504 @@
<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>
<view class="header_item">
申请单号 : {{jobContent.requestNumber}}
</view>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<!-- <view v-for="(toLocation, index) in detailSource">
<comRepleishDetailCardBatch ref='comIssueDetailCard' :dataContent="toLocation" @updateData='updateData'></comRepleishDetailCardBatch>
</view> -->
<comRepleishDetailCardBatch ref='comIssueDetailCard' :dataContent="detailSource" @updateData='updateData'>
</comRepleishDetailCardBatch>
</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="">
<requiredLocation ref='comScanLocation' title="目标库位" :locationCode="toLocationCode"
@getLocation='scanLocationCode' :isShowEdit="jobContent.allowModifyLocation == 'TRUE'"
:locationAreaTypeList="toLocationAreaTypeList"></requiredLocation>
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="clickSubmit">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<comScanReplishPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</comScanReplishPackBatch>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
takeRepleinshJob,
cancleTakeRepleinshJob,
getRepleinshJobDetail,
repleinshJobSubmit
} 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 {
calc
} from '@/common/calc.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comRepleishDetailCard from '@/pages/repleinsh/coms/comRepleishDetailCard.vue'
import comRepleishDetailCardBatch from '@/pages/repleinsh/coms/comRepleishDetailCardBatch.vue'
import comScanReplishPack from '@/pages/repleinsh/coms/comScanReplishPack.vue'
import comScanReplishPackBatch from '@/pages/repleinsh/coms/comScanReplishPackBatch.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
export default {
name: 'issueDetail',
components: {
jobDetailPopup,
winScanButton,
comRepleishDetailCard,
comRepleishDetailCardBatch,
comScanReplishPack,
requiredLocation,
jobTop,
comScanReplishPackBatch
},
data() {
return {
id: '',
jobContent: {}, //
subList: [], //subList
detailSource: [], //
detailOptions: [],
scanOptions: [],
toLocationCode: '',
toLocationAreaTypeList: [],
jobStatus: "",
scanMessage: "",
managementType: ''
};
},
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") {
//
cancleTakeRepleinshJob(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) {
takeRepleinshJob(this.id).then(res => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}
},
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getRepleinshJobDetail(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.toLocationCode = that.subList[0].toLocationCode
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes)
var itemCodes = []
res.data.subList.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
that.detailSource = res.data;
if (that.scanMessage) {
this.$refs.comScanIssuePack.openScanPopupForJobSimulate(this.detailSource, this
.jobContent, that.scanMessage);
}
let timer = setTimeout(r => {
that.resizeCollapse();
if (timer) {
timer = null
clearTimeout(timer)
}
}, 1000)
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
closeScan() {
this.resizeCollapse();
},
resizeCollapse() {
},
clickSubmit() {
let str = ""
var scanCount = this.getScanCount(this.subList);
if(!scanCount){
this.$refs.comMessage.showErrorMessage('扫描数量为0,请先扫描', res => {
});
return;
}
this.detailSource.subList.forEach(item => {
if (item.handleQty != item.qty) {
str +=
"扫描数量[" + item.handleQty + "]与任务数量不一致[" + item.qty + "],是否提交"
}
})
if (str) {
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => {
if (res) {
//
this.$throttle(this.submitJob, 2000, this)()
} else {
// this.scanPopupGetFocus()
}
});
} else {
//
// this.$throttle(this.submitJob, 2000, this)()
}
},
submit() {
var scanCount = this.getScanCount(this.subList);
// //
// if (this.jobContent.allowPartialComplete == "TRUE") {
// // 00
// if (scanCount == 0) {
// this.$refs.comMessage.showQuestionMessage("0,?", res => {
// if (res) {
// this.setSubmitParamsAndSubmit();
// }
// })
// } else {
// this.setSubmitParamsAndSubmit();
// }
// } else {
//
if (scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
} else {
this.setSubmitParamsAndSubmit();
}
// }
},
setSubmitParamsAndSubmit() {
//
this.submitJob();
//使
// if (this.jobContent.useOnTheWayLocation == 'TRUE') {
// this.submitJob();
// } else {
// //
// getManagementPrecisions(itemCodes, locationCode, res => {
// if (res.success) {
// this.managementList = res.list;
// this.submitJob();
// } else {
// uni.hideLoading();
// this.showErrorMessage(res.message);
// }
// });
// }
},
submitJob() {
uni.showLoading({
title: "提交中....",
mask: true
});
var params = this.setParams()
console.log("提交参数", params);
if (!params.subList || params.subList.length == 0) {
uni.hideLoading()
this.showErrorMessage("请扫描您需要提交的补料任务")
return
}
repleinshJobSubmit(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 commitSubList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
console.log(this.detailSource)
this.detailSource.subList.forEach(r => {
if(r.scaned){
let subItem = {
...r
}
subItem.recordList = []
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 = this
.toLocationCode;
record.supplierCode = r.supplierCode;
record.fromParentPackingNumber = r
.parentPackingNumber;
record.fromPackingNumber = r
.packingNumber;
record.toPackingNumber = r
.packingNumber;
record.toPackUnit = r.packUnit;
record.toBatch = r.batch;
subItem.recordList.push(record);
commitSubList.push(deepCopyData(subItem));
}
})
this.jobContent.subList = commitSubList
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) {
let requestLocation = this.detailSource.subList.find(r => r.toLocationCode == record.toLocationCode);
// this.detailSource.subList.forEach(r =>{
// if(r.itemCode == record.itemCode){
// r.handleQty = record.qty
// }
// });
console.log(this.detailSource.subList)
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.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);
},
closeScanPopup() {
this.updateCommitBtn();
},
scanLocationCode(location, code) {
this.toLocationCode = code
},
getScanCount(subList) {
var scanCount = 0;
this.detailSource.subList.forEach(toLocationCode => {
scanCount+=calc.add(scanCount,parseFloat(toLocationCode.handleQty))
})
console.log(scanCount)
return scanCount;
}
}
};
</script>
<style scoped lang="scss">
</style>

28
src/pages/repleinsh/job/repleinshJob.vue

@ -64,6 +64,10 @@
repleinshJobFilter
} from '@/common/config.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comRepleinshJobCard from '@/pages/repleinsh/coms/comRepleinshJobCard.vue'
@ -313,11 +317,11 @@
openJobDetail(item, scanMessage = '') {
this.getJobInfoByNumber(item.number,scanMessage )
this.getJobInfoByNumber(item.number,scanMessage, item)
},
getJobInfoByNumber(number,scanMessage){
getJobInfoByNumber(number,scanMessage, item){
let that = this;
uni.showLoading({
title: "加载中....",
@ -358,11 +362,27 @@
return;
}
getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => {
if (ret.success) {
this.managementList = ret.list;
this.managementType = this.managementList.some(cur => cur.ManagementPrecision == 'BY_BATCH') ?
'BY_BATCH' : ''
this.managementType ='BY_BATCH'
if (this.managementType == 'BY_BATCH') {
uni.navigateTo({
url: './repleinshDetailBatch?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' +
scanMessage + '&title=' + this.title
});
} else {
uni.navigateTo({
url: './repleinshDetail?id=' + result.masterId + '&status=' + result.status + '&scanMessage=' +
url: './repleinshDetail?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' +
scanMessage + '&title=' + this.title
});
}
}
})
this.scanMessage = ""
}
}).catch(error => {

Loading…
Cancel
Save