Browse Source

整理预生产上架功能 2024/8/2

hella_vue3
王志国 1 month ago
parent
commit
c0ee72332a
  1. 18
      src/common/array.js
  2. 7
      src/common/record.js
  3. 25
      src/mycomponents/record/recordComDetailCard.vue
  4. 14
      src/mycomponents/scan/winScanPackage.vue
  5. 72
      src/pages/productPutaway/record/productPutawayRecord.vue

18
src/common/array.js

@ -277,7 +277,23 @@ export function getEditRemoveOption() {
return option_edit_remove;
}
//详情编辑移除
export function getEditLocationRemoveOption() {
let option_edit_remove = [{
text: '修改\n库位',
style: {
backgroundColor: '#F1A532'
}
},
{
text: '移除',
style: {
backgroundColor: '#F56C6C'
}
}
];
return option_edit_remove;
}
// 库存状态字典项
export function getInventoryStatusArray() {
let array = [{

7
src/common/record.js

@ -7,9 +7,9 @@ import {
} from '@/common/directory.js';
import { calc } from '@/common/calc'
import { Decimal } from 'decimal.js';//引入
import {
import {
deepCopyData
} from '@/common/basic.js';
} from '@/common/basic.js';
export function createItemInfo(balance, pack) {
let item = {
@ -18,10 +18,11 @@ export function createItemInfo(balance, pack) {
packQty: pack.packQty,
packUnit: pack.packUnit,
qty: new Decimal(balance.qty).toNumber(),
handleQty:new Decimal(0).toNumber(),
handleQty: new Decimal(0).toNumber(),
uom: pack.uom,
subList: []
}
item.containerNumber = pack.parentNumber != null ? pack.parentNumber : pack.number;
return item;
}

25
src/mycomponents/record/recordComDetailCard.vue

@ -5,6 +5,10 @@
<template v-slot:title>
<u-swipe-action :show="false" style="width: 90%" :options="removeOptions" bg-color="rgba(255,255,255,0)" @click="(...event) => removeItem(event, dataContent)">
<item-qty :dataContent="dataContent" :isShowBalance="true" :isShowBalanceQty="isShowBalanceQty"></item-qty>
<view style="margin-left: 10px; margin-top: 5px;">
<pack title='父包装' :packingCode='dataContent.containerNumber'></pack>
<location title='目标库位' :locationCode='dataContent.toLocationCode'></location>
</view>
</u-swipe-action>
</template>
<u-swipe-action :show="detail.show" :index="index" v-for="(detail, index) in dataContent.subList" :key="index" :options="detail.scaned ? scanOptions : detailOptions" bg-color="rgba(255,255,255,0)" class="u-m-b-20" @click="(...event) => swipeClick(event, detail)">
@ -23,9 +27,11 @@ import { ref, onMounted, nextTick, watch } from 'vue'
import itemQty from '@/mycomponents/item/itemQty.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import location from '@/mycomponents/balance/location.vue'
import recordDetailPopup from '@/mycomponents/detail/recordDetailPopup.vue'
import { getDetailOption, getDetailEditRemoveOption, getClearOption } from '@/common/array.js'
import pack from '@/mycomponents/balance/pack.vue'
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue'
import { getDetailOption, getDetailEditRemoveOption, getClearOption,getEditLocationRemoveOption } from '@/common/array.js'
const props = defineProps({
dataContent: {
@ -94,16 +100,18 @@ dataContent.value.subList.forEach((item) => {
onMounted(() => {
detailOptions.value = getDetailOption()
scanOptions.value = getDetailEditRemoveOption()
removeOptions.value = getClearOption()
removeOptions.value = getEditLocationRemoveOption()
})
const removeItem = (params, dataContent) => {
const { text } = removeOptions.value[params[1]]
if (text == '清空') {
if (text == '移除') {
comMessageRef.value.showQuestionMessage('确定清空物料及箱码信息?', (res) => {
if (res) {
emit('removeItem')
emit('removeItem',dataContent)
}
})
}else {
editLocation(dataContent)
}
}
const swipeClick = (params, item) => {
@ -141,9 +149,12 @@ const confirm = (qty) => {
editItem.value.handleQty = qty
emit('updateData')
}
const editLocation = (item)=> {
editItem.value = item;
emit('editLocation', item)
}
//
const emit = defineEmits(['updateData', 'removePack'])
const emit = defineEmits(['updateData', 'removePack','editLocation'])
</script>
<style>

14
src/mycomponents/scan/winScanPackage.vue

@ -153,7 +153,16 @@ const getBalance = (result, callback) => {
}
getBalanceByFilter(params)
.then((res) => {
if (res.data.list.length == 0) {
if (res.data.list.length > 0) {
res.data.list.forEach(r => {
if (packageInfo.parentNumber !== null) {
r.parentPackingNumber = packageInfo.parentNumber
} else {
r.parentPackingNumber = packageInfo.number
}
})
callback(res.data.list)
} else {
//
if (packageInfo.subList.length > 0) {
let packparams = '';
@ -175,6 +184,7 @@ const getBalance = (result, callback) => {
this.packGetFocus();
})
} else {
res1.data.list.forEach(r => r.parentPackingNumber = packageInfo.number)
callback(res1.data.list)
}
}).catch(err => {
@ -185,8 +195,6 @@ const getBalance = (result, callback) => {
this.packGetFocus();
})
}
} else {
callback(res.data)
}
})
.catch((err) => {

72
src/pages/productPutaway/record/productPutawayRecord.vue

@ -11,9 +11,9 @@
<view class="">
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack"></record-com-detail-card>
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation">
</record-com-detail-card>
</view>
<view class="split_line"></view>
</view>
</scroll-view>
</view>
@ -21,10 +21,12 @@
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%">
<view class="">
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation="getToLocationCode"
:locationAreaTypeList="tolocationTypeList"></requiredLocation>
<!-- <requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation="getToLocationCode"-->
<!-- :locationAreaTypeList="tolocationTypeList"></requiredLocation>-->
</view>
<view class="uni-flex uni-row">
<button class="btn_single_reject" style="margin-right:5px ;" hover-class="btn_commit_after"
@click="commit">取消</button>
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view>
</view>
@ -32,6 +34,8 @@
<win-scan-button @goScan="openScanPopup"></win-scan-button>
</view>
<win-scan-package ref="scanPopup" @getResult='getScanResult'></win-scan-package>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getToLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></win-scan-location>
<com-message ref="comMessageRef" />
</view>
</template>
@ -39,7 +43,7 @@
<script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { productPutawayRecordSubmit } from '@/api/request2.js'
import { productPutawayRecordSubmit,getPutawayRecommendLocation } from '@/api/request2.js'
import { goHome, getPackingNumberAndBatchByList, deepCopyData, updateTitle } from '@/common/basic.js'
import { getPrecisionStrategyList } from '@/common/balance.js'
@ -52,7 +56,7 @@
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import winScanPackage from '@/mycomponents/scan/winScanPackage.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import { useCountStore } from '@/store'
// store
@ -76,6 +80,8 @@
const scanPopup = ref()
const comMessageRef = ref()
const type = ref('')
const editItem = ref(null)
const toLocationAreaTypeList = ref([])
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title
@ -91,6 +97,7 @@
businessType.value = res.businessType
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList
tolocationTypeList.value = res.tolocationTypeList
toLocationAreaTypeList.value = res.toLocationAreaTypeList;
openScanPopup()
} else {
showErrorMessage(res.message)
@ -109,13 +116,17 @@
const pack = result.package
result.balance.forEach(
balance => {
var item = detailSource.value.find(res => {
if (res.itemCode == balance.itemCode) {
let item = detailSource.value.find(res => {
if (res.itemCode == balance.itemCode && res.containerNumber == balance.parentPackingNumber) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
//
getRecommendLocation(balance, res => {
itemp.toLocationCode = res.code;
})
let newDetail = createDetailInfo(balance, pack); //
newDetail.fromInventoryStatus = balance.inventoryStatus;
itemp.subList.push(newDetail);
@ -144,6 +155,40 @@
}
)
}
const getRecommendLocation = (balance, callback)=> {
uni.showLoading({
title: '扫描中...',
mask: true
})
let param = {
itemCode: balance.itemCode,
batch: balance.batch,
inventoryStatus: balance.inventoryStatus,
supplierCode: '',
businessCode: this.bussinessCode
};
console.log(JSON.stringify(param))
getPutawayRecommendLocation(param).then(res => {
callback(res.data);
uni.hideLoading();
}).catch(error => {
uni.hideLoading()
showErrorMessage(error);
})
}
//
const removeRecommendLocation = ()=> {
showMessage('移除推荐的预占用库位')
}
const showScanToLocation = (item)=> {
editItem.value = item;
setTimeout(r => {
scanLocationCode.value.openScanPopup();
})
}
const handleCalcHandleQty = () => {
calcHandleQty(detailSource.value)
@ -151,12 +196,14 @@
const removeItem = (index, item) => {
detailSource.value.splice(index, 1)
removeRecommendLocation()
}
const removePack = () => {
for (let i = 0; i < detailSource.value.length; i++) {
const item = detailSource.value[i]
if (item.subList.length == 0) {
detailSource.value.splice(i, 1)
removeRecommendLocation()
}
}
updateData()
@ -325,16 +372,9 @@
const closeScanMessage = () => {
scanPopupGetFocus()
}
const getLocation = (location, code) => {
getFromLocationCode(location, code)
}
const getFromLocationCode = (location, code) => {
fromLocationCode.value = code
openScanPopup()
}
const getToLocationCode = (location, code) => {
console.log(code)
toLocationCode.value = code
editItem.value.toLocationCode = code
// detailSource.value.forEach((item) => {
// item.subList.forEach((detail) => {
// detail.toLocationCode = toLocationCode.value

Loading…
Cancel
Save