Browse Source

增加物料变更功能

hella_online_20240829
niexiting 3 months ago
parent
commit
7ed4ff1de0
  1. 2
      .env.development
  2. 20
      src/api/request2.js
  3. 3
      src/mycomponents/package/PackageAndItemCard.vue
  4. 4
      src/pages.json
  5. 11
      src/pages/fg/coms/comNoReceiptPopup.vue
  6. 482
      src/pages/fg/fgChange.vue
  7. 9
      src/pages/fg/receiptByPlan.vue
  8. 3
      src/pages/fg/receiptNoPlan.vue

2
.env.development

@ -1,4 +1,4 @@
VITE_BASE_URL=http://172.21.32.14:81/api/admin-api VITE_BASE_URL=http://192.168.0.128:12080/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.14:81/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.14:81/admin-api
# 租户配置 # 租户配置

20
src/api/request2.js

@ -4385,3 +4385,23 @@ export function getPrintTemplateList(params) {
method: "post" method: "post"
}); });
} }
//获取物料变更信息
export function getSpareitemcode(params) {
return request({
url: baseApi + "/wms/productionitemcode-spareitemcode/getRelation",
method: "get",
data: params,
});
}
//获取物料变更信息
export function getProductreceiptDetailbByPackingNumber(packingNumber ) {
return request({
url: baseApi + "/wms/productreceipt-detailb/getProductreceiptDetailbByPackingNumber?packingNumber="+packingNumber ,
method: "get",
data: {},
});
}

3
src/mycomponents/package/PackageAndItemCard.vue

@ -5,6 +5,7 @@
<item :dataContent="dataContent" style="margin-left: 4px; padding:0px 5px 5px;"></item> <item :dataContent="dataContent" style="margin-left: 4px; padding:0px 5px 5px;"></item>
<pack v-if="dataContent.packingNumber!=null" :packingCode="dataContent.packingNumber"></pack> <pack v-if="dataContent.packingNumber!=null" :packingCode="dataContent.packingNumber"></pack>
<batch v-if="dataContent.batch!=null" :batch="dataContent.batch"></batch> <batch v-if="dataContent.batch!=null" :batch="dataContent.batch"></batch>
<location v-if="dataContent.locationCode!=null" :locationCode="dataContent.locationCode"></location>
</view> </view>
<view class="uni-flex uni-row" style="word-break: break-all;"> <view class="uni-flex uni-row" style="word-break: break-all;">
<recommend-qty <recommend-qty
@ -19,6 +20,7 @@
import item from '@/mycomponents/item/item.vue' import item from '@/mycomponents/item/item.vue'
import pack from '@/mycomponents/balance/pack.vue' import pack from '@/mycomponents/balance/pack.vue'
import batch from '@/mycomponents/balance/batch.vue' import batch from '@/mycomponents/balance/batch.vue'
import location from '@/mycomponents/balance/location.vue'
import recommendQty from '@/mycomponents/qty/recommendQty.vue' import recommendQty from '@/mycomponents/qty/recommendQty.vue'
export default { export default {
@ -26,6 +28,7 @@
pack, pack,
batch, batch,
recommendQty, recommendQty,
location,
item item
}, },

4
src/pages.json

@ -2239,9 +2239,9 @@
} }
}, },
{ {
"path": "pages/material/materialDowngrade", "path": "pages/fg/fgChange",
"style": { "style": {
"navigationBarTitleText": "物料降级", "navigationBarTitleText": "物料变更",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },

11
src/pages/fg/coms/comNoReceiptPopup.vue

@ -19,7 +19,7 @@
<view class="customerBorder" @click="showSelectLine"> <view class="customerBorder" @click="showSelectLine">
{{productionLineName}} {{productionLineName}}
</view> </view>
<u-select v-model="showProductLineSelect" mode="mutil-column-auto" <u-select v-model="showProductLineSelect" mode="mutil-column-auto" title="请选择生产线和工位"
:list="productLineList" @confirm="confirmSelectLine"></u-select> :list="productLineList" @confirm="confirmSelectLine"></u-select>
<view class=""> <view class="">
@ -58,10 +58,11 @@
</image> </image>
</view> </view>
</view> </view>
<view class='split_line'></view>
<view class="title " style="display: flex;align-items: center;padding: 10rpx;"> <view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0; width: 25%;">数量</text> <text style=" flex-shrink: 0; width: 25%;">数量</text>
<uni-easyinput v-model="planQty"></uni-easyinput><view v-if="uom">({{getUomInfo(uom)}})</view> <uni-easyinput v-model="planQty"></uni-easyinput>
<view v-if="uom">({{getUomInfo(uom)}})</view>
<view class=""> <view class="">
<image src="" mode="" style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;"> <image src="" mode="" style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;">
</image> </image>
@ -354,8 +355,8 @@
}, },
showSelectItemCode() { showSelectItemCode() {
if (!this.planDate) { if (!this.productionLineCode) {
this.showErrorMessage('请先选择计划日期'); this.showErrorMessage('请先选择生产线');
return; return;
} }
uni.showLoading({ uni.showLoading({

482
src/pages/fg/fgChange.vue

@ -0,0 +1,482 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='openScanPopup' v-if="currentPackage==null"></com-blank-view>
</view>
<view class="page-wraper" v-if="currentPackage!=null">
<view class="page-main">
<uni-collapse>
<uni-collapse-item>
<template v-slot:title>
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx;">
变更前包装信息
</view>
</template>
<PackageAndItemCard :dataContent='currentPackage'></PackageAndItemCard>
</uni-collapse-item>
</uni-collapse>
<view>
<scroll-view scroll-y="true" class="">
<view class="" v-for="(item, index) in fgList" :key="index">
<uni-swipe-action>
<uni-swipe-action-item :right-options="options">
<view class="uni-flex uni-row "
style="margin-left: 50rpx; padding-top: 10rpx; padding-bottom: 10rpx;">
<!-- scan_view -->
<view class="auto-wrap"
style="font-size: 35rpx;font-weight: bold; width: 100%;">
<text style="font-size: 30rpx;color: #B66463;">唯一码 </text>
{{item.remark}}
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
<u-line color="#D8D8D8"></u-line>
</view>
</scroll-view>
</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 class="uni-flex uni-row u-col-center">
<text style="font-size: 28rpx;">变更后物料</text>
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="card_itemCode" style="margin-left: 20rpx; color: blue;">
{{toItemCode}}
</view>
<view class="">
<image src="/static/icons/down.svg" mode=""
style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;" @click="showSelect">
</image>
</view>
<u-select v-model="show" mode="single-column" :list="toItemList"
@confirm="confirmSelect"></u-select>
</view>
</view>
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-com-scan-balance ref="scanPopup" @getBalance='getPackScanResult' :bussinessCode="bussinessCode">
</win-com-scan-balance>
<win-scan-fg-label ref="scanPopup" @getResult='getFgScanResult' title='制品标签'></win-scan-fg-label>
<!-- <win-scan-pack ref="scanPopup" @getResult='getScanResult' title="制品标签" headerType="HMQ"></win-scan-pack> -->
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
getSpareitemcode,
getProductreceiptDetailbByPackingNumber
} from '@/api/request2.js';
import {
getPrecisionStrategyList
} from '@/common/balance.js';
import {
goHome,
getPackingNumberAndBatchByList,
deepCopyData,
getRemoveOption
} from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import {
Decimal
} from 'decimal.js'; //
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
} from '@/common/record.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comProductRecord from '@/pages/productReceipt/coms/comProductRecord.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import winScanFgLabel from "@/mycomponents/scan/winScanFgLabel.vue"
export default {
components: {
winScanButton,
winScanPack,
comProductRecord,
comBlankView,
PackageAndItemCard,
winComScanBalance,
winScanFgLabel
},
data() {
return {
detailSource: [], //
toLocationCode: "",
fromLocationTypeList: [],
fromLocationCode: "",
businessType: {},
dataContent: {},
managementList: [],
show: false,
toItemCode: "请选择变更后物料",
toItemList: [],
fgList: [],
options: [],
currentPackage: null,
bussinessCode: "Relegate"
};
},
mounted() {
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
});
this.getBusinessType();
this.options = getRemoveOption()
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
getBusinessType() {
getBusinessType(this.bussinessCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
getPackScanResult(result) {
let label = result.label;
let pack = result.package;
uni.showLoading({
title: '加载中...',
mask: true
})
let params = {
available: "TRUE",
changeBeforeCode: pack.itemCode,
pageSize: 20,
pageNo: 1
};
getSpareitemcode(params).then(res => {
uni.hideLoading();
if (res.data.list.length == 0) {
this.showErrorMessage('未查找到变更后的物料,请在《量产件备件关系中进行配置》')
return;
} else {
this.closeScanPopup();
res.data.list.forEach(r => {
r.value = r.code;
r.label = r.code + "(" + r.name + ")";
})
this.toItemList = res.data.list;
if (res.data.list.length == 1) {
this.toItemCode = res.data.list[0].code;
} else {
this.show = true;
}
//
getProductreceiptDetailbByPackingNumber(pack.number).then(res => {
if (res.data.length > 0) {
this.fgList = res.data;
let pack = result.package;
let balance = result.balance;
this.currentPackage = result.package;
this.currentPackage.packingNumber = pack.number;
this.currentPackage.locationCode = balance.locationCode;
this.currentPackage.inventoryStatus = balance.inventoryStatus;
//this.getDataSource(result);
} else {
this.showErrorMessage('箱码【' + pack.number + '】未查找到绑定的灯码信息')
}
}).catch(res => {
this.showErrorMessage(res.message);
})
}
}).catch(res => {
this.showErrorMessage(res.message);
})
},
getFgScanResult(result) {
let that = this;
var itemIndex = this.allList.findIndex(r =>
r.content == result.content);
//
if (itemIndex == -1) {
// if (this.allList.length > this.dataContent.packQty) {
// this.showErrorMessage("")
// return;
// }
result.countTime = new Date();
this.allList.push(result);
this.allList.sort(compare('countTime')); //
this.initList()
this.scanPopupGetFocus();
this.calcFgQty();
} else {
this.$refs.comMessage.showQuestionMessage("唯一码【" + result.content +
'】已经扫描,是否移除',
res => {
if (res) {
this.allList.splice(itemIndex, 1)
this.allList.sort(compare('countTime')); //
this.initList()
that.calcFgQty();
}
})
}
},
openScanPopup() {
setTimeout(r => {
this.$refs.scanPopup.openScanPopup(this.businessType);
this.scanPopupGetFocus();
})
},
commit() {
if (this.positionInfo == "请选择位置") {
this.showMessage("请先选择位置")
return;
}
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
//
uni.showLoading({
title: "提交中....",
mask: true
});
this.managementList = [];
var precisionStrategParams = this.setPrecisionStrategParams()
getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交" + JSON.stringify(params))
productionReceiptRecordSubmit(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)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
})
} else {
this.showErrorMessage("没有要提交的数据,请先扫描")
}
},
setPrecisionStrategParams() {
var itemList = []
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
detail.toLocationCode = this.fgLocationCode;
var filterResult = itemList.filter(res => {
if (res.itemCode == item.itemCode &&
detail.toLocationCode == res.locationCode) {
return res
}
})
//
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode
}
itemList.push(result)
}
}
})
})
return itemList;
},
setParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var submitItem = deepCopyData(detail)
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
detail.packingNumber, detail.toLocationCode, detail.batch);
submitItem.itemCode = detail.itemCode;
submitItem.itemName = detail.package.itemName;
submitItem.itemDesc1 = detail.package.itemDesc1;
submitItem.itemDesc2 = detail.package.itemDesc2;
submitItem.inventoryStatus = detail.inventoryStatus;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.toPackingNumber = info.packingNumber;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.toContainerNumber = detail.containerNumber
submitItem.fromBatch = info.batch;
submitItem.toBatch = info.batch;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode;
submitItem.productionlineCode = this.productionLineCode;
submitItem.workStationCode = this.workStationCode;
submitItem.qty = detail.handleQty;
submitItem.package = "";
subList.push(submitItem)
}
})
})
this.dataContent.subList = subList;
this.dataContent.creator = creator;
this.dataContent.workshopCode = this.workshopCode;
return this.dataContent;
},
showMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.scanPopupGetFocus();
}
});
})
},
showErrorMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.scanPopupGetFocus();
}
});
})
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus();
}
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
clearData() {
this.subList = [];
this.detailSource = [];
this.toLocationCode = '';
this.dataContent = {};
this.positionInfo = "请选择位置";
this.fgLocationCode = ""
},
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();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
showSelect() {
this.show = !this.show
},
confirmSelect(e) {
this.toItemCode = e[0].value;
},
}
}
</script>
<style scoped lang="scss">
</style>

9
src/pages/fg/receiptByPlan.vue

@ -49,19 +49,13 @@
<text v-if="dataContent.handleQty>0" style="color: #FFA500;">{{dataContent.handleQty}}/</text> <text v-if="dataContent.handleQty>0" style="color: #FFA500;">{{dataContent.handleQty}}/</text>
{{dataContent.packQtyHint}} {{dataContent.packQtyHint}}
</view> </view>
</view> </view>
<view class='split_line' v-if="dataContent"></view> <view class='split_line' v-if="dataContent"></view>
</view> </view>
</view> </view>
<view style="margin-top: 480rpx; padding-bottom: 160rpx;" v-if="dataContent"> <view style="margin-top: 480rpx; padding-bottom: 160rpx;" v-if="dataContent">
<scroll-view scroll-y="true" class=""> <scroll-view scroll-y="true" class="">
<view class="scan_view" v-for="(item, index) in showList" :key="index"> <view class="scan_view" v-for="(item, index) in showList" :key="index">
<uni-swipe-action> <uni-swipe-action>
@ -80,7 +74,6 @@
</scroll-view> </scroll-view>
<uni-load-more :status="loadingType" v-if="showList.length>0" /> <uni-load-more :status="loadingType" v-if="showList.length>0" />
</view> </view>
<view class="page-footer" v-if="dataContent"> <view class="page-footer" v-if="dataContent">
<view class="uni-flex u-col-center space-between " style="background-color:ghostwhite; width: 100%; "> <view class="uni-flex u-col-center space-between " style="background-color:ghostwhite; width: 100%; ">
@ -98,7 +91,7 @@
</view> </view>
<comReceiptPopup ref="comReceiptPopup" @confirm='requestConfirm'></comReceiptPopup> <comReceiptPopup ref="comReceiptPopup" @confirm='requestConfirm'></comReceiptPopup>
<win-scan-button v-if="dataContent" @goScan='openScanPopup'></win-scan-button> <win-scan-button v-if="dataContent" @goScan='openScanPopup'></win-scan-button>
<win-scan-fg-label ref="scanPopup" @getResult='getScanResult' title='制品标签'></win-scan-fg-label> <win-scan-fg-label ref="scanPopup" @getResult='getScanResult' title='灯码标签'></win-scan-fg-label>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>

3
src/pages/fg/receiptNoPlan.vue

@ -132,7 +132,6 @@
index: 1, index: 1,
loadingType: "", loadingType: "",
pageSize: 20 pageSize: 20
}; };
}, },
@ -163,14 +162,12 @@
}, },
methods: { methods: {
openFg() { openFg() {
setTimeout(res => { setTimeout(res => {
if (this.$refs.comNoReceiptPopup) { if (this.$refs.comNoReceiptPopup) {
this.$refs.comNoReceiptPopup.openRequestPopup(); this.$refs.comNoReceiptPopup.openRequestPopup();
} }
}, 600) }, 600)
}, },
requestConfirm(result) { requestConfirm(result) {
this.dataContent = { this.dataContent = {

Loading…
Cancel
Save