Browse Source

整理预生产上架功能

hella_online_20240829
niexiting 4 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() {
let array = [{
@ -333,4 +352,4 @@ export function getLocationTypeArray(data) {
}
return list
}
}

55
src/common/record.js

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

26
src/mycomponents/record/recordComDetailCard.vue

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

18
src/mycomponents/scan/winScanPackage.vue

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

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

@ -11,10 +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">
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation">
</record-com-detail-card>
</view>
<view class='split_line'></view>
</view>
</scroll-view>
</view>
@ -23,10 +22,12 @@
<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>
@ -34,13 +35,16 @@
<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>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
productPutawayRecordSubmit
productPutawayRecordSubmit,
getPutawayRecommendLocation
} from '@/api/request2.js';
import {
goHome,
@ -69,12 +73,12 @@
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 {
updateTitle
} from '@/common/basic.js';
export default {
components: {
winScanButton,
@ -82,7 +86,8 @@
requiredLocation,
comBlankView,
recordComDetailCard,
winScanPackage
winScanPackage,
winScanLocation
},
data() {
return {
@ -100,7 +105,8 @@
bussinessCode: "ProductPutaway",
businessType: {},
managementList: [],
type: ''
type: '',
editItem: null
};
},
onLoad(option) {
@ -118,6 +124,7 @@
if (res.success) {
this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.tolocationTypeList = res.tolocationTypeList;
this.openScanPopup();
} else {
@ -144,13 +151,18 @@
let pack = result.package;
result.balance.forEach(
balance => {
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
let item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode && res.containerNumber == balance
.parentPackingNumber) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
//
this.getRecommendLocation(balance, res => {
itemp.toLocationCode = res.code;
})
let newDetail = createDetailInfo(balance, pack); //
newDetail.fromInventoryStatus = balance.inventoryStatus;
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) {
this.$refs.comMessage.showErrorMessage(message, res => {});
},
@ -192,6 +239,7 @@
this.calcHandleQty();
},
removeItem(index, item) {
this.removeRecommendLocation();
this.detailSource.splice(index, 1)
},
removePack() {
@ -199,6 +247,7 @@
var item = this.detailSource[i];
if (item.subList.length == 0) {
this.detailSource.splice(i, 1)
this.removeRecommendLocation(item)
}
}
this.updateData();
@ -208,17 +257,9 @@
setTimeout(r => {
this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType);
})
// setTimeout(r => {
// this.$refs.scanPopup.openScanPopup(this.businessType);
// this.scanPopupGetFocus();
// })
},
// showFromLocationPopup() {
// this.$nextTick(() => {
// this.$refs.scanLocationCode.openScanPopup();
// })
// },
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
@ -383,20 +424,9 @@
closeScanMessage() {
this.scanPopupGetFocus();
},
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) {
this.toLocationCode = code;
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = this.toLocationCode
})
})
this.editItem.toLocationCode = code;
},
showCommitSuccessMessage(hint) {

Loading…
Cancel
Save