Browse Source

修改直接发料和直接补料 2024/8/8

hella_vue3
王志国 1 month ago
parent
commit
d3517108ba
  1. 230
      src/mycomponents/scan/winComScanBalance.vue
  2. 2
      src/pages.json
  3. 4
      src/pages/issue/record/directIssue.vue
  4. 9
      src/pages/repleinsh/record/directRepleinshRecord.vue

230
src/mycomponents/scan/winComScanBalance.vue

@ -3,20 +3,24 @@
<uni-popup ref="popup" :mask-click="false"> <uni-popup ref="popup" :mask-click="false">
<view class="popup_box"> <view class="popup_box">
<view class="pop_title uni-flex space-between"> <view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx"> 扫描{{ title }} </view> <view class="" style="font-size: 35rpx;">
扫描{{title}}
</view>
<view class=""> <view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"></image> <image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg"
@click="closeScanPopup()"></image>
</view> </view>
</view> </view>
<view class=""> <view class="">
<view class=""> <view class="">
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :isShowHistory="isShowHistory" :clearResult="true" :headerType="headerType"></win-com-scan> <win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult"
:isShowHistory="isShowHistory" :clearResult="true" :headerType="headerType"></win-com-scan>
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<balance-select ref="balanceSelect" @onSelectItem="selectBalanceItem"></balance-select> <balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
</view> </view>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</template> </template>
@ -24,15 +28,28 @@
<script> <script>
import winComScan from '@/mycomponents/scan/winComScan.vue' import winComScan from '@/mycomponents/scan/winComScan.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import { getBalanceByManagementPrecisionByPacking } from '@/common/balance.js' import {
getBalanceByManagementPrecisionByPacking,
import { getBalanceByParams, getBasicItemByCode } from '@/api/request2.js' } from '@/common/balance.js';
import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc, getListItemTypeDesc, getItemTypeInfo } from '@/common/directory.js' import {
getBalanceByParams,
getBasicItemByCode,
getBalanceByFilter
} from '@/api/request2.js';
import {
getListLocationAreaTypeDesc,
checkDirectoryItemExist,
getDirectoryItemArray,
getLocationAreaTypeName,
getInventoryStatusDesc,
getListItemTypeDesc,
getItemTypeInfo
} from '@/common/directory.js';
export default { export default {
name: 'winScanPack', name: 'winScanPack',
emits: ['getBalance'], emits: ["getBalance"],
components: { components: {
winComScan, winComScan,
balanceSelect balanceSelect
@ -48,10 +65,9 @@ export default {
}, },
headerType: { headerType: {
type: String, type: String,
default: 'HPQ,HMQ' default: "HPQ,HMQ"
}, },
balanceFromInventoryStatuses: { balanceFromInventoryStatuses: { //fromInventoryStatuses
// fromInventoryStatuses
type: Boolean, type: Boolean,
default: true default: true
}, },
@ -76,6 +92,8 @@ export default {
fromLocation: '', fromLocation: '',
fromLocationList: [], fromLocationList: [],
fromLocationAreaTypeList: [], fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
locationOnFocus: false, locationOnFocus: false,
businessType: {}, businessType: {},
inventoryStatus: [], inventoryStatus: [],
@ -86,29 +104,93 @@ export default {
resultData: {} resultData: {}
} }
}, },
created() {}, created() {
},
methods: { methods: {
openScanPopup(businessType) { openScanPopup(businessType) {
this.businessType = businessType this.businessType = businessType
this.fromInventoryStatuses = getDirectoryItemArray(businessType.outInventoryStatuses) this.fromInventoryStatuses = getDirectoryItemArray(businessType.outInventoryStatuses)
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes) this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes)
this.toLocationAreaTypeList = getDirectoryItemArray(businessType.inAreaTypes)
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) this.itemTypesList = getDirectoryItemArray(businessType.itemTypes)
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
}, },
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.getToLocationBalance(this.resultData)
//this.queryBalance(this.resultData)
})
},
//
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.packingNumber
})
}
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,
} }
this.getItemCodeType(result.package.itemCode, (callBack) => { getBalanceByFilter(params).then(res => {
this.queryBalance(this.resultData) uni.hideLoading()
if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
} else {
this.queryBalance(this.resultData);
}
// callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
}) })
}, },
queryBalance(result) { queryBalance(result) {
const params = { var params = {
itemCode: result.package.itemCode, itemCode: result.package.itemCode,
batch: result.label.batch, batch: result.label.batch,
packingNumber: result.label.packingNumber, packingNumber: result.label.packingNumber,
@ -121,84 +203,92 @@ export default {
title: '查询中', title: '查询中',
mask: true mask: true
}) })
getBalanceByParams(params) getBalanceByParams(params).then(res => {
.then((res) => { uni.hideLoading()
uni.hideLoading() if (res.data.length == 0) {
if (res.data.length == 0) { var status = getInventoryStatusDesc(params.inventoryStatus)
const status = getInventoryStatusDesc(params.inventoryStatus) var areaType = getListLocationAreaTypeDesc(params.areaType)
const areaType = getListLocationAreaTypeDesc(params.areaType) var hint =
const hint = `按物料号 [${params.itemCode}] <br>` + `包装号 [${params.packingNumber}] <br>` + `批次 [${params.batch}] <br>` + `状态 [${status}] <br>` + `库区 [${areaType}] <br>` + '未查找到库存余额' "按物料号 [" + params.itemCode + "] <br>" +
this.showErrorMessage(hint) "包装号 [" + params.packingNumber + "] <br>" +
} else if (res.data.length == 1) { "批次 [" + params.batch + "] <br>" +
result.balance = res.data[0] "状态 [" + status + "] <br>" +
if (result.label.packingNumber != result.balance.packingNumber) { "库区 [" + areaType + "] <br>" +
result.balance.lableQty = result.label.qty "未查找到库存余额"
} this.showErrorMessage(hint)
this.$emit('getBalance', result) } else if (res.data.length == 1) {
// this.closeScanPopup()
} else { result.balance = res.data[0]
// if (result.label.packingNumber != result.balance.packingNumber) {
this.$refs.balanceSelect.openPopup(res.data) result.balance.lableQty = result.label.qty
} }
}) this.$emit("getBalance", result)
.catch((error) => { // this.closeScanPopup()
uni.hideLoading() } else {
this.showErrorMessage(error) //
}) this.$refs.balanceSelect.openPopup(res.data);
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
}, },
getItemCodeType(itemCode, callBack) { getItemCodeType(itemCode, callBack) {
uni.showLoading({ uni.showLoading({
title: '加载中', title: "加载中",
mask: true mask: true
}) })
getBasicItemByCode(itemCode) getBasicItemByCode(itemCode).then(res => {
.then((res) => { if (res.data != null && res.data.list.length > 0) {
if (res.data != null && res.data.list.length > 0) { var result = res.data.list[0];
const result = res.data.list[0] var status = result.available;
const status = result.available var type = result.type;
const { type } = result if (status == "TRUE") {
if (status == 'TRUE') { if (checkDirectoryItemExist(this.itemTypesList, type)) {
if (checkDirectoryItemExist(this.itemTypesList, type)) { if (this.verifyCategory) {
if (this.verifyCategory) { if (result.category == 'LCJ' || result.category == 'BJ') {
if (result.category == 'LCJ' || result.category == 'BJ') {
callBack()
} else {
this.showErrorMessage('扫描物料的种类不是【量产件】或者【备件】')
}
} else {
callBack() callBack()
} else {
this.showErrorMessage("扫描物料的种类不是【量产件】或者【备件】")
} }
} else { } else {
const hint = getListItemTypeDesc(this.itemTypesList) callBack()
uni.hideLoading()
this.showErrorMessage(`扫描物料[${itemCode}]是[${getItemTypeInfo(type).label}],需要的物料类型是[${hint}]`)
} }
} else { } else {
var hint = getListItemTypeDesc(this.itemTypesList);
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(`物料【${itemCode}】不可用`) this.showErrorMessage("扫描物料[" + itemCode + "]是[" +
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]")
} }
} else { } else {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(`未查找到物料【${itemCode}`) this.showErrorMessage('物料【' + itemCode + '】不可用');
} }
}) } else {
.catch((error) => {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(error) this.showErrorMessage('未查找到物料【' + itemCode + '】');
}) }
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error)
})
}, },
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()
} }
} }
}) });
}, },
selectBalanceItem(item) { selectBalanceItem(item) {
this.resultData.balance = item this.resultData.balance = item
this.$emit('getBalance', this.resultData) this.$emit("getBalance", this.resultData)
// this.closeScanPopup() // this.closeScanPopup()
}, },
closeScanPopup() { closeScanPopup() {

2
src/pages.json

@ -690,7 +690,7 @@
{ {
"path": "pages/repleinsh/record/repleinshRecord", "path": "pages/repleinsh/record/repleinshRecord",
"style": { "style": {
"navigationBarTitleText": "补料记录", "navigationBarTitleText": "超市先进先出补料",
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"titleNView": { "titleNView": {
"autoBackButton": "true" "autoBackButton": "true"

4
src/pages/issue/record/directIssue.vue

@ -246,9 +246,11 @@ const getScanResult = (result) => {
const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value) const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value)
if (manyBlances.length > 0) { if (manyBlances.length > 0) {
locationCode = manyBlances[0].locationCode locationCode = manyBlances[0].locationCode
showErrorMessage(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`)
}else {
afterGetBalance(result)
} }
} }
showErrorMessage(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`)
} }
} }
} }

9
src/pages/repleinsh/record/directRepleinshRecord.vue

@ -6,14 +6,19 @@
<view class="page-wraper" v-if="detailSource.length > 0"> <view class="page-wraper" v-if="detailSource.length > 0">
<view class="page-header"> <view class="page-header">
<view class="page-header-box"> <view class="page-header-box">
<view class="header_item u-p-t-20" style="font-size: 35rpx; padding: 10rpx"> 来源库位 : {{ fromLocationCode }} </view> <view class="header-view">
<view class="header_item u-p-t-20" style="font-size: 35rpx; padding: 10rpx"> 来源库位 : {{ fromLocationCode }} </view>
</view>
</view> </view>
</view> </view>
<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="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class=""> <view class="">
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="false" @removeItem="removeItem(index, item)" :isShowToLocation="false" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index, item)"
:isShowToLocation="false" @updateData="updateData" @removePack="removePack">
</record-com-detail-card>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>

Loading…
Cancel
Save