Browse Source

生产退料合格和隔离

wms3.0_pda
lijuncheng 11 months ago
parent
commit
0057daf4ac
  1. 8
      api/httpRequest3.js
  2. 38
      mycomponents/scan/winScanPackAndPosition.vue
  3. 51
      pages/productionReturn/coms/comReturnRecordTitle.vue
  4. 447
      pages/productionReturn/record/returnToHold.vue
  5. 131
      pages/productionReturn/record/returnToStore.vue
  6. 2
      static/config.json
  7. 2
      uni_modules/vk-uview-ui/components/u-select/u-select.vue

8
api/httpRequest3.js

@ -27,15 +27,15 @@ function service(options = {}) {
if(res.data.code==0){
resolve(res.data);
}else {
reject("系统:"+res.data.msg)
reject("系统异常:"+res.data.msg)
}
}else {
reject("系统:"+ res.data.msg)
reject("系统异常:"+ res.data.msg)
}
} else {
reject("系统:"+res.data.msg)
reject("系统异常:"+res.data.msg)
}
};
options.fail = (error) => {
@ -47,7 +47,7 @@ function service(options = {}) {
} else if (message.includes('Request failed with status code')) {
message = '接口' + message.substr(message.length - 3) + '异常'
}
reject("系统:"+message);
reject("系统异常:"+message);
};
uni.request(options);
});

38
mycomponents/scan/winScanPackAndPosition.vue

@ -1,6 +1,6 @@
<template>
<view>
<uni-popup ref="popup" @change="change" @maskClick="closeScanPopup()">
<uni-popup ref="popup" @maskClick="closeScanPopup()">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
@ -178,24 +178,24 @@
this.productionLineName = e[1].label
this.workStationName = e[2].label
let shop = this.positionList.find(shop => shop.value == this.workshopCode);
if (shop != undefined && shop.children != undefined) {
let prodLine = shop.children.find(line => line.value == this.productionLineCode);
if (prodLine != undefined && prodLine.children != undefined) {
let station = prodLine.children.find(r => r.value == this.workStationCode);
if (station.rawLocationCode == '' && station.rawLocationCode == null) {
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择")
return;
} else {
this.rawLocationCode = station.rawLocationCode;
this.fgLocationCode = station.fgLocationCode;
}
} else {
this.showErrorMessage("生产线-工位基础信息维护错误")
}
} else {
this.showErrorMessage("车间-生产线基础信息维护错误")
}
// let shop = this.positionList.find(shop => shop.value == this.workshopCode);
// if (shop != undefined && shop.children != undefined) {
// let prodLine = shop.children.find(line => line.value == this.productionLineCode);
// if (prodLine != undefined && prodLine.children != undefined) {
// let station = prodLine.children.find(r => r.value == this.workStationCode);
// if (station.rawLocationCode == '' && station.rawLocationCode == null) {
// this.showErrorMessage(this.workStationName + ",")
// return;
// } else {
// this.rawLocationCode = station.rawLocationCode;
// this.fgLocationCode = station.fgLocationCode;
// }
// } else {
// this.showErrorMessage("线-")
// }
// } else {
// this.showErrorMessage("-线")
// }
},
}
}

51
pages/productionReturn/coms/comReturnRecordTitle.vue

@ -0,0 +1,51 @@
<template>
<view class="header_job_top">
<view class="cen_card">
<view class="cell_box uni-flex uni-row">
<view class="cell_info">
<view class="text_lightblue">车间</view>
<view>{{workshopCode}}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">生产线</view>
<view>{{productionLineCode}}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">工位</view>
<view>{{ workStationCode }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
};
},
watch: {},
props: {
workshopCode: {
type: String,
default: ""
},
productionLineCode: {
type: String,
default: ""
},
workStationCode: {
type: String,
default: ""
},
},
methods: {}
}
</script>
<style>
</style>

447
pages/productionReturn/record/returnToHold.vue

@ -1,29 +1,464 @@
<template>
<view class="page-wraper">
<comReturn businessTypeCode="ReturnToHold" > </comReturn>
<view class="">
<com-blank-view @goScan='openScanPopup(true)' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-header">
<comReturnRecordTitle :workshopCode="workshopCode"
:productionLineCode="productionLineCode"
:workStationCode ="workStationCode"
></comReturnRecordTitle>
</view>
<u-line />
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<comReturnRecord :dataContent="item" :index="index"
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack">
</comReturnRecord>
</view>
<u-line />
</view>
</scroll-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>
<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(false)'></win-scan-button>
</view>
<winScanPackAndPosition ref="scanPopup" @getResult='getScanResult'></winScanPackAndPosition>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import comReturn from '@/pages/productionReturn/coms/comReturn.vue'
import {
productionReturnRecordSubmit,
} from '@/api/request2.js';
import {
goHome,
getPackingNumberAndBatchByList
} from '@/common/basic.js';
import {
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
} from '@/common/record.js';
import {
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comReturnRecord from '@/pages/productionReturn/coms/comReturnRecord.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import winScanPackAndPosition from "@/mycomponents/scan/winScanPackAndPosition.vue"
import comReturnRecordTitle from '@/pages/productionReturn/coms/comReturnRecordTitle.vue'
export default {
name: 'comReturn',
components: {
comReturn
winScanButton,
comReturnRecordTitle,
requiredLocation,
comBlankView,
comMessage,
comReturnRecord,
winScanPack,
winScanPackAndPosition
},
data() {
watch: {},
data() {
return {
id: '',
dataContent: {}, //
subList: [], //subList
detailSource: [], //
fromLocationCode: '',
fromLocationTypeList: [],
toLocationCode: '',
tolocationTypeList: [],
businessType: {},
inventoryStatus: '',
managementList: [],
show: false,
positionList: [],
productionLineCode: '',
rawLocationCode: "",
fgLocationCode: "",
workshopCode: "",
workStationCode: "",
workShopName: "",
productionLineName: "",
workStationName: "",
businessTypeCode :"ReturnToHold",
positionInfo:"",
recommendLocationList: [], //
};
},
onLoad() {
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromlocationTypeList = res.fromlocationTypeList;
this.tolocationTypeList = res.tolocationTypeList;
this.openScanPopup(true);
} else {
this.showErrorMessage(res.message)
}
});
},
mounted() {
onLoad(option) {
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {
uni.stopPullDownRefresh();
},
methods: {
openScanPopup(isEditPosition) {
this.$refs.scanPopup.openScanPopup(isEditPosition);
},
getScanResult(result,param) {
this.positionInfo = param.positionInfo;
this.workshopCode = param.workshopCode;
this.productionLineCode = param.productionLineCode;
this.workStationCode = param.workStationCode ;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = this.createItemInfo(label, pack);
let newDetail = this.createDetailInfo(label, pack);
newDetail.toLocationCode = "HOLD";
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == label.packingNumber &&
r.batch == label.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = this.createDetailInfo(label, pack);
newDetail.toLocationCode ="HOLD";
item.subList.push(newDetail);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + label.batch + "]已经在列表中")
}
}
}
this.calcHandleQty();
},
createItemInfo(label, pack) {
let item = {
itemCode: label.itemCode,
itemName: pack.itemName,
stdPackQty: pack.stdPackQty,
stdPackUnit: pack.stdPackUnit,
qty: Number(label.qty),
handleQty: 0,
uom: pack.uom,
subList: []
}
return item;
},
createDetailInfo(label, pack) {
let detail = {};
Object.assign(detail, label)
detail.scaned = true;
detail.qty = Number(label.qty);
detail.inventoryStatus = "HOLD"
detail.stdPackQty = pack.stdPackQty;
detail.stdPackUnit = pack.stdPackUnit;
detail.package = pack;
detail.label = label;
return detail;
},
calcHandleQty() {
for (let item of this.detailSource) {
item.qty = 0;
for (let detail of item.subList) {
if (detail != undefined) {
item.qty += Number(detail.qty)
}
}
}
this.scanPopupGetFocus();
this.$forceUpdate();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
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();
},
showSelect() {
this.show = !this.show
},
updateData() {
this.calcHandleQty();
},
removeData(item) {
for (let i = 0; i < this.detailSource.length; i++) {
if (this.detailSource[i].itemCode == item.itemCode) {
this.detailSource.splice(i, 1)
}
}
},
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 = getPrecisionStrategyParams(this.detailSource)
getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交" + JSON.stringify(params))
productionReturnRecordSubmit(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) {
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 info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
detail.packingNumber, detail.toLocationCode, detail.batch);
detail.itemCode = detail.itemCode;
detail.itemName = detail.package.itemName;
detail.itemDesc1 = detail.package.itemDesc1;
detail.itemDesc2 = detail.package.itemDesc2;
detail.inventoryStatus = detail.inventoryStatus;
detail.fromPackingNumber = info.packingNumber;
detail.toPackingNumber = info.packingNumber;
detail.fromContainerNumber = detail.containerNumber;
detail.toContainerNumber = detail.containerNumber
detail.fromBatch = info.batch;
detail.toBatch = info.batch;
detail.fromLocationCode = detail.locationCode;
detail.toLocationCode = detail.toLocationCode;
detail.productionlineCode = this.productionLineCode;
detail.workStationCode = this.workStationCode;
subList.push(detail)
}
})
})
this.dataContent.subList = subList;
this.dataContent.creator = creator;
this.dataContent.workshopCode = this.workshopCode;
this.dataContent.businessType = this.businessTypeCode;
return this.dataContent;
},
showMessage(message) {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showErrorMessage(message) {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
scanPopupGetFocus() {
this.$refs.scanPopup.getfocus();
},
scanPopupLoseFocus() {
this.$refs.scanPopup.losefocus();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.subList = [];
this.detailSource = [];
this.toLocationCode = '';
this.dataContent = {};
this.positionInfo = "请选择位置";
})
},
}
}
</script>
<style>
<style scoped lang="scss">
page {
width: 100%;
height: 100%;
background-color: #fff;
}
.page-wraper {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.page-main-list {
/* height: 80rpx;
line-height: 80rpx; */
text-align: center;
background: #e0e0e0;
}
</style>

131
pages/productionReturn/record/returnToStore.vue

@ -1,27 +1,20 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='openScanPopup' v-if="detailSource.length==0"></com-blank-view>
<com-blank-view @goScan='openScanPopup(true)' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="">
<view class="uni-flex uni-row u-col-center" style="margin: 10rpx;">
<text style="font-size: 32rpx;margin-left: 20rpx;">位置 : </text>
<view class="uni-flex u-col-center uni-row">
<view class="" style="margin-left: 20rpx;font-size: 30rpx;">
{{positionInfo}}
</view>
</view>
<view class="page-header">
<comReturnRecordTitle :workshopCode="workshopCode" :productionLineCode="productionLineCode"
:workStationCode="workStationCode"></comReturnRecordTitle>
</view>
<u-line />
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<comReturnRecord :dataContent="item" :index="index"
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack">
<comReturnRecord :dataContent="item" :index="index" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack">
</comReturnRecord>
</view>
<u-line />
@ -39,7 +32,7 @@
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
<win-scan-button @goScan='openScanPopup(false)'></win-scan-button>
</view>
<winScanPackAndPosition ref="scanPopup" @getResult='getScanResult'></winScanPackAndPosition>
<comMessage ref="comMessage"></comMessage>
@ -49,12 +42,12 @@
<script>
import {
productionReturnRecordSubmit,
getWorkShopLineStation
getPutawayRecommendLocation
} from '@/api/request2.js';
import {
goHome,
getPackingNumberAndBatchByList
getPackingNumberAndBatchByList,
} from '@/common/basic.js';
import {
@ -63,12 +56,10 @@
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty
} from '@/common/record.js';
import {
getPrecisionStrategyList
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
@ -78,13 +69,15 @@
import comMessage from '@/mycomponents/common/comMessage.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import winScanPackAndPosition from "@/mycomponents/scan/winScanPackAndPosition.vue"
import comReturnRecordTitle from '@/pages/productionReturn/coms/comReturnRecordTitle.vue'
export default {
name: 'comReturn',
components: {
winScanButton,
// comReturnRecord,
comReturnRecordTitle,
requiredLocation,
comBlankView,
comMessage,
@ -119,7 +112,9 @@
productionLineName: "",
workStationName: "",
businessTypeCode: "ReturnToStore",
positionInfo:""
positionInfo: "",
recommendLocationList: [], //
fromWarehouseCode: '' //
};
},
@ -129,7 +124,7 @@
this.businessType = res.businessType;
this.fromlocationTypeList = res.fromlocationTypeList;
this.tolocationTypeList = res.tolocationTypeList;
this.openScanPopup();
this.openScanPopup(true);
} else {
this.showErrorMessage(res.message)
}
@ -154,8 +149,8 @@
},
methods: {
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
openScanPopup(isEditPosition) {
this.$refs.scanPopup.openScanPopup(isEditPosition);
},
getScanResult(result, param) {
@ -174,10 +169,20 @@
})
if (item == undefined) {
//
this.getRecommendLocation(label, pack, toLocation => {
var itemp = this.createItemInfo(label, pack);
let newDetail = this.createDetailInfo(label, pack);
newDetail.toLocationCode = toLocation.code;
newDetail.toWarehouseCode = toLocation.warehouseCode;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
})
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == label.packingNumber &&
@ -187,8 +192,13 @@
})
if (detail == undefined) {
this.getRecommendLocation(label, pack, toLocation => {
let newDetail = this.createDetailInfo(label, pack);
newDetail.toLocationCode = toLocation.code;
newDetail.toWarehouseCode = toLocation.warehouseCode;
item.subList.push(newDetail);
});
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + label.batch + "]已经在列表中")
@ -258,6 +268,33 @@
this.calcHandleQty();
},
//
getRecommendLocation(label, pack, callback) {
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode);
if (recommend == undefined) {
let param = {
itemCode: label.itemCode,
batch: label.batch,
inventoryStatus: label.inventoryStatus,
supplierCode: pack.supplierCode
};
console.log(JSON.stringify(param))
getPutawayRecommendLocation(param).then(res => {
this.recommendLocationList.push({
itemCode: label.itemCode,
locationCode: res.data.code
})
callback(res.data);
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
callback(recommend);
}
},
removeData(item) {
for (let i = 0; i < this.detailSource.length; i++) {
if (this.detailSource[i].itemCode == item.itemCode) {
@ -279,7 +316,7 @@
mask: true
});
this.managementList = [];
var precisionStrategParams = this.setPrecisionStrategParams()
var precisionStrategParams = getPrecisionStrategyParams(this.detailSource)
getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) {
@ -315,7 +352,6 @@
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) {
@ -377,13 +413,11 @@
this.dataContent.creator = creator;
this.dataContent.workshopCode = this.workshopCode;
this.dataContent.businessType = this.businessTypeCode;
this.dataContent.toWarehouseCode = this.toWarehouseCode;
return this.dataContent;
},
showMessage(message) {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
@ -408,53 +442,26 @@
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus();
}
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.subList = [];
this.detailSource = [];
this.toLocationCode = '';
this.dataContent = {};
this.positionInfo = "请选择位置";
this.fgLocationCode = ""
})
},
confirmSelect(e) {
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label
console.log("位置", this.positionInfo)
this.workshopCode = e[0].value
this.productionLineCode = e[1].value
this.workStationCode = e[2].value
this.workShopName = e[0].label
this.productionLineName = e[1].label
this.workStationName = e[2].label
let shop = this.positionList.find(shop => shop.value == this.workshopCode);
if (shop != undefined && shop.children != undefined) {
let prodLine = shop.children.find(line => line.value == this.productionLineCode);
if (prodLine != undefined && prodLine.children != undefined) {
let station = prodLine.children.find(r => r.value == this.workStationCode);
if (station.rawLocationCode == '' && station.rawLocationCode == null) {
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择")
return;
} else {
this.rawLocationCode = station.rawLocationCode;
this.fgLocationCode = station.fgLocationCode;
}
} else {
this.showErrorMessage("生产线-工位基础信息维护错误")
}
} else {
this.showErrorMessage("车间-生产线基础信息维护错误")
}
},
}
}
</script>

2
static/config.json

@ -18,7 +18,7 @@
"request_url": {
"name": "request_url",
"value": "http://192.168.0.230:12080/admin-api",
"value": "http://192.168.0.180:12080/admin-api",
"dev2": "http://192.168.0.157:12080/admin-api",
"chefang": "http://192.168.0.180:12080/admin-api",
"chenxinming": "http://192.168.0.230:12080/admin-api",

2
uni_modules/vk-uview-ui/components/u-select/u-select.vue

@ -17,7 +17,7 @@
:style="{ color: cancelColor }"
hover-class="u-hover-class"
:hover-stay-time="150"
@tap="getResult('cancel')"
@tap.stop="getResult('cancel')"
>
{{cancelText}}
</view>

Loading…
Cancel
Save