Browse Source

增加先进先出直接补料

hella_online_20240829
niexiting 3 months ago
parent
commit
2e8244cde7
  1. 2
      .env.development
  2. 10
      src/common/style/new_style.css
  3. 11
      src/mycomponents/balance/balance.vue
  4. 16
      src/mycomponents/balance/balanceSelect.vue
  5. 2
      src/mycomponents/record/recordComDetailCard.vue
  6. 28
      src/mycomponents/scan/winComScanBalance.vue
  7. 666
      src/pages/repleinsh/record/repleinshRecord.vue
  8. 558
      src/pages/repleinsh/record/repleinshRecordV1.vue

2
.env.development

@ -1,7 +1,7 @@
#VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api #VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api
#VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api #VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL=http://172.21.32.13:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.13:81/admin-api VITE_BASE_URL=http://172.21.32.14:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.14:81/admin-api
# 租户配置 VITE_TENANT='[{"text":"长春1379","value":1},{"text":"成都1397","value":2},{"text":"长春2379","value":3}]' # 租户配置 VITE_TENANT='[{"text":"长春1379","value":1},{"text":"成都1397","value":2},{"text":"长春2379","value":3}]'
# 是否是测试环境 # 是否是测试环境

10
src/common/style/new_style.css

@ -2085,6 +2085,12 @@ button::after {
vertical-align: middle vertical-align: middle
} }
.card_item_code {
color: #329362;
padding: 5px;
font-size: 30rpx;
}
.card_packing_code { .card_packing_code {
color: #3315EB; color: #3315EB;
padding: 5px; padding: 5px;
@ -2147,10 +2153,10 @@ button::after {
font-size: 32rpx; font-size: 32rpx;
} }
.card_item_code { /* .card_item_code {
color: #F1A532; color: #F1A532;
padding: 5px; padding: 5px;
} } */
.card_product_date { .card_product_date {
color: #329362; color: #329362;

11
src/mycomponents/balance/balance.vue

@ -11,8 +11,6 @@
</view> </view>
<view class="uni-flex" style="flex-direction: column;"> <view class="uni-flex" style="flex-direction: column;">
<view class="uni-flex uni-row center"> <view class="uni-flex uni-row center">
<!-- <qty v-if="dataContent.record==null ||dataContent.record==undefined " :dataContent="dataContent" <!-- <qty v-if="dataContent.record==null ||dataContent.record==undefined " :dataContent="dataContent"
:isShowStdPack="isShowStdPack" :isShowStatus="isShowStatus"></qty> --> :isShowStdPack="isShowStdPack" :isShowStatus="isShowStatus"></qty> -->
<qty v-if="dataContent.handleQty==0 || dataContent.handleQty==undefined" :dataContent="dataContent" <qty v-if="dataContent.handleQty==0 || dataContent.handleQty==undefined" :dataContent="dataContent"
@ -22,20 +20,15 @@
:isShowStatus='isShowStatus'> :isShowStatus='isShowStatus'>
</compare-qty> </compare-qty>
<view class="uni-flex uni-row" style="vertical-align:center" v-if="isDevlement()"> <view class="uni-flex uni-row" style="vertical-align:center" v-if="isDevlement()">
<text style="font-size: 30rpx;color: #2979ff; width: 20px;" @click="copy">复制</text> <text style="font-size: 30rpx;color: #2979ff; width: 20px;" @click="copy">复制</text>
</view> </view>
</view> </view>
<view class="" v-if="dataContent.inventoryStatus"> <!-- <view class="" v-if="isShowStatus && dataContent.inventoryStatus">
<move-status :fromInventoryStatus="dataContent.inventoryStatus"> <move-status :fromInventoryStatus="dataContent.inventoryStatus">
</move-status> </move-status>
</view> -->
</view> </view>
</view>
</view> </view>
<!-- <u-line></u-line> --> <!-- <u-line></u-line> -->
</view> </view>

16
src/mycomponents/balance/balanceSelect.vue

@ -6,7 +6,14 @@
<item style="margin: 10rpx;" :dataContent="balanceItems[0]"></item> <item style="margin: 10rpx;" :dataContent="balanceItems[0]"></item>
<view class="popinpop count_shadow" style="width: 90vw;margin: 20rpx 20rpx 30rpx 20rpx;" <view class="popinpop count_shadow" style="width: 90vw;margin: 20rpx 20rpx 30rpx 20rpx;"
v-for="(item, index) in balanceItems" :key="item.id" @click="callback(item)"> v-for="(item, index) in balanceItems" :key="item.id" @click="callback(item)">
<balance :dataContent="item" :isShowStatus ="false"></balance> <balance :dataContent="item" :isShowStatus="false"></balance>
</view>
<view class="page-footer">
<view class="uni-flex space-between" style=" width: 100%; ">
<!-- <view class=" uni-flex uni-row"> -->
<button class="btn_single_reject" hover-class="btn_commit_after" @click="close">关闭</button>
<!-- </view> -->
</view>
</view> </view>
</scroll-view> </scroll-view>
</uni-popup> </uni-popup>
@ -37,9 +44,9 @@
}, },
methods: { methods: {
openPopup(items) { openPopup(items) {
if(Array.isArray(items)){ if (Array.isArray(items)) {
this.balanceItems = items; this.balanceItems = items;
}else{ } else {
this.balanceItems = [items]; this.balanceItems = [items];
} }
@ -52,6 +59,9 @@
this.$refs['popupItems'].close(); this.$refs['popupItems'].close();
}, },
close() {
this.$refs['popupItems'].close();
}
} }
} }
</script> </script>

2
src/mycomponents/record/recordComDetailCard.vue

@ -72,7 +72,7 @@
isShowStatus: { isShowStatus: {
type: Boolean, type: Boolean,
default: false default: true
}, },
isShowFromLocation: { isShowFromLocation: {

28
src/mycomponents/scan/winComScanBalance.vue

@ -72,7 +72,7 @@
type: Boolean, type: Boolean,
default: true default: true
}, },
bussinessCode:{ bussinessCode: {
type: String, type: String,
default: '' default: ''
} }
@ -116,11 +116,11 @@
getScanResult(result) { getScanResult(result) {
this.resultData = result; this.resultData = result;
if(!result.package){ if (!result.package) {
this.showErrorMessage(result.label.code+"包装信息为空") this.showErrorMessage(result.label.code + "包装信息为空")
return; return;
} }
this.getItemCodeType(result.package.itemCode,callBack=>{ this.getItemCodeType(result.package.itemCode, callBack => {
this.queryBalance(this.resultData) this.queryBalance(this.resultData)
}) })
}, },
@ -130,11 +130,15 @@
itemCode: result.package.itemCode, itemCode: result.package.itemCode,
batch: result.label.batch, batch: result.label.batch,
packingNumber: result.label.packingNumber, packingNumber: result.label.packingNumber,
parentPackingNumber:result.package.parentNumber, parentPackingNumber: result.package.parentNumber,
inventoryStatus: this.fromInventoryStatuses, inventoryStatus: this.fromInventoryStatuses,
areaType: this.fromLocationAreaTypeList, areaType: this.fromLocationAreaTypeList,
bussinessCode:this.bussinessCode bussinessCode: this.bussinessCode
} }
uni.showLoading({
title: '查询中',
mask: true
})
getBalanceByParams(params).then(res => { getBalanceByParams(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data.length == 0) { if (res.data.length == 0) {
@ -151,8 +155,8 @@
} else if (res.data.length == 1) { } else if (res.data.length == 1) {
result.balance = res.data[0] result.balance = res.data[0]
if(result.label.packingNumber!=result.balance.packingNumber){ if (result.label.packingNumber != result.balance.packingNumber) {
result.balance.lableQty=result.label.qty result.balance.lableQty = result.label.qty
} }
this.$emit("getBalance", result) this.$emit("getBalance", result)
// this.closeScanPopup() // this.closeScanPopup()
@ -166,7 +170,7 @@
this.showErrorMessage(error) this.showErrorMessage(error)
}) })
}, },
getItemCodeType(itemCode,callBack) { getItemCodeType(itemCode, callBack) {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
mask: true mask: true
@ -201,7 +205,7 @@
showErrorMessage(message) { showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => { this.$refs.comMessage.showErrorMessage(message, res => {
if (res) { if (res) {
if(this.$refs.comscan){ if (this.$refs.comscan) {
this.$refs.comscan.getfocus() this.$refs.comscan.getfocus()
} }
} }
@ -215,8 +219,8 @@
closeScanPopup() { closeScanPopup() {
this.$refs.popup.close() this.$refs.popup.close()
}, },
getfocus(){ getfocus() {
if(this.$refs.comscan){ if (this.$refs.comscan) {
this.$refs.comscan.getfocus() this.$refs.comscan.getfocus()
} }
} }

666
src/pages/repleinsh/record/repleinshRecord.vue

@ -1,44 +1,58 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper">
<view class=""> <view class="">
<com-blank-view @goScan='showRequestPopup' v-if="detailSource.length==0"></com-blank-view> <com-blank-view @goScan='getBusinessType' v-if="recommendList.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="recommendList.length>0">
<view class="page-header">
<view class="header_item" style="font-size:35rpx; padding: 10rpx;">
<uni-collapse ref="collapse">
<uni-collapse-item :open="true">
<template v-slot:title>
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx;">
先进先出推荐信息
</view>
</template>
<view class="detail-list" v-for="(recommend, index) in recommendList" :key="recommend.id">
<view class="card_view">
<text class="card_item_code ">物料代码</text>
<text class="card_content ">{{recommend.itemCode}}</text>
</view>
<balance :dataContent='recommend' :isShowStatus='false'></balance>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</view> </view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-main"> <view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(toLocation, index) in detailSource" :key="index"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class=""> <view class="">
<view class="page-header"> <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
<view class="text_lightblue fontsize-16">目标库位:{{toLocation.toLocationCode}}</view> :isShowFromLocation="true" @removeItem="removeItem(index,item)"
</view> :isShowToLocation="false" @updateData="updateData" @removePack="removePack">
<com-issue-detail-card ref='comRepleinshDetailCard' :dataContent="toLocation" </record-com-detail-card>
@updateData='updateData'>
</com-issue-detail-card>
</view> </view>
<!-- <view class='split_line'></view> -->
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="page-footer"> <view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" <view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; "> style="background-color:ghostwhite; width: 100%; ">
<view class=""> <view class="">
<requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode"
@getLocation='getToLocationCode' :locationAreaTypeList="toLocationAreaTypeList">
</requiredLocation>
</view> </view>
<view class=" uni-flex uni-row"> <view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button> <button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view> </view>
</view> </view>
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</view> </view>
<com-repleinsh-request-popup ref="comRepleinshRequestPopup" :toLocationAreaTypeList="toLocationAreaTypeList" <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
@confirm='requestConfirm' </winComScanBalance>
:itemCodeTypeList="itemCodeTypeList">
</com-repleinsh-request-popup>
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</com-scan-issue-pack>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
@ -46,93 +60,91 @@
<script> <script>
import { import {
repleinshRecordSubmit, repleinshRecordSubmit,
validateItemAndLocation,
getPutawayRecommendLocation,
getBalanceByFilter,
getBalanceByBatchOffShelf getBalanceByBatchOffShelf
} from '@/api/request2.js'; } from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import { import {
goHome, goHome,
updateTitle,
getCurrDateTime, getCurrDateTime,
getPackingNumberAndBatch getPackingNumberAndBatchByList,
deepCopyData
} from '@/common/basic.js'; } from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import { import {
getInventoryStatusDesc, getInventoryStatusDesc,
getDirectoryItemArray getDirectoryItemArray
} from '@/common/directory.js'; } from '@/common/directory.js';
import {
getDetailOption,
getDetailRemoveOption,
getDetailEditRemoveOption
} from '@/common/array.js';
import { import {
getBusinessType, getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty calcHandleQty
} from '@/common/record.js'; } from '@/common/record.js';
import { import {
getDataSource getManagementPrecisions,
} from '@/pages/issue/js/issue.js'; getPrecisionStrategyList,
getPrecisionStrategyParams
import {
getManagementPrecisions
} from '@/common/balance.js'; } from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue' import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue' import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import comRepleinshRequestPopup from '@/pages/repleinsh/coms/comRepleinshRequestPopup.vue' import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' import balance from '@/mycomponents/balance/balance.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
export default { export default {
components: { components: {
winScanButton, winScanButton,
winScanPack, winScanPack,
requiredLocation,
comBlankView, comBlankView,
winScanLocation,
winScanPackAndLocation, winScanPackAndLocation,
recordComDetailCard, recordComDetailCard,
comRepleinshRequestPopup, winComScanBalance,
comIssueDetailCard, balance
comScanIssuePack
}, },
data() { data() {
return { return {
id: '', id: '',
receiptJob: {}, dataContent: {}, //
subList: [], //subList
detailSource: [], // detailSource: [], //
businessTypeInfo: {},
fromLocationCode: "", fromLocationCode: "",
toLocationCode: "", fromLocationAreaTypeList: [],
toLocationAreaTypeList: [], toLocationAreaTypeList: [],
allowModifyLocation: false, inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {}, businessType: {},
requestList: [], showToLoaction: true,
managementList: [], recommendLocationList: [], //
dataContent: {}, fromWarehouseCode: '', //
itemCodeTypeList:[] businessTypeCode: "Repleinment",
toLocationCode: "",
resultData: {},
itemCode: "",
recommendList: []
}; };
}, },
onLoad(option) { onLoad(option) {
var typeCode = "Repleinment" uni.setNavigationBarTitle({
getBusinessType(typeCode, res => { title: option.title
if (res.success) { })
this.businessType = res.businessType; this.clear();
this.itemCodeTypeList = res.itemCodeTypeList; this.getBusinessType()
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showRequestPopup();
} else {
this.showErrorMessage(res.message)
}
});
}, },
// //
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
@ -146,77 +158,115 @@
onPullDownRefresh() {}, onPullDownRefresh() {},
mounted() {}, mounted() {},
methods: { methods: {
closeScan() { getBusinessType() {
this.resizeCollapse(); getBusinessType(this.businessTypeCode, res => {
}, if (res.success) {
resizeCollapse() { this.businessType = res.businessType;
this.$nextTick(r => { this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.$refs.comRepleinshDetailCard.forEach(r => { this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
r.resizeCollapse(); this.openScanPopup();
}) } else {
this.showErrorMessage(res.message)
}
}); });
}, },
showRequestPopup() { getBalance(label, packageInfo, callback) {
this.$refs.comRepleinshRequestPopup.openRequestPopup(); var filters = []
},
//
requestConfirm(action, item) {
if (item.itemCode == '' || item.itemCode == null) return;
let that = this;
let request = that.requestList.find(r => r.itemCode == item.itemCode);
if (request == undefined) {
that.requestList.push(item);
this.getRecommendInfo(item);
if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else { } else {
this.$refs.comMessage.showQuestionMessage('已经存在物料[' + item.itemCode + ']的需求信息,是否要修改?', res => { filters.push({
if (res) { column: "packingNumber",
request.qty = item.qty; action: "==",
that.detailSource.forEach(detail => { value: label.packingNumber
let index = detail.Items.findIndex(r => { })
r.itemCode == item.itemCode }
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
}) })
detail.Items.splice(index, 1);
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.fromInventoryStatuses
}) })
this.getRecommendInfo(item);
} }
});
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
},
getScanResult(result) {
let that = this;
let pack = result.package;
if (that.recommendList.length > 0) {
let recommend = that.recommendList.filter(r => r.itemCode == pack.itemCode);
if (recommend.length == 0) {
this.showErrorMessage('物料代码【' + pack.itemCode + '】不在推荐列表中');
} else {
let batch = recommend.find(r => r.batch == pack.batch);
if (batch == undefined) {
that.showErrorMessage('扫描的批次【' + pack.batch + '】,不是系统推荐的批次,不满足系统的先进先出规则,请重新扫描物料');
} else {
this.setData(result);
}
}
} else {
this.getRecommendInfo(result);
} }
}, },
getRecommendInfo(item) { getRecommendInfo(result) {
let that = this; let that = this;
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
mask: true mask: true
}) })
let item = {
itemCode: result.package.itemCode,
qty: result.package.qty,
}
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => { getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => {
if (res.data == null) { if (res.data == null) {
that.showMessage('未获取到推荐信息'); that.showErrorMessage('未获取到推荐信息');
} else { } else {
if (res.data.length > 0) { if (res.data.length > 0) {
res.data.forEach(r => { that.recommendList = res.data;
r.toLocationCode = item.toLocation.code; that.recommendList.forEach(r => r.locationCode = r.fromLocationCode)
r.itemName = item.itemName let recommendInfo = res.data[0];
r.uom = item.uom; if (recommendInfo.batch != result.package.batch) {
that.subList.push(r); that.showErrorMessage('扫描的批次【' + result.package.batch + '】,不是系统推荐的批次【' +
}) recommendInfo.batch + '】,不满足系统的先进先出规则,请重新扫描');
} else {
that.detailSource = getDataSource(that.detailSource, that.subList) this.setData(result);
// }
that.detailSource.forEach(detail => {
detail.Items.forEach(i => {
let request = that.requestList.find(r => r
.itemCode == i
.itemCode);
i.qty = request.qty;
})
})
// that.resizeCollapse();
} else { } else {
that.showMessage('列表数据为0'); that.showErrorMessage('未查找到物料的推荐信息');
} }
uni.hideLoading(); uni.hideLoading();
} }
@ -226,76 +276,98 @@
}) })
}, },
setData(result) {
caclcQty() { let balance = result.balance;
var totalQty = 0; let label = result.label;
this.detailSource.subList.forEach(res => { let pack = result.package;
totalQty = calc.add(totalQty, res.qty) if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) {
}) this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this
this.detailSource.totalQty = totalQty; .fromLocationCode + "]没有库存余额")
}, return;
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
var dataContent = {
allowModifyPackingNumber: "FALSE",
outInventoryStatuses: this.fromInventoryStatuses
} }
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, dataContent);
},
closeScanPopup() {
this.updateCommitBtn();
},
updateData(record) { var item = this.detailSource.find(res => {
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); if (res.itemCode == balance.itemCode) {
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode); return res
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; if (item == undefined) {
itemHandleQty = calc.add(itemHandleQty, handleQty) if (this.itemCode != "" && this.itemCode != balance.itemCode) {
this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码")
return;
}
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
} }
}) })
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
} }
this.resizeCollapse(); item.subList.push(newDetail);
// item.handleQty=itemHandleQty; this.scanPopupGetFocus()
// this.closeScan(); } else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]已经在列表中")
}
}
}
calcHandleQty(this.detailSource);
}, },
showErrorMessage(message) { showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => { this.$refs.comMessage.showErrorMessage(message, res => {
if (res) { if (res) {
this.scanPopupGetFocus()
} }
}); });
}, },
calcHandleQty() {
for (let item of this.detailSource) { updateData() {
item.qty = 0; calcHandleQty(this.detailSource);
for (let detail of item.subList) { for (var i = 0; i < this.detailSource.length; i++) {
if (detail != undefined) { let item = this.detailSource[i];
item.qty = calc.add(item.qty,detail.qty) if (item.qty == 0) {
} this.detailSource.splice(i, 1)
} }
} }
this.$forceUpdate(); this.$forceUpdate();
}, },
removeItem(index, item) { removeItem(index, item) {
this.detailSource.splice(index, 1) this.detailSource.splice(index, 1)
this.updateData();
}, },
removePack() { removePack() {
@ -309,169 +381,142 @@
}, },
openScanPopup() { openScanPopup() {
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); if (this.businessType) {
this.$refs.scanPopup.openScanPopup(this.businessType);
} else {
this.getBusinessType()
}
}, },
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() { closeScanPopup() {
if (this.$refs.scanPopup != undefined) { if (this.$refs.scanPopup) {
this.$refs.scanPopup.closeScanPopup(); this.$refs.scanPopup.closeScanPopup();
} }
}, },
scanPopupGetFocus() { scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) { if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus(); this.$refs.scanPopup.getfocus();
} }
}, },
submit() { scanLocationCode(location, code) {
if(this.getScanCount()==0){ this.toLocationCode = code
this.showErrorMessage("当前扫描数为0,请先扫描在提交"); },
return
commit() {
if (this.toLocationCode == "") {
this.showMessage("请输入目标库位")
return;
} }
if (this.detailSource.length == 0) {
this.showMessage("请扫描要发货的物料")
return;
}
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = this.toLocationCode
detail.fromLocation = this.fromLocationCode
})
})
uni.showLoading({ uni.showLoading({
title: "提交中....", title: "提交中....",
mask: true mask: true
}); });
// //
var itemCodes = [] let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource);
let locationCode = this.detailSource[0].toLocationCode //2:
this.detailSource.forEach(toLocation => { getPrecisionStrategyList(precisionStrategyParams, res => {
toLocation.Items.forEach(item => {
itemCodes.push(item.itemCode)
})
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
this.submitJob(); var params = this.setRecordParams()
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
submitJob() {
var params = this.setParams()
console.log("提交参数", JSON.stringify(params)); console.log("提交参数", JSON.stringify(params));
repleinshRecordSubmit(params).then(res => { repleinshRecordSubmit(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成补料记录<br>" + res.data) this.showCommitSuccessMessage("提交成功<br>生成直接补料记录<br>" + res.data)
} else { } else {
this.showErrorMessage("提交失败[" + res.msg+"]") this.showErrorMessage("提交失败[" + res.msg + "]")
} }
}).catch(error => { }).catch(error => {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(error) this.showErrorMessage(error)
}) })
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
}, },
setParams() {
setRecordParams() {
var subList = [] var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => { this.detailSource.forEach(item => {
toLocationCode.Items.forEach(item => { item.subList.forEach(detail => {
item.Locations.forEach(fromLocation => { if (detail.scaned) {
fromLocation.Batchs.forEach(batch => { var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
let subItem = batch.detail; detail.packingNumber, detail.toLocationCode, detail.batch);
subItem.recordList = []; var submitItem = deepCopyData(detail)
submitItem.toPackingNumber = info.packingNumber;
if (batch.Records.length > 0) { submitItem.toBatch = info.batch;
batch.Records.forEach(r => { submitItem.toContainerNumber = detail.containerNumber;
let record = {};
record.handleQty = r.qty; submitItem.fromPackingNumber = info.packingNumber;
submitItem.fromBatch = info.batch;
record.fromPackingNumber = r submitItem.fromContainerNumber = detail.containerNumber;
.packingNumber;
record.fromBatch = r.batch; submitItem.fromLocationCode = detail.locationCode;
record.fromContainerNumber = r submitItem.toLocationCode = detail.toLocationCode;
.ContainerNumber;
// detail.toInventoryStatus = detail.inventoryStatus
record.toContainerNumber = r // detail.toLocationCode = detail.toLocationCode
.ContainerNumber; submitItem.qty = detail.handleQty;
record.toInventoryStatus = r submitItem.package = "";
.inventoryStatus; submitItem.recordList = [{
record.toLocationCode = subItem toInventoryStatus: detail.inventoryStatus,
.toLocationCode; fromPackingNumber: info.packingNumber,
record.fromLocationCode = fromLocation fromParentPackingNumber: detail.parentNumber,
.fromLocationCode fromBatch: info.batch,
record.supplierCode = r.supplierCode;
toPackingNumber: info.packingNumber,
//使
var info = getPackingNumberAndBatch( toBatch: info.batch,
this.managementList, r fromLocationCode: detail.locationCode,
.itemCode, toLocationCode: detail.toLocationCode,
r.packingNumber, r handleQty: detail.handleQty,
.batch); fromPackUnit: detail.packUnit,
record.toPackingNumber = info toPackUnit: detail.packUnit,
.packingNumber; fromPackQty: detail.packQty,
record.toBatch = info.batch; toPackQty: detail.packQty
subItem.recordList.push(record); }]
}) subList.push(submitItem)
subList.push(subItem);
} }
}) })
}) })
}) if (subList.length > 0) {
}) this.dataContent.toWarehouseCode = subList[0].toWarehouseCode;
}
this.dataContent.subList = subList this.dataContent.subList = subList
this.dataContent.createTime = createTime;
this.dataContent.creator = creator; this.dataContent.creator = creator;
this.dataContent.fromWarehouseCode = this.fromWarehouseCode;
return this.dataContent; return this.dataContent;
}, },
getScanCount(){
var scanCount = 0;
var subList = []
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
return scanCount =subList.length;
},
showMessage(message) { showMessage(message) {
this.$refs.comMessage.showMessage(message, res => { this.$refs.comMessage.showMessage(message, res => {
if (res) {} if (res) {}
}); });
}, },
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) { showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message); this.$refs.comMessage.showScanMessage(message);
@ -484,75 +529,34 @@
closeScanMessage() { closeScanMessage() {
this.scanPopupGetFocus(); this.scanPopupGetFocus();
}, },
getLocation(location, code) {
this.getToLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) { getToLocationCode(location, code) {
// if (this.fromLocationCode == code) { if (this.fromLocationCode == code) {
// uni.showToast({ uni.showToast({
// title: "[" + this.fromLocationCode + "][" + code + "]", title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致",
// duration: 2000 duration: 2000
// }) })
// return return
// } }
this.ToLocationCodeInfo = location;
this.toLocationCode = code; this.toLocationCode = code;
}, },
showCommitSuccessMessage(hint) { showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => { this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData(); this.clear();
}) })
}, },
clearData() {
clear() {
this.fromLocationCode = ''; this.fromLocationCode = '';
this.fromWarehouseCode = '';
this.toWarehouseCode = '';
this.detailSource = []; this.detailSource = [];
this.requestList = []; this.toLocationCode = "";
this.dataContent = {} this.itemCode = ""
this.managementList = [] }
},
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
page {
width: 100%;
height: 100%;
background-color: #fff;
}
.page-wraper {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.page-main-list {
/* height: 80rpx;
line-height: 80rpx; */
text-align: center;
background: #e0e0e0;
}
</style> </style>

558
src/pages/repleinsh/record/repleinshRecordV1.vue

@ -0,0 +1,558 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='showRequestPopup' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(toLocation, index) in detailSource" :key="index">
<view class="">
<view class="page-header">
<view class="text_lightblue fontsize-16">目标库位:{{toLocation.toLocationCode}}</view>
</view>
<com-issue-detail-card ref='comRepleinshDetailCard' :dataContent="toLocation"
@updateData='updateData'>
</com-issue-detail-card>
</view>
<!-- <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="submit">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<com-repleinsh-request-popup ref="comRepleinshRequestPopup" :toLocationAreaTypeList="toLocationAreaTypeList"
@confirm='requestConfirm'
:itemCodeTypeList="itemCodeTypeList">
</com-repleinsh-request-popup>
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</com-scan-issue-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
repleinshRecordSubmit,
getBalanceByBatchOffShelf
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
goHome,
getCurrDateTime,
getPackingNumberAndBatch
} from '@/common/basic.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getDetailOption,
getDetailRemoveOption,
getDetailEditRemoveOption
} from '@/common/array.js';
import {
getBusinessType,
calcHandleQty
} from '@/common/record.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import comRepleinshRequestPopup from '@/pages/repleinsh/coms/comRepleinshRequestPopup.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
export default {
components: {
winScanButton,
winScanPack,
comBlankView,
winScanPackAndLocation,
recordComDetailCard,
comRepleinshRequestPopup,
comIssueDetailCard,
comScanIssuePack
},
data() {
return {
id: '',
receiptJob: {},
subList: [], //subList
detailSource: [], //
businessTypeInfo: {},
fromLocationCode: "",
toLocationCode: "",
toLocationAreaTypeList: [],
allowModifyLocation: false,
businessType: {},
requestList: [],
managementList: [],
dataContent: {},
itemCodeTypeList:[]
};
},
onLoad(option) {
var typeCode = "Repleinment"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.itemCodeTypeList = res.itemCodeTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showRequestPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
closeScan() {
this.resizeCollapse();
},
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comRepleinshDetailCard.forEach(r => {
r.resizeCollapse();
})
});
},
showRequestPopup() {
this.$refs.comRepleinshRequestPopup.openRequestPopup();
},
//
requestConfirm(action, item) {
if (item.itemCode == '' || item.itemCode == null) return;
let that = this;
let request = that.requestList.find(r => r.itemCode == item.itemCode);
if (request == undefined) {
that.requestList.push(item);
this.getRecommendInfo(item);
} else {
this.$refs.comMessage.showQuestionMessage('已经存在物料[' + item.itemCode + ']的需求信息,是否要修改?', res => {
if (res) {
request.qty = item.qty;
that.detailSource.forEach(detail => {
let index = detail.Items.findIndex(r => {
r.itemCode == item.itemCode
})
detail.Items.splice(index, 1);
})
this.getRecommendInfo(item);
}
});
}
},
getRecommendInfo(item) {
let that = this;
uni.showLoading({
title: '加载中...',
mask: true
})
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => {
if (res.data == null) {
that.showMessage('未获取到推荐信息');
} else {
if (res.data.length > 0) {
res.data.forEach(r => {
r.toLocationCode = item.toLocation.code;
r.itemName = item.itemName
r.uom = item.uom;
that.subList.push(r);
})
that.detailSource = getDataSource(that.detailSource, that.subList)
//
that.detailSource.forEach(detail => {
detail.Items.forEach(i => {
let request = that.requestList.find(r => r
.itemCode == i
.itemCode);
i.qty = request.qty;
})
})
// that.resizeCollapse();
} else {
that.showMessage('列表数据为0');
}
uni.hideLoading();
}
}).catch(error => {
uni.hideLoading()
that.showErrorMessage(error)
})
},
caclcQty() {
var totalQty = 0;
this.detailSource.subList.forEach(res => {
totalQty = calc.add(totalQty, res.qty)
})
this.detailSource.totalQty = totalQty;
},
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
var dataContent = {
allowModifyPackingNumber: "FALSE",
outInventoryStatuses: this.fromInventoryStatuses
}
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, dataContent);
},
closeScanPopup() {
this.updateCommitBtn();
},
updateData(record) {
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;
// this.closeScan();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
calcHandleQty() {
for (let item of this.detailSource) {
item.qty = 0;
for (let detail of item.subList) {
if (detail != undefined) {
item.qty = calc.add(item.qty,detail.qty)
}
}
}
this.$forceUpdate();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
removePack() {
for (var i = 0; i < this.detailSource.length; i++) {
var item = this.detailSource[i];
if (item.subList.length == 0) {
this.detailSource.splice(i, 1)
}
}
this.updateData();
},
openScanPopup() {
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
submit() {
if(this.getScanCount()==0){
this.showErrorMessage("当前扫描数为0,请先扫描在提交");
return
}
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()
console.log("提交参数", JSON.stringify(params));
repleinshRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成补料记录<br>" + 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;
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.fromLocationCode = fromLocation
.fromLocationCode
record.supplierCode = r.supplierCode;
//使
var info = getPackingNumberAndBatch(
this.managementList, r
.itemCode,
r.packingNumber, r
.batch);
record.toPackingNumber = info
.packingNumber;
record.toBatch = info.batch;
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
this.dataContent.subList = subList
this.dataContent.createTime = createTime;
this.dataContent.creator = creator;
return this.dataContent;
},
getScanCount(){
var scanCount = 0;
var subList = []
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
return scanCount =subList.length;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
getLocation(location, code) {
this.getToLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) {
// if (this.fromLocationCode == code) {
// uni.showToast({
// title: "[" + this.fromLocationCode + "][" + code + "]",
// duration: 2000
// })
// return
// }
this.ToLocationCodeInfo = location;
this.toLocationCode = code;
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
clearData() {
this.fromLocationCode = '';
this.detailSource = [];
this.requestList = [];
this.dataContent = {}
this.managementList = []
},
}
}
</script>
<style scoped lang="scss">
page {
width: 100%;
height: 100%;
background-color: #fff;
}
.page-wraper {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.page-main-list {
/* height: 80rpx;
line-height: 80rpx; */
text-align: center;
background: #e0e0e0;
}
</style>
Loading…
Cancel
Save