Browse Source

整理预生产上架功能

hella_online_20240829
niexiting 2 months ago
parent
commit
085868a42b
  1. 21
      src/common/array.js
  2. 55
      src/common/record.js
  3. 26
      src/mycomponents/record/recordComDetailCard.vue
  4. 18
      src/mycomponents/scan/winScanPackage.vue
  5. 94
      src/pages/productPutaway/record/productPutawayRecord.vue

21
src/common/array.js

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

55
src/common/record.js

@ -5,11 +5,15 @@ import {
import { import {
getDirectoryItemArray, getDirectoryItemArray,
} from '@/common/directory.js'; } from '@/common/directory.js';
import { calc } from '@/common/calc' import {
import { Decimal } from 'decimal.js';//引入 calc
import { } from '@/common/calc'
deepCopyData import {
} from '@/common/basic.js'; Decimal
} from 'decimal.js'; //引入
import {
deepCopyData
} from '@/common/basic.js';
export function createItemInfo(balance, pack) { export function createItemInfo(balance, pack) {
let item = { let item = {
@ -18,10 +22,13 @@ export function createItemInfo(balance, pack) {
packQty: pack.packQty, packQty: pack.packQty,
packUnit: pack.packUnit, packUnit: pack.packUnit,
qty: new Decimal(balance.qty).toNumber(), qty: new Decimal(balance.qty).toNumber(),
handleQty:new Decimal(0).toNumber(), handleQty: new Decimal(0).toNumber(),
uom: pack.uom, uom: pack.uom,
subList: [] subList: [],
// packingNumber: pack.number,
// parentPackingNumber: pack.parentNumber,
} }
item.containerNumber = pack.parentNumber != null ? pack.parentNumber : pack.number;
return item; return item;
} }
@ -34,7 +41,7 @@ export function createDetailInfo(balance, pack) {
detail.qty = new Decimal(detail.qty).toNumber(); detail.qty = new Decimal(detail.qty).toNumber();
detail.packQty = new Decimal(pack.packQty).toNumber() detail.packQty = new Decimal(pack.packQty).toNumber()
detail.packUnit = pack.packUnit detail.packUnit = pack.packUnit
detail.handleQty = new Decimal(detail.qty).toNumber() ; detail.handleQty = new Decimal(detail.qty).toNumber();
detail.package = pack; detail.package = pack;
detail.productionlineCode = pack.productionLineCode; // 制品回收记录需要加的 detail.productionlineCode = pack.productionLineCode; // 制品回收记录需要加的
detail.toInventoryStatus = balance.inventoryStatus; // 制品回收记录需要加的 detail.toInventoryStatus = balance.inventoryStatus; // 制品回收记录需要加的
@ -48,11 +55,11 @@ export function calcHandleQty(detailSource) {
item.handleQty = new Decimal(0).toNumber(); item.handleQty = new Decimal(0).toNumber();
item.qty = new Decimal(0).toNumber(); item.qty = new Decimal(0).toNumber();
for (let detail of item.subList) { for (let detail of item.subList) {
if(detail!=undefined){ if (detail != undefined) {
if(detail.scaned){ if (detail.scaned) {
item.handleQty = calc.add(item.handleQty,detail.handleQty); item.handleQty = calc.add(item.handleQty, detail.handleQty);
} }
item.qty = calc.add(item.qty,detail.qty); item.qty = calc.add(item.qty, detail.qty);
} }
} }
} }
@ -61,13 +68,13 @@ export function calcHandleQty(detailSource) {
export function calcTreeHandleQty(detailSource) { export function calcTreeHandleQty(detailSource) {
for (let item of detailSource) { for (let item of detailSource) {
item.handleQty = new Decimal(0).toNumber(); item.handleQty = new Decimal(0).toNumber();
for (let detail of item.subList) { for (let detail of item.subList) {
if (detail != undefined && detail.scaned) { if (detail != undefined && detail.scaned) {
detail.handleQty = new Decimal(0).toNumber(); detail.handleQty = new Decimal(0).toNumber();
for (let pack of detail.packList){ for (let pack of detail.packList) {
if(pack!=undefined&&pack.scaned){ if (pack != undefined && pack.scaned) {
detail.handleQty = calc.add(detail.handleQty, pack.handleQty); detail.handleQty = calc.add(detail.handleQty, pack.handleQty);
} }
} }
item.handleQty = calc.add(item.handleQty, detail.handleQty); item.handleQty = calc.add(item.handleQty, detail.handleQty);
@ -80,10 +87,10 @@ export function getBusinessType(typeCode, callback) {
let result = { let result = {
success: true, success: true,
businessType: '', businessType: '',
fromLocationAreaTypeList:'', fromLocationAreaTypeList: '',
toLocationAreaTypeList:'', toLocationAreaTypeList: '',
itemCodeTypeList:"", itemCodeTypeList: "",
useOnTheWay:"FALSE", useOnTheWay: "FALSE",
fromInventoryStatuses: '', fromInventoryStatuses: '',
toInventoryStatuses: '', toInventoryStatuses: '',
message: '' message: ''
@ -91,12 +98,12 @@ export function getBusinessType(typeCode, callback) {
getBusinesstypeByCode(typeCode).then(res => { getBusinesstypeByCode(typeCode).then(res => {
if (res.data.total > 0) { if (res.data.total > 0) {
result.businessType = res.data.list[0]; result.businessType = res.data.list[0];
result.fromLocationAreaTypeList = getDirectoryItemArray(res.data.list[0].outAreaTypes) ; result.fromLocationAreaTypeList = getDirectoryItemArray(res.data.list[0].outAreaTypes);
result.toLocationAreaTypeList = getDirectoryItemArray(res.data.list[0].inAreaTypes) ; result.toLocationAreaTypeList = getDirectoryItemArray(res.data.list[0].inAreaTypes);
result.itemCodeTypeList = getDirectoryItemArray(res.data.list[0].itemTypes) result.itemCodeTypeList = getDirectoryItemArray(res.data.list[0].itemTypes)
result.fromInventoryStatuses = res.data.list[0].outInventoryStatuses; result.fromInventoryStatuses = res.data.list[0].outInventoryStatuses;
result.toInventoryStatuses = res.data.list[0].inInventoryStatuses; result.toInventoryStatuses = res.data.list[0].inInventoryStatuses;
result.useOnTheWay =res.data.list[0].useOnTheWay result.useOnTheWay = res.data.list[0].useOnTheWay
callback(result) callback(result)
} else { } else {
result.success = false; result.success = false;
@ -108,4 +115,4 @@ export function getBusinessType(typeCode, callback) {
result.message = error; result.message = error;
callback(result) callback(result)
}) })
} }

26
src/mycomponents/record/recordComDetailCard.vue

@ -7,6 +7,10 @@
<uni-swipe-action-item @click="removeItem($event,dataContent)" :right-options="removeOptions"> <uni-swipe-action-item @click="removeItem($event,dataContent)" :right-options="removeOptions">
<item-qty :dataContent="dataContent" :isShowBalance="true" <item-qty :dataContent="dataContent" :isShowBalance="true"
:isShowBalanceQty="isShowBalanceQty"></item-qty> :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>
</uni-swipe-action-item> </uni-swipe-action-item>
</uni-swipe-action> </uni-swipe-action>
</template> </template>
@ -40,11 +44,14 @@
import purchaseLabel from '@/mycomponents/balance/purchaseLabel.vue' import purchaseLabel from '@/mycomponents/balance/purchaseLabel.vue'
import location from '@/mycomponents/balance/location.vue' import location from '@/mycomponents/balance/location.vue'
import recordDetailPopup from '@/mycomponents/detail/recordDetailPopup.vue' import recordDetailPopup from '@/mycomponents/detail/recordDetailPopup.vue'
import pack from '@/mycomponents/balance/pack.vue'
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue'
import { import {
getDetailOption, getDetailOption,
getDetailEditRemoveOption, getDetailEditRemoveOption,
getClearOption getClearOption,
getEditLocationRemoveOption
} from '@/common/array.js'; } from '@/common/array.js';
export default { export default {
components: { components: {
@ -55,7 +62,9 @@
balanceDetailPopup, balanceDetailPopup,
purchaseLabel, purchaseLabel,
location, location,
recordDetailPopup recordDetailPopup,
pack,
PackageAndItemCard
// winListHint // winListHint
}, },
props: { props: {
@ -124,19 +133,21 @@
mounted() { mounted() {
this.detailOptions = getDetailOption(); this.detailOptions = getDetailOption();
this.scanOptions = getDetailEditRemoveOption(); this.scanOptions = getDetailEditRemoveOption();
this.removeOptions = getClearOption(); this.removeOptions = getEditLocationRemoveOption();
}, },
methods: { methods: {
removeItem(e, dataContent) { removeItem(e, dataContent) {
if (e.content.text == "清空") { if (e.content.text == "移除") {
this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?", this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?",
res => { res => {
if (res) { if (res) {
this.$emit('removeItem') this.$emit('removeItem',dataContent)
// this.$emit('removeItem', this.dataContent) // this.$emit('removeItem', this.dataContent)
} }
}); });
} else {
this.editLocation(dataContent)
} }
}, },
swipeClick(e, item, index) { swipeClick(e, item, index) {
@ -169,6 +180,11 @@
}); });
}, },
editLocation(item) {
this.editItem = item;
this.$emit('editLocation', item)
},
confirm(qty) { confirm(qty) {
// this.editItem.qty = qty; // this.editItem.qty = qty;
this.editItem.handleQty = qty; this.editItem.handleQty = qty;

18
src/mycomponents/scan/winScanPackage.vue

@ -128,14 +128,14 @@
value: this.businessType.outInventoryStatuses value: this.businessType.outInventoryStatuses
}) })
} }
if (this.businessType.outAreaTypes != null){ if (this.businessType.outAreaTypes != null) {
filters.push({ filters.push({
column: "areaType", column: "areaType",
action: "in", action: "in",
value: this.businessType.outAreaTypes value: this.businessType.outAreaTypes
}) })
} }
if (this.businessType.outAreaCodes != null){ if (this.businessType.outAreaCodes != null) {
filters.push({ filters.push({
column: "areaCode", column: "areaCode",
action: "in", action: "in",
@ -172,7 +172,16 @@
pageSize: 100, pageSize: 100,
} }
getBalanceByFilter(params).then(res => { 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) { if (packageInfo.subList.length > 0) {
let packparams = ''; let packparams = '';
@ -194,6 +203,7 @@
this.packGetFocus(); this.packGetFocus();
}) })
} else { } else {
res1.data.list.forEach(r => r.parentPackingNumber = packageInfo.number)
callback(res1.data.list) callback(res1.data.list)
} }
}).catch(err => { }).catch(err => {
@ -204,8 +214,6 @@
this.packGetFocus(); this.packGetFocus();
}) })
} }
} else {
callback(res.data.list)
} }
}).catch(err => { }).catch(err => {
this.showErrorMessage(err.message); this.showErrorMessage(err.message);

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

@ -11,10 +11,9 @@
<view class=""> <view class="">
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)" :isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack"> @updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation">
</record-com-detail-card> </record-com-detail-card>
</view> </view>
<view class='split_line'></view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -23,10 +22,12 @@
<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 title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode' <!-- <requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode'
:locationAreaTypeList="tolocationTypeList"></requiredLocation> :locationAreaTypeList="tolocationTypeList"></requiredLocation> -->
</view> </view>
<view class=" uni-flex uni-row"> <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> <button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view> </view>
</view> </view>
@ -34,13 +35,16 @@
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</view> </view>
<win-scan-package ref="scanPopup" @getResult='getScanResult'></win-scan-package> <win-scan-package ref="scanPopup" @getResult='getScanResult'></win-scan-package>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getToLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></win-scan-location>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
<script> <script>
import { import {
productPutawayRecordSubmit productPutawayRecordSubmit,
getPutawayRecommendLocation
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
goHome, goHome,
@ -69,12 +73,12 @@
import comBlankView from '@/mycomponents/common/comBlankView.vue' import comBlankView from '@/mycomponents/common/comBlankView.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import winScanPackage from '@/mycomponents/scan/winScanPackage.vue' import winScanPackage from '@/mycomponents/scan/winScanPackage.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import { import {
updateTitle updateTitle
} from '@/common/basic.js'; } from '@/common/basic.js';
export default { export default {
components: { components: {
winScanButton, winScanButton,
@ -82,7 +86,8 @@
requiredLocation, requiredLocation,
comBlankView, comBlankView,
recordComDetailCard, recordComDetailCard,
winScanPackage winScanPackage,
winScanLocation
}, },
data() { data() {
return { return {
@ -100,7 +105,8 @@
bussinessCode: "ProductPutaway", bussinessCode: "ProductPutaway",
businessType: {}, businessType: {},
managementList: [], managementList: [],
type: '' type: '',
editItem: null
}; };
}, },
onLoad(option) { onLoad(option) {
@ -118,6 +124,7 @@
if (res.success) { if (res.success) {
this.businessType = res.businessType; this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.tolocationTypeList = res.tolocationTypeList; this.tolocationTypeList = res.tolocationTypeList;
this.openScanPopup(); this.openScanPopup();
} else { } else {
@ -144,13 +151,18 @@
let pack = result.package; let pack = result.package;
result.balance.forEach( result.balance.forEach(
balance => { balance => {
var item = this.detailSource.find(res => { let item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) { if (res.itemCode == balance.itemCode && res.containerNumber == balance
.parentPackingNumber) {
return res return res
} }
}) })
if (item == undefined) { if (item == undefined) {
var itemp = createItemInfo(balance, pack); var itemp = createItemInfo(balance, pack);
//
this.getRecommendLocation(balance, res => {
itemp.toLocationCode = res.code;
})
let newDetail = createDetailInfo(balance, pack); // let newDetail = createDetailInfo(balance, pack); //
newDetail.fromInventoryStatus = balance.inventoryStatus; newDetail.fromInventoryStatus = balance.inventoryStatus;
itemp.subList.push(newDetail); itemp.subList.push(newDetail);
@ -180,6 +192,41 @@
) )
}, },
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()
this.showErrorMessage(error);
})
},
//
removeRecommendLocation() {
this.showMessage('移除推荐的预占用库位')
},
showScanToLocation(item) {
this.editItem = item;
setTimeout(r => {
this.$refs.scanLocationCode.openScanPopup();
})
},
showErrorMessage(message) { showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {}); this.$refs.comMessage.showErrorMessage(message, res => {});
}, },
@ -192,6 +239,7 @@
this.calcHandleQty(); this.calcHandleQty();
}, },
removeItem(index, item) { removeItem(index, item) {
this.removeRecommendLocation();
this.detailSource.splice(index, 1) this.detailSource.splice(index, 1)
}, },
removePack() { removePack() {
@ -199,6 +247,7 @@
var item = this.detailSource[i]; var item = this.detailSource[i];
if (item.subList.length == 0) { if (item.subList.length == 0) {
this.detailSource.splice(i, 1) this.detailSource.splice(i, 1)
this.removeRecommendLocation(item)
} }
} }
this.updateData(); this.updateData();
@ -208,17 +257,9 @@
setTimeout(r => { setTimeout(r => {
this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType); this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType);
}) })
// setTimeout(r => {
// this.$refs.scanPopup.openScanPopup(this.businessType);
// this.scanPopupGetFocus();
// })
}, },
// showFromLocationPopup() {
// this.$nextTick(() => {
// this.$refs.scanLocationCode.openScanPopup();
// })
// },
closeScanPopup() { closeScanPopup() {
if (this.$refs.scanPopup != undefined) { if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup(); this.$refs.scanPopup.closeScanPopup();
@ -383,20 +424,9 @@
closeScanMessage() { closeScanMessage() {
this.scanPopupGetFocus(); this.scanPopupGetFocus();
}, },
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) { getToLocationCode(location, code) {
this.toLocationCode = code; this.editItem.toLocationCode = code;
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = this.toLocationCode
})
})
}, },
showCommitSuccessMessage(hint) { showCommitSuccessMessage(hint) {

Loading…
Cancel
Save