You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

591 lines
17 KiB

12 months ago
<!-- 发料任务详情 -->
<template>
<page-meta root-font-size="16px"></page-meta>
<view class="">
<view class="top_card">
6 months ago
<com-job-scan-detail :jobContent="datacontent" :isShowAllCountHint="false" :isShowScanHint="false"
:allCount="allCount" :scanCount="scanCount">
12 months ago
</com-job-scan-detail>
</view>
6 months ago
<view class="" style="margin-top: 20rpx; margin-left: 20rpx; margin-right: 20rpx;">
<button type="primary" @click="showRecommend"> 推荐信息</button>
</view>
<scroll-view scroll-y="true" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll"
class="scroll-detail">
6 months ago
<view class="" style="margin-bottom:120rpx">
<view class="detail-list margin_top" v-for="(item, index) in details" :key="item.id">
<uni-swipe-action>
<uni-swipe-action-item :right-options="options" :auto-close="false"
@click="swipeClick($event,item,index)" style='background-color: #ffffff;'>
<view class="detail-content">
<view class="choose_main">
<view class="ljh_box">
<view class="tit_ljh">{{ item.itemCode }}</view>
<view class="ljh_left desc_ljh">
<view class="font_xs text_lightblue">{{ item.itemName }}</view>
<view class="font_xs text_lightblue">{{ item.itemDesc1 }}</view>
</view>
</view>
<view class="list_form">
<view class="uni-container">
<uni-table style="overflow-x: hidden;" empty-text="">
<uni-tr>
<uni-th width="50">数量</text></uni-th>
<uni-th width="0" align="center">
</uni-th>
<uni-th width="270" align="center">
<view
style="display: flex;flex-direction: row;justify-content:center;align-items: center;">
<com-number-box :ref="'comNumberBox_'+index"
v-model="item.handledQty" :max="99999" :min="0"
style='width: 100px;'
@change="qtyChanged($event,item,index)">
</com-number-box>
<text class="text_black">({{item.uom}})</text>
</view>
</uni-th>
</uni-tr>
<uni-tr>
<uni-th width="70">来源库位</uni-th>
<uni-th width="0" align="center">
</uni-th>
<uni-th width="270">
<view class=""
style="display: flex; width: 100%; align-items: center; justify-content: center;">
<view class="text_black">
{{ item.handledFromLocationCode }}
</view>
<view class="" style="margin-left: 20rpx;">
<button size="mini" type="primary"
@click="showLocation(item)">扫描库位</button>
</view>
</view>
12 months ago
6 months ago
</uni-th>
</uni-tr>
</uni-table>
</view>
</view>
</view>
12 months ago
</view>
6 months ago
</uni-swipe-action-item>
</uni-swipe-action>
12 months ago
</view>
</view>
6 months ago
12 months ago
</scroll-view>
<view class="uni-flex uni-row new_btn_bot">
<button class="new_clear_btn btn_double" @click="clear()">清空</button>
<button class="new_save_btn btn_double" @click="submit()">提交</button>
</view>
<com-balance ref='issueitems' @selectedItem='selectedBalanceItem'></com-balance>
<win-scan-button @goScan='openScanPopup' title="单件码"></win-scan-button>
<winScanButtonTop @goScan='openItemScanPopup' title="ERP料号"></winScanButtonTop>
<winScanButtonBottom @goScan='queryItemCode' title="ERP查询"></winScanButtonBottom>
12 months ago
<winScanByProductCode ref="scanPackPopup" title="单件码" @getScanResult='getScanResult'></winScanByProductCode>
<winScanLocationCode ref="location" title="库位" @getLocation="getToLocation"></winScanLocationCode>
<win-scan-by-code ref="scanPopupItem" title='ERP料号' @getScanCode='getScanCode'>
</win-scan-by-code>
6 months ago
<recommendList ref="recommendList" title="推荐信息"></recommendList>
12 months ago
<com-balance ref="balanceItems" @selectedItem='selectedBalanceItem'></com-balance>
6 months ago
<wz-select-popup ref="wzSelectPopup" @select="selectCheckbox" />
12 months ago
<com-message ref="comMessage" @afterCloseCommitMessage='closeCommitMessage()'
6 months ago
@afterCloseScanMessage='closeScanMessage' @afterClose="closeScanMessage"></com-message>
12 months ago
</view>
</template>
<script>
import {
getUnProducePickDetail,
6 months ago
takeUnProduceIssueJob,
cancelTakeUnProduceIssueJob,
12 months ago
finshUnProducePickJob,
getitems,
getItemCodeByLike
12 months ago
} from '@/api/index.js';
import {
getJobStatuStyle,
getJobStatuDesc,
showConfirmMsg,
goHome,
compareDesc,
compareStr,
getCurrDateTime,
6 months ago
getCurrDateTimeAndT,
navigateBack,
scanSuccessAudio,
6 months ago
scanFailedAudio,
guid,
getRemoveOption
12 months ago
} from '@/common/basic.js';
import comMessage from '@/mycomponents/common/comMessage.vue'
import winScanButton from '@/mycomponents/wincom/winScanButton.vue'
import winScanButtonTop from '@/mycomponents/wincom/winScanButtonTop.vue'
import winScanButtonBottom from '@/mycomponents/wincom/winScanButtonBottom.vue'
12 months ago
import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue'
import comBalance from '@/mycomponents/common/comBalance.vue'
import comJobScanDetail from '@/mycomponents/comjob/comJobScanDetail.vue'
import winScanByPack from '@/mycomponents/wincom/winScanByPack.vue'
import comNumberBox from '@/mycomponents/common/comNumberBox.vue';
import winScanByProductCode from '@/mycomponents/wincom/winScanByProductCode.vue'
import winScanLocationCode from '@/mycomponents/wincom/winScanLocationCode.vue';
import winScanByCode from '@/mycomponents/wincom/winScanByCode.vue'
6 months ago
import recommendList from '@/mycomponents/popup/recommendList.vue';
12 months ago
export default {
components: {
comMessage,
winScanButton,
winScanButtonTop,
winScanButtonBottom,
12 months ago
winMulitScan,
comBalance,
comJobScanDetail,
winScanByPack,
comNumberBox,
winScanByProductCode,
winScanLocationCode,
6 months ago
winScanByCode,
recommendList
12 months ago
},
data() {
return {
id: "",
datacontent: {},
details: {},
toLocation: '',
ispending: false,
balancesItem: null,
currentItem: null,
allCount: 0,
scanCount: 0,
isPack: true,
titleArray: ['箱标签'],
userForm: {
names: [],
values: [],
origin: []
6 months ago
},
options: [],
facDetails: [],
currentData: null
12 months ago
}
},
filters: {
statusStyle: function(val) {
return getJobStatuStyle(val);
},
statusColor: function(val) {
return getJobStatuDesc(val);
}
},
props: {
itemCode: "",
},
onLoad(param) {
this.id = param.id;
6 months ago
this.options = getRemoveOption();
if (param.jobStatus == 1) {
this.receive((callback => {
this.getDetail();
}));
} else {
this.getDetail();
}
12 months ago
},
onReady() {},
//返回首页
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
} else if (e.index === 1) {
window.location.reload();
}
},
//拦截返回按钮事件
onBackPress(e) {
//取消承接任务
6 months ago
// cancelTakeUnProduceIssueJob(this.id)
12 months ago
// .then(res => {})
// .catch(err => {
// this.showMessage(err.message);
// });
},
mounted() {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: "#5A7CF3 !important"
})
},
methods: {
showLocation(item) {
this.currentItem = item;
this.$refs.location.openScanPopup()
},
getToLocation(locationInfo) {
6 months ago
if (this.currentItem.originalLocationCode != locationInfo.code) {
scanFailedAudio()
this.showMessage("扫描库位[" + locationInfo.code + "]与推荐来源库位[" + this.currentItem
6 months ago
.originalLocationCode + "]不一致")
return;
}
scanSuccessAudio()
12 months ago
this.currentItem.handledFromLocationCode = locationInfo.code;
this.currentItem.handledFromLocationArea = locationInfo.areaCode
this.currentItem.handledFromLocationGroup = locationInfo.locationGroupCode
this.currentItem.handledFromLocationErpCode = locationInfo.erpLocationCode
this.currentItem.handledFromWarehouseCode = locationInfo.warehouseCode
6 months ago
this.currentItem.recommendFromLocationCode = locationInfo.code;
this.currentItem.recommendFromLocationArea = locationInfo.areaCode
this.currentItem.recommendFromLocationGroup = locationInfo.locationGroupCode
this.currentItem.recommendFromLocationErpCode = locationInfo.erpLocationCode
this.currentItem.recommendFromWarehouseCode = locationInfo.warehouseCode
this.$forceUpdate()
},
swipeClick(e, item, index) {
let {
content
} = e;
if (content.text === '移除') {
uni.showModal({
title: '提示',
content: '是否移除选择的行?',
success: res => {
if (res.confirm) {
this.details.splice(index, 1)
}
}
});
}
12 months ago
},
openScanPopup() {
// if (this.allCount === this.scanCount) {
// this.showMessage("零件已经全部扫描完成");
// return;
// }
this.$refs.scanPackPopup.openScanPopup();
},
openItemScanPopup() {
this.$refs.scanPopupItem.openScanPopup();
},
6 months ago
queryItemCode() {
this.$refs.wzSelectPopup.open({
mode: 'radio', //radio checkbox 单选、多选
// dataList:[], //如果dataList传入了数组则直接使用传入的数组渲染,无需再配置proxyConfig
selected: this.userForm.values, //已选中的数据
proxyConfig: { //组件内部代理请求数据配置
reqFun: this.reqGetList, //请求方法,在方法中请返回Promise.resolve([])
localPaging: false //前端本地分页
},
search: {
type: 'remote', //local本地数据搜索 | remote请求接口
},
fields: {
label: 'name',
value: 'code'
}
})
6 months ago
},
6 months ago
reqGetList(data) {
6 months ago
let params = {
pageSize: data.pageSize,
pageIndex: data.pageIndex,
itemCode: data.searchValue,
};
6 months ago
return getItemCodeByLike(data.searchValue, data.pageIndex, data.pageSize);
},
selectCheckbox(mode, result) {
this.getScanResult(result, false)
},
6 months ago
showRecommend() {
this.$refs.recommendList.openScanPopup(this.facDetails)
},
6 months ago
12 months ago
//加载零件信息
getDetail() {
let that = this;
if (that.id == undefined) {
return;
}
uni.showLoading({
title: '加载中...',
mask: true
})
let params = {
id: that.id,
};
getUnProducePickDetail(params)
.then(item => {
uni.hideLoading();
console.log('item', item);
that.datacontent = item;
6 months ago
that.facDetails = item.facDetails
that.details = [];
12 months ago
})
.catch(err => {
uni.hideLoading();
this.showMessage('未查找到详细信息')
});
},
getScanCode(code) {
if (code == "") {
this.showMessage('ERP料号不能为空')
return;
}
getitems(code).then((res) => {
uni.hideLoading();
if (res) {
6 months ago
var result = {
itemCode: res.code
}
6 months ago
this.getScanResult(result, false)
} else {
scanFailedAudio()
this.showMessage('未查找到ERP料号【' + code + '】');
}
}).catch((err) => {
this.showMessage(err.message);
uni.hideLoading();
})
},
6 months ago
getScanResult(result, isMesCode = true) {
12 months ago
// AH240321AM0153 AH240321AM0198 AH240321AM0199
6 months ago
let item = this.facDetails.find(r => {
12 months ago
return r.itemCode == result.itemCode
});
6 months ago
if (item) {
this.currentData = item;
let scanItem = this.details.find(r => r.itemCode === result.itemCode)
//已经存在
if (scanItem) {
if (isMesCode) {
this.showMessage('单件码[' + result.scanCode + "]已经扫描")
} else {
this.showMessage('ERP料号[' + result.itemCode + "]已经扫描")
}
} else {
scanSuccessAudio()
var addItem = this.setItemInfo(result, item)
this.details.unshift(addItem)
this.$forceUpdate()
}
6 months ago
} else {
6 months ago
if (isMesCode) {
this.showMessage('单件码【' + result.scanCode + '】所对应的ERP料号与任务中的ERP料号不一致,请重新扫描');
} else {
this.showMessage('没有找到ERP料号[' + result.itemCode + "]的信息,请重新扫描");
}
12 months ago
}
12 months ago
},
6 months ago
setItemInfo(result, item) {
var item = {
id: guid(),
itemCode: item.itemCode,
itemName: item.itemName,
itemDesc1: item.itemDesc1,
itemDesc2: item.itemDesc2,
stdPackQty: item.stdPackQty,
masterID: this.datacontent.id,
recommendContainerCode: "",
recommendPackingCode: "",
recommendSupplierBatch: "",
recommendArriveDate: getCurrDateTimeAndT(),
recommendProduceDate: getCurrDateTimeAndT(),
recommendExpireDate: getCurrDateTimeAndT(),
recommendLot: "",
originalLocationCode: item.recommendFromLocationCode,
recommendQty: item.qty,
uom: item.uom,
handledContainerCode: "",
handledPackingCode: "",
handledSupplierBatch: "",
handledArriveDate: getCurrDateTimeAndT(),
handledProduceDate: getCurrDateTimeAndT(),
handledExpireDate: getCurrDateTimeAndT(),
handledLot: "",
handledQty: item.recommendQty,
creatorId: guid(),
creationTime: getCurrDateTimeAndT(),
tenantId: guid(),
lastModificationTime: getCurrDateTimeAndT(),
lastModifierId: guid(),
number: this.datacontent.number,
remark: "",
status: 2,
reasonCode: "",
caseCode: "",
projCapacityCode: "",
onceBusiCode: "",
explain: "",
}
return item;
},
12 months ago
qtyChanged(value, item, index) {
if (value == 0) {
this.showMessage('领料数量必须大于0')
6 months ago
item.handledQty = this.currentData.recommendQty
12 months ago
this.$refs['comNumberBox_' + index][0].setValue(item.handledQty);
return;
}
6 months ago
if (value > this.currentData.recommendQty) {
10 months ago
this.showMessage("实际领料数量不能大于申请数量")
6 months ago
this.$refs['comNumberBox_' + index][0].setValue(this.currentData.recommendQty);
12 months ago
return;
}
},
// //接收
receive(callback) {
let params = {
id: this.id
};
6 months ago
takeUnProduceIssueJob(params)
12 months ago
.then(res => {
callback(true);
})
.catch(err => {
this.showMessage(err.message);
callback(false);
});
},
submit() {
6 months ago
if (this.details.length == 0) {
this.showMessage('扫描列表为0,请先扫描');
12 months ago
return;
}
6 months ago
var locationHint = ""
this.details.forEach(res => {
if (!res.handledFromLocationCode) {
locationHint += "物料[" + res.itemCode + "]请扫描来源库位"
}
12 months ago
})
6 months ago
if(locationHint){
this.showMessage(locationHint);
return
}
var hint = ""
this.details.forEach(res => {
var temp = this.facDetails.find(fac => {
if (res.itemCode == fac.itemCode) {
return fac
}
})
if (temp && temp.recommendQty < res.handledQty) {
hint += "物料[" + res.itemCode + "]箱码[" + res.handledPackingCode + "]扫描数量[" + res
.handledQty + "]大于推荐的数量[" + temp.recommendQty + "]"
}
})
if (hint) {
this.showMessage(hint);
12 months ago
} else {
6 months ago
this.finsh();
12 months ago
}
},
finsh() {
let that = this;
uni.showLoading({
title: "提交中...",
mask: true
});
that.datacontent.completeUserId = localStorage.getItem('userId')
that.datacontent.completeUserName = localStorage.getItem('userName_CN')
that.datacontent.completeTime = getCurrDateTime();
that.datacontent.worker = localStorage.userName_CN == "" ? localStorage.userName : localStorage
.userName_CN;
that.datacontent.details = that.details;
let params = JSON.stringify(that.datacontent);
console.log("提交", params);
finshUnProducePickJob(that.id, params)
.then(res => {
uni.hideLoading();
if (res != null) {
that.showCommitSuccessMessage();
}
})
.catch(err => {
that.showMessage(err.message);
uni.hideLoading();
});
12 months ago
},
//返回任务列表页
backJobList(delay) {
navigateBack(1)
// setTimeout(() => {
// uni.navigateTo({
// url: './unProducePick'
// })
// }, 1000)
},
clear() {
this.scanCount = 0;
this.currentItem = null;
this.getDetail();
},
showMessage(message) {
this.$refs.scanPackPopup.losefocus();
this.$refs.scanPopupItem.losefocus();
12 months ago
this.$refs.comMessage.showMessage(message);
},
showScanMessage(message) {
this.$refs.scanPackPopup.losefocus();
this.$refs.scanPopupItem.losefocus();
12 months ago
this.$refs.comMessage.showScanMessage(message);
},
closeScanMessage() {
this.$refs.scanPackPopup.getfocus();
this.$refs.scanPopupItem.getfocus();
12 months ago
},
showCommitSuccessMessage() {
this.$refs.comMessage.showCommitSuccess();
},
closeCommitMessage() {
this.backJobList(0); //点关闭直接返回列表
uni.hideLoading();
},
closeScanPopup() {
if (this.allCount == this.scanCount) {
this.$refs.scanPackPopup.closeScanPopup();
this.$refs.scanPopupItem.closeScanPopup();
12 months ago
}
},
}
}
</script>
<style scoped lang="scss">
</style>