Browse Source

计划外出库申请

wms3.0_pda
lijuncheng 11 months ago
parent
commit
36bf9dcddd
  1. 64
      common/basic.js
  2. 8
      common/directory.js
  3. 52
      pages/unPlanned/record/issueRecord.vue
  4. 54
      pages/unPlanned/record/receiptRecord.vue
  5. 178
      pages/unPlanned/request/issueRequestCreate.vue
  6. 291
      pages/unPlanned/request/receiptRequestCreate.vue

64
common/basic.js

@ -715,6 +715,66 @@ export function getTodayDate() {
return startTime + "," + endTime;
}
export function getCurrDateOneMonthsTimes() {
var end = Date.now()
// var end = new Date('2019/12/31 15:18').getTime()
var day = 31
var enda = new Date(end);
var endm = enda.getMonth() + 1;
var d = enda.getDate();
if (endm == 4 || endm == 6 || endm == 9 || endm == 11) {
day = 30
} else {
if (d == 31) {
day = 30
}
if (endm == 7 || endm == 12) {
day = 31
}
}
if (endm == 1) {
var endy = enda.getFullYear();
day = 31
if (d == 31) {
day = 28
}
if (d == 30) {
day = 29
}
if (d == 29) {
day = 30
}
if (endy % 4 == 0) {
day = 31
if (d == 31) {
day = 29
}
if (d == 30) {
day = 30
}
if (d == 29) {
day = 31
}
}
}
if (endm == 2) {
var endy = enda.getFullYear();
day = 28
if (endy % 4 == 0) {
day = 29
}
}
var start = 1000 * 60 * 60 * 24 * day
var interval = end + start;
return interval;
}
export function getCurrDateTimes() {
var time = (new Date()).getTime();
return time;
}
export function getCurrDate() {
var date = new Date();
return getDate(date);
@ -733,11 +793,11 @@ export function getISODateTime() {
//格式化处理
export function dateFormat(time) {
var result = ""
if(time!=null){
if (time != null) {
let date = new Date(time);
result = getDate(date) + " " + getTime(date);
}
return result;
}

8
common/directory.js

@ -9,6 +9,7 @@ let containerTypeList = [];
let packUnitList = [];
let requestStatusList = [];
let unplannedReceiptReasonList = [];
let unplannedIssueReasonList = [];
let unplannedIissueReason = [];
let scrapReasonList = [];
let inspectFailedReasonList = [];
@ -42,6 +43,7 @@ export function clearCacheData() {
packUnitList = [];
requestStatusList = [];
unplannedReceiptReasonList = [];
unplannedIssueReasonList=[];
unplannedIissueReason = [];
scrapReasonList = [];
inspectFailedReasonList = [];
@ -329,7 +331,7 @@ export function getUnPlannedReceiptReasonList(value) {
}
unplannedReceiptReasonList.forEach(res => {
res.text = res.label;
res.value = res.code
res.value = res.value
})
return unplannedReceiptReasonList
}
@ -341,7 +343,7 @@ export function getUnPlannedIssuseReasonList(value) {
}
unplannedIssueReasonList.forEach(res => {
res.text = res.label;
res.value = res.code
res.value = res.value
})
return unplannedIssueReasonList
}
@ -353,7 +355,7 @@ export function getScarpReasonList(value) {
}
scrapReasonList.forEach(res => {
res.text = res.label;
res.value = res.code
res.value = res.value
})
return scrapReasonList
}

52
pages/unPlanned/record/issueRecord.vue

@ -102,7 +102,6 @@
detailSource: [], //
reason: "",
reasonList: [],
fromType: "",
dataContent:{}
}
},
@ -121,12 +120,6 @@
},
onLoad(option) {
this.fromType = option.fromType
if (this.fromType == "requestType") {
updateTitle("计划外出库申请")
} else {
updateTitle("计划外出库记录")
}
},
methods: {
@ -223,24 +216,7 @@
this.showErrorMessage("请选择出库原因")
return;
}
if(this.fromType=="requestType"){
var params = this.setRequestParams();
console.log("提交参数",JSON.stringify(params));
// unPlannedIssueRequestSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
// this.showCommitSuccessMessage("<br>" + res.data, )
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
// }).catch(error => {
// uni.hideLoading()
// this.showErrorMessage(error)
// })
}else {
var params =this.setParams()
// unPlannedIssueRecordSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
@ -252,7 +228,6 @@
// uni.hideLoading()
// this.showErrorMessage(error)
// })
}
},
setParams() {
@ -271,31 +246,6 @@
return subList;
},
setRequestParams(){
var subList = []
var supplierCode=""
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
if(supplierCode==""){
supplierCode = detail.package.supplierCode
}
subList.push(detail)
}
})
})
this.dataContent.subList = subList
this.dataContent.supplierCode = supplierCode
this.dataContent.businessType = "PurchasePutaway"
this.dataContent.departmentCode= "研发部门";
this.dataContent.status= 1 ;
this.dataContent.autoCommit = "FALSE";
this.dataContent.autoAgree = "FALSE";
this.dataContent.autoExecute = "FALSE";
this.dataContent.directCreateRecord = "FALSE";
return this.dataContent;
},
}
}
</script>

54
pages/unPlanned/record/receiptRecord.vue

@ -99,7 +99,6 @@
businessTypeCode: "UnplannedReceipt",
reason: "",
reasonList: [],
fromType: "",
showToLoaction:true,
dataContent:{}
}
@ -120,20 +119,9 @@
},
onLoad(option) {
this.fromType = option.fromType
this.updateTitle();
},
methods: {
updateTitle(){
if (this.fromType == "requestType") {
updateTitle("计划外入库申请")
this.showToLoaction =false
} else {
updateTitle("计划外入库记录")
this.showToLoaction =true
}
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
@ -249,21 +237,6 @@
return;
}
if(this.fromType=="requestType"){
var params = this.setRequestParams()
console.log("提交" + JSON.stringify(params))
// unPlannedReceiptRequestbSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
// this.showCommitSuccessMessage("<br>" + res.data, )
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
// }).catch(error => {
// uni.hideLoading()
// this.showErrorMessage(error)
// })
}else {
//
var itemCodes = []
this.detailSource.forEach(item => {
@ -292,7 +265,6 @@
this.showErrorMessage(res.message);
}
});
}
},
setParams(queryModel) {
@ -328,32 +300,6 @@
return this.dataContent;
},
setRequestParams(){
var subList = []
var supplierCode=""
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
if(supplierCode==""){
supplierCode = detail.package.supplierCode
}
subList.push(detail)
}
})
})
this.dataContent.subList = subList
this.dataContent.supplierCode = supplierCode
this.dataContent.businessType = "PurchasePutaway"
this.dataContent.departmentCode= "研发部门";
this.dataContent.status= 1 ;
this.dataContent.autoCommit = "FALSE";
this.dataContent.autoAgree = "FALSE";
this.dataContent.autoExecute = "FALSE";
this.dataContent.directCreateRecord = "FALSE";
return this.dataContent;
},
}
}
</script>

178
pages/unPlanned/request/issueRequestCreate.vue

@ -3,36 +3,42 @@
<view class="">
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<uni-data-picker style="padding: 20rpx; background-color:#fff;" class='uni-data-picker'
placeholder="请选择出库原因" popup-title="出库原因" :localdata="reasonList" v-model="reason">
</uni-data-picker>
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<record-com-detail-card :dataContent="item" :index="index"
@removeItem="removeItem(index,item)" @updateData="updateData" :isShowLocation="true"
@removePack="removePack">
</record-com-detail-card>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="flex u-col-center" style="width: 100%;background-color:#fff;">
<view class="" style="margin-left: 20rpx; font-size: 30rpx;flex-shrink: 0;">出库原因</view>
<view style="width: 100%">
<uni-data-picker style="background-color:#fff;margin-right: 20rpx;" class='uni-data-picker'
placeholder="请选择出库原因" popup-title="出库原因" :localdata="reasonList" @change="reasonChange">
</uni-data-picker>
</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 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="">
<record-com-detail-card :dataContent="item" :index="index"
@removeItem="removeItem(index,item)" @updateData="updateData" :isShowLocation="true"
@removePack="removePack">
</record-com-detail-card>
</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'></win-scan-button>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'">
</win-scan-pack-and-location>
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getLocation'
@ -76,7 +82,10 @@
import {
goHome,
updateTitle
updateTitle,
getCurrDateTimes,
getCurrDateOneMonthsTimes,
navigateBack
} from '@/common/basic.js';
export default {
@ -100,10 +109,10 @@
toInventoryStatus: [],
businessType: {}, //
detailSource: [], //
reason: "",
reasonText: "",
reasonCode: "",
reasonList: [],
fromType: "",
dataContent:{}
dataContent: {},
}
},
@ -121,12 +130,7 @@
},
onLoad(option) {
this.fromType = option.fromType
if (this.fromType == "requestType") {
updateTitle("计划外出库申请")
} else {
updateTitle("计划外出库记录")
}
this.reasonList = getUnPlannedIssuseReasonList()
},
methods: {
@ -219,83 +223,65 @@
this.detailSource.splice(index, 1)
},
commit() {
if (this.reason == '') {
if (this.reasonText == '') {
this.showErrorMessage("请选择出库原因")
return;
}
if(this.fromType=="requestType"){
var params = this.setRequestParams();
console.log("提交参数",JSON.stringify(params));
// unPlannedIssueRequestSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
// this.showCommitSuccessMessage("<br>" + res.data, )
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
// }).catch(error => {
// uni.hideLoading()
// this.showErrorMessage(error)
// })
}else {
// unPlannedIssueRecordSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
// this.showCommitSuccessMessage("<br>" + res.data, )
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
// }).catch(error => {
// uni.hideLoading()
// this.showErrorMessage(error)
// })
}
},
setParams() {
var subList = []
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
// var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
// detail.packingNumber, detail.batch);
// detail.toPackingNumber =info.packingNumber;
// detail.toBatch =info.batch;
subList.push(detail)
}
})
var params = this.setRequestParams();
console.log("提交参数", JSON.stringify(params));
uni.showLoading({
title:"提交中"
})
return subList;
unPlannedIssueRequestSubmit(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)
})
},
setRequestParams(){
setRequestParams() {
var subList = []
var supplierCode=""
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
if(supplierCode==""){
supplierCode = detail.package.supplierCode
}
detail.fromLocationCode = detail.locationCode;
detail.reasonText = this.reasonCode;
detail.containerNumber ="";
subList.push(detail)
}
})
})
this.dataContent.subList = subList
this.dataContent.supplierCode = supplierCode
this.dataContent.businessType = "PurchasePutaway"
this.dataContent.departmentCode= "研发部门";
this.dataContent.status= 1 ;
this.dataContent.autoCommit = "FALSE";
this.dataContent.autoAgree = "FALSE";
this.dataContent.autoExecute = "FALSE";
this.dataContent.directCreateRecord = "FALSE";
this.dataContent.status = 1;
this.dataContent.requestTime = getCurrDateTimes();
this.dataContent.dueTime = getCurrDateOneMonthsTimes();
return this.dataContent;
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
reasonChange(e) {
if (e.detail.value.length == 0) {
this.reasonCode = ""
this.reasonText = ""
} else {
this.reasonCode = e.detail.value[0].value
this.reasonText = e.detail.value[0].text
}
}
}
}
</script>

291
pages/unPlanned/request/receiptRequestCreate.vue

@ -1,8 +1,297 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='openScanPopup' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<u-line />
<view class="page-main">
<uni-data-picker v-if="detailSource.length>0" style="padding: 20rpx; background-color:#fff;"
class='uni-data-picker' placeholder="请选择入库原因" popup-title="入库原因" :localdata="reasonList"
v-model="reason">
</uni-data-picker>
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<com-receipt-record :dataContent="item" @removeItem="removeItem(index,item)"
@updateData="updateData" :isShowLocation="false" @removePack="removePack">
</com-receipt-record>
</view>
<u-line />
</view>
</scroll-view>
</view>
<requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode'
:locationTypeList="tolocationTypeList"></requiredLocation>
<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'></win-scan-button>
</view>
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :title="'箱码'"></win-scan-pack>
<com-message ref="comMessage"></com-message>
</view>
</template>
<script>
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comReceiptRecord from '@/pages/unPlanned/coms/comReceiptRecord.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPack from "@/mycomponents/scan/winScanPack.vue"
import comMessage from '@/mycomponents/common/comMessage.vue'
import {
unPlannedReceiptRequestbSubmit,
unPlannedReceiptRecordbSubmit
} from '@/api/request2.js';
import {
getDirectoryItemArray,
getUnPlannedReceiptReasonList
} from '@/common/directory.js';
import {
getBusinessType,
} from '@/common/record.js';
import {
goHome,
updateTitle,
getPackingNumberAndBatch,
navigateBack
} from '@/common/basic.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
export default {
components: {
comEmptyView,
winScanButton,
requiredLocation,
comReceiptRecord,
comBlankView,
winScanLocation,
winScanPack,
comMessage
},
props: {
},
data() {
return {
toLocationCode: "",
toLocationInfo: {},
toInventoryStatus: [],
businessType: {}, //
detailSource: [], //
businessTypeCode: "UnplannedReceipt",
reason: "",
reasonList: [],
showToLoaction:true,
dataContent:{}
}
},
mounted() {
this.reasonList = getUnPlannedReceiptReasonList();
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromlocationTypeList = res.fromlocationTypeList;
this.tolocationTypeList = res.tolocationTypeList;
this.openScanPopup();
} else {
this.$refs.comMessage.showBreakMessage(res.message);
}
});
},
onLoad(option) {
},
methods: {
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
getToLocationCode(location, code) {
this.toLocationCodeInfo = location;
this.toLocationCode = code;
},
getScanResult(result) {
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);
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == result.number &&
r.batch == result.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = this.createDetailInfo(label, pack);
item.subList.push(newDetail);
} else {
if (detail.scaned) {
this.showErrorMessage("箱码[" + result.Number + "]批次[" + result.batch + "]已经扫描")
}
}
}
this.calcHandleQty();
},
createItemInfo(label, pack) {
let item = {
itemCode: pack.itemCode,
itemName: pack.itemName,
stdPackQty: pack.stdPackQty,
stdPackUnit: pack.stdPackUnit,
qty: label.qty,
handleQty: 0,
uom: label.uom,
subList: []
}
return item;
},
createDetailInfo(label, pack) {
let detail = {};
detail.scaned = true;
// Object.assign(detail, label)
detail.qty = Number(label.qty)
detail.inventoryStatus = "OK"
detail.stdPackQty = pack.stdPackQty;
detail.stdPackUnit = pack.stdPackUnit;
label.inventoryStatus = "OK";
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.$forceUpdate();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
updateData() {
this.calcHandleQty();
},
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)
},
commit() {
if (this.showToLoaction &&this.toLocationCode == "") {
this.showErrorMessage("请先选择目标库位")
return;
}
if (this.reason == '') {
this.showErrorMessage("请选择入库原因")
return;
}
var params = this.setRequestParams()
console.log("提交" + JSON.stringify(params))
// unPlannedReceiptRequestbSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
// this.showCommitSuccessMessage("<br>" + res.data, )
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
// }).catch(error => {
// uni.hideLoading()
// this.showErrorMessage(error)
// })
},
setRequestParams(){
var subList = []
var supplierCode=""
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
if(supplierCode==""){
supplierCode = detail.package.supplierCode
}
subList.push(detail)
}
})
})
this.dataContent.subList = subList
this.dataContent.supplierCode = supplierCode
this.dataContent.businessType = "PurchasePutaway"
this.dataContent.departmentCode= "研发部门";
this.dataContent.status= 1 ;
this.dataContent.autoCommit = "FALSE";
this.dataContent.autoAgree = "FALSE";
this.dataContent.autoExecute = "FALSE";
this.dataContent.directCreateRecord = "FALSE";
return this.dataContent;
},
}
}
</script>
<style>
</style>
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: relative;
margin-top: 2px;
}
</style>

Loading…
Cancel
Save