Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-uniapp into master_hella

hella_online_20240829
lijuncheng 2 months ago
parent
commit
e42e1a825d
  1. 2
      .env.development
  2. 7
      src/api/request2.js
  3. 20
      src/common/directory.js
  4. 25
      src/common/noclick.js
  5. 16
      src/common/style/new_style.css
  6. 7
      src/main.js
  7. 11
      src/mycomponents/balance/balance.vue
  8. 10
      src/mycomponents/balance/balanceSelect.vue
  9. 37
      src/mycomponents/balance/level.vue
  10. 9
      src/mycomponents/job/jobComMainDetailCard.vue
  11. 2
      src/mycomponents/record/recordComDetailCard.vue
  12. 4
      src/mycomponents/scan/winComScanBalance.vue
  13. 2
      src/pages.json
  14. 2
      src/pages/index/index.vue
  15. 42
      src/pages/issue/coms/comIssueRequestPopup.vue
  16. 938
      src/pages/issue/record/issueRecord.vue
  17. 432
      src/pages/issue/record/issueRecordV1.vue
  18. 4
      src/pages/issue/request/issueRequestCreate.vue
  19. 666
      src/pages/repleinsh/record/repleinshRecord.vue
  20. 558
      src/pages/repleinsh/record/repleinshRecordV1.vue

2
.env.development

@ -1,7 +1,7 @@
#VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api
#VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL=http://172.21.32.13:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.13:81/admin-api
VITE_BASE_URL=http://172.21.32.14:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.14:81/admin-api
# 租户配置 VITE_TENANT='[{"text":"长春1379","value":1},{"text":"成都1397","value":2},{"text":"长春2379","value":3}]'
# 是否是测试环境

7
src/api/request2.js

@ -1383,10 +1383,10 @@ export function getIssueJobDetail(id) {
* @param {*} 任务id
* /wms/issue-request-main
*/
export function getBalanceByBatchOffShelf(itemCode, qty) {
export function getBalanceByBatchOffShelf(itemCode, qty, businesstype) {
return request({
url: baseApi + "/wms/issue-request-main/getBalanceByBatchOffShelf?itemCode=" + itemCode + "&&qty=" +
qty,
qty + "&&businesstype=" + businesstype,
method: "get",
data: {},
});
@ -4279,7 +4279,8 @@ export function getBusinessType() {
export function getPlaneInfoByproductLine(productionLine, planDate) {
return request({
url: baseApi + "/wms/production-main/getPlanProductionByProductionLineAndPlanDate?productionLine="+productionLine+"&planDate="+planDate,
url: baseApi + "/wms/production-main/getPlanProductionByProductionLineAndPlanDate?productionLine=" +
productionLine + "&planDate=" + planDate,
method: "get",
data: {}
});

20
src/common/directory.js

@ -22,6 +22,7 @@ let countStageList = [];
let locationAreaTypeList = [];
let businessList = [];
let countScopeTypeList = [];
let priorityList = []
@ -64,6 +65,7 @@ export function clearCacheData() {
locationAreaTypeList = []
businessList = []
countScopeTypeList = []
priorityList = []
}
//获取字典信息
@ -79,7 +81,6 @@ export function getDirectoryInfo(type) {
}
}
}
return result
}
@ -614,5 +615,20 @@ export function getPackUnitName(value) {
return resultInfo
}
//获取优先级
export function getPriorityName(value) {
var resultInfo = "";
if (priorityList.length == 0) {
priorityList = getDirectoryInfo("priority")
}
if (priorityList.length > 0) {
for (let item of priorityList) {
if (item.value == value) {
resultInfo = item.label
break;
}
}
}
return resultInfo
}
locationAreaTypeList

25
src/common/noclick.js

@ -0,0 +1,25 @@
// 防止处理多次点击
function noMultipleClicks(methods, info) {
// methods是需要点击后需要执行的函数, info是点击需要传的参数
let that = this;
if (that.noClick) {
// 第一次点击
that.noClick= false;
if(info && info !== '') {
// info是执行函数需要传的参数
methods(info);
} else {
methods();
}
setTimeout(()=> {
that.noClick= true;
}, 2000)
} else {
// 这里是重复点击的判断
}
}
//导出
export default {
noMultipleClicks,//禁止多次点击
}

16
src/common/style/new_style.css

@ -2085,6 +2085,12 @@ button::after {
vertical-align: middle
}
.card_item_code {
color: #329362;
padding: 5px;
font-size: 30rpx;
}
.card_packing_code {
color: #3315EB;
padding: 5px;
@ -2138,6 +2144,12 @@ button::after {
padding: 5px;
}
.card_level {
color: #0689da;
padding: 5px;
font-size: 30rpx;
}
.card_supportCode {
color: #DA8910;
padding: 5px;
@ -2147,10 +2159,10 @@ button::after {
font-size: 32rpx;
}
.card_item_code {
/* .card_item_code {
color: #F1A532;
padding: 5px;
}
} */
.card_product_date {
color: #329362;

7
src/main.js

@ -4,10 +4,12 @@ import './router/my_router.js'; //引入拦截
import VueClipboard from 'vue-clipboard2' //复制粘贴
import uView from './uni_modules/vk-uview-ui';// 引入 uView UI
import comMessage from './mycomponents/common/comMessage.vue'
import noclick from './common/noclick.js'
// #ifndef VUE3
import Vue from 'vue'
console.log("Vuew2222");
console.log("Vuew2222");//配置公共方法 防治多次点击
Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$adpid = "1111111111"
@ -33,8 +35,7 @@ export function createApp() {
app.use(VueClipboard)
app.use(uView)
app.component('comMessage', comMessage)
console.log("网络22请求")
app.config.globalProperties.$noMultipleClicks = noclick.noMultipleClicks;
// startApp(app);
return {
app,

11
src/mycomponents/balance/balance.vue

@ -11,8 +11,6 @@
</view>
<view class="uni-flex" style="flex-direction: column;">
<view class="uni-flex uni-row center">
<!-- <qty v-if="dataContent.record==null ||dataContent.record==undefined " :dataContent="dataContent"
:isShowStdPack="isShowStdPack" :isShowStatus="isShowStatus"></qty> -->
<qty v-if="dataContent.handleQty==0 || dataContent.handleQty==undefined" :dataContent="dataContent"
@ -22,20 +20,15 @@
:isShowStatus='isShowStatus'>
</compare-qty>
<view class="uni-flex uni-row" style="vertical-align:center" v-if="isDevlement()">
<text style="font-size: 30rpx;color: #2979ff; width: 20px;" @click="copy">复制</text>
</view>
</view>
<view class="" v-if="dataContent.inventoryStatus">
<!-- <view class="" v-if="isShowStatus && dataContent.inventoryStatus">
<move-status :fromInventoryStatus="dataContent.inventoryStatus">
</move-status>
</view> -->
</view>
</view>
</view>
<!-- <u-line></u-line> -->
</view>

10
src/mycomponents/balance/balanceSelect.vue

@ -8,6 +8,13 @@
v-for="(item, index) in balanceItems" :key="item.id" @click="callback(item)">
<balance :dataContent="item" :isShowStatus="false"></balance>
</view>
<view class="page-footer">
<view class="uni-flex space-between" style=" width: 100%; ">
<!-- <view class=" uni-flex uni-row"> -->
<button class="btn_single_reject" hover-class="btn_commit_after" @click="close">关闭</button>
<!-- </view> -->
</view>
</view>
</scroll-view>
</uni-popup>
</template>
@ -52,6 +59,9 @@
this.$refs['popupItems'].close();
},
close() {
this.$refs['popupItems'].close();
}
}
}
</script>

37
src/mycomponents/balance/level.vue

@ -0,0 +1,37 @@
<template>
<view class="card_view ">
<text class="card_level">{{title}}</text>
<text class="card_big_content" style="font-size: 40rpx;">{{getPriorityName1()}}</text>
</view>
</template>
<script>
import {getPriorityName} from '@/common/directory.js';
export default {
components: {
},
data() {
return {}
},
props: {
priority: {
type: String,
default:'2'
},
title: {
type: String,
default: '优先级'
},
},
methods:{
getPriorityName1(){
return getPriorityName(this.priority)
}
},
}
</script>
<style>
</style>

9
src/mycomponents/job/jobComMainDetailCard.vue

@ -9,8 +9,13 @@
<pack v-if="isShowPack && dataContent.packingNumber!=null" :packingCode="dataContent.packingNumber">
</pack>
<batch v-if="isShowBatch && dataContent.batch!=null" :batch="dataContent.batch"></batch>
<view class="u-flex u-row-between">
<location v-if="isShowFromLocation&&dataContent.fromLocationCode" title="来源库位" :locationCode="dataContent.fromLocationCode">
</location>
<level title="优先级" :priority="dataContent.priority">
</level>
</view>
<to-location v-if="isShowToLocation" title="目标库位" :locationCode="dataContent.toLocationCode||dataContent.locationCode">
</to-location>
<view class="card_view " v-if="isShowDeliverType">
@ -27,8 +32,8 @@
import location from '@/mycomponents/balance/location.vue'
import toLocation from '@/mycomponents/balance/toLocation.vue'
import batch from '@/mycomponents/balance/batch.vue'
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue'
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import level from '@/mycomponents/balance/level.vue'
export default {
components: {
@ -36,8 +41,8 @@
location,
toLocation,
batch,
jobComMainCard,
itemCompareQty,
level
},
data() {
return {};

2
src/mycomponents/record/recordComDetailCard.vue

@ -72,7 +72,7 @@
isShowStatus: {
type: Boolean,
default: false
default: true
},
isShowFromLocation: {

4
src/mycomponents/scan/winComScanBalance.vue

@ -135,6 +135,10 @@
areaType: this.fromLocationAreaTypeList,
bussinessCode: this.bussinessCode
}
uni.showLoading({
title: '查询中',
mask: true
})
getBalanceByParams(params).then(res => {
uni.hideLoading()
if (res.data.length == 0) {

2
src/pages.json

@ -593,7 +593,7 @@
{
"path": "pages/issue/record/issueRecord",
"style": {
"navigationBarTitleText": "直接发料记录",
"navigationBarTitleText": "先进先出发料",
"enablePullDownRefresh": false,
"titleNView": {
"autoBackButton": "true"

2
src/pages/index/index.vue

@ -359,7 +359,7 @@
"inventory_status", "container_type", "pack_unit", "unplanned_receipt_reason",
"unplanned_issue_reason", "scrap_reason", "inspect_failed_reason",
"request_status", "inspect_type", "next_action", "sample_method", "transfer_mode",
"count_stage", "inspect_result", "area_type","count_scope_type"
"count_stage", "inspect_result", "area_type","count_scope_type","priority"
]
}
getDictionaryItem(params).then(res => {

42
src/pages/issue/coms/comIssueRequestPopup.vue

@ -23,10 +23,23 @@
@confirm="confirmWareHouse"></u-select>
</view>
</view>
<view class='split_line'></view>
<view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-right: 20rpx;
border-radius: 8rpx;
">
<view class="uni-center" style="width: 25%; font-size: 32rpx; ">
优先级
</view>
<view style="width: 100%;">
<uni-data-select style="padding: 20rpx;" v-model="priority" :localdata="priorityList"
:clear="false"></uni-data-select>
</view>
</view>
<view class='split_line'></view>
<view class="uni-flex uni-row padding title u-col-center">
<text>位置</text>
<text>目标位置</text>
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="" style="margin-left: 20rpx;">
{{positionInfo}}
@ -38,7 +51,7 @@
<view class='split_line'></view>
<view class="title padding" style="display: flex;">
<text style=" flex-shrink: 0;">物料</text>
<text style=" flex-shrink: 0;">需求物料</text>
<view class="" style="width: 100% ;">
{{itemCode}}
</view>
@ -67,6 +80,7 @@
</view>
</view>
<view class='split_line'></view>
</view>
</view>
</view>
@ -136,7 +150,21 @@
maxlength: 10,
stdPackInfo: undefined,
wareHouseList: [],
showWareHouse: false
showWareHouse: false,
priorityList: [{
value: 0,
text: "低"
},
{
value: 1,
text: "中"
},
{
value: 2,
text: "高"
},
],
priority:1,//
}
},
props: {
@ -207,6 +235,7 @@
this.itemCode = "请扫描物料信息";
this.rawLocationCode = ""
this.positionInfo = "请选择位置"
this.priority = ''
this.fromWarehouseCode = "请选择仓库代码"
this.workshopCode = "" //
this.workShopName = ""
@ -241,6 +270,10 @@
},
confirm() {
if (this.priority === '') {
this.showErrorMessage("请输入优先级", "priority")
return
}
if (this.positionInfo == "请选择位置") {
this.showErrorMessage("请选择位置")
return
@ -286,6 +319,7 @@
fgLocationCode: this.fgLocationCode,
fromWarehouseCode: this.fromWarehouseCode,
toWarehouseCode: this.fromWarehouseCode,
priority : this.priority,
itemCode: this.itemCode,
itemName: this.itemName,
uom: this.uom,

938
src/pages/issue/record/issueRecord.vue

File diff suppressed because it is too large

432
src/pages/issue/record/issueRecordV1.vue

@ -0,0 +1,432 @@
<template>
<view class="page-wraper">
<view class="" v-if='detailSource.length==0'>
<com-blank-view @goScan='goScan(true)'></com-blank-view>
</view>
<view v-else class="page-wraper">
<view class="page-main">
<scroll-view scroll-y="true" class="">
<view v-for="(toLocation, index) in detailSource">
<view class="uni-row uni-flex">
<!-- <com-issue-request-info :workShopCode="workShopCode" :dataContent="toLocation">
</com-issue-request-info> -->
<work-station :workshopCode="workShopCode"
:productionLineCode="toLocation.productionLineCode"
:workStationCode="toLocation.workStationCode"
:rawLocationCode="toLocation.toLocationCode"></work-station>
</view>
<com-issue-detail-card ref='comIssueDetailCard' :dataContent="toLocation"
@updateData='updateData'
@removeItemCode ="removeItemCode"
>
</com-issue-detail-card>
</view>
</scroll-view>
<button class="btn_add" @click="goScan(false)">+去添加</button>
</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="submit()">提交</button>
</view>
</view>
</view>
</view>
</view>
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm' :itemCodeTypeList="itemCodeTypeList"></com-issue-request-popup>
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</com-scan-issue-pack>
<comMessage ref="comMessage"></comMessage>
</template>
<script>
import {
issueRecordSubmit,
getBalanceByBatchOffShelf
} from '@/api/request2.js';
import {
goHome,
getRemoveOption,
getISODateTime,
getCurrDateTime,
getPackingNumberAndBatch
} from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getBusinessType,
} from '@/common/record.js';
import {
calc
} from '@/common/calc.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import comIssueRequestPopup from '@/pages/issue/coms/comIssueRequestPopup.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue'
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
import workStation from '@/mycomponents/workStation/workStation.vue'
export default {
name: '',
components: {
comBlankView,
comIssueRequestPopup,
jobDetailPopup,
comIssueRequestCreator,
comIssueRequestInfo,
comIssueDetailCard,
winScanButton,
comScanIssuePack,
workStation
},
data() {
return {
subList: [], //subList
detailSource: [], //
detailOptions: [],
scanOptions: [],
workShopCode: "",
fromInventoryStatuses: "",
toInventoryStatuses: "",
requestList: [],
dataContent: {},
managementList: [],
itemCodeTypeList: []
}
},
mounted() {
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
onLoad(option) {
var typeCode = "Issue"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.itemCodeTypeList = res.itemCodeTypeList;
this.fromInventoryStatuses = res.fromInventoryStatuses
this.toInventoryStatuses = res.toInventoryStatuses
this.goScan(true)
} else {
this.showErrorMessage(res.message)
}
});
},
methods: {
closeScan() {
this.resizeCollapse();
},
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comIssueDetailCard.forEach(r => {
r.resizeCollapse();
})
});
},
goScan(editPosition) {
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition);
},
//
requestConfirm(action, item) {
if (item.itemCode == '' || item.itemCode == null) return;
let that = this;
let request = that.requestList.find(r => r.itemCode == item.itemCode);
if (request == undefined) {
that.requestList.push(item);
this.getRecommendInfo(item);
} else {
this.$refs.comMessage.showQuestionMessage('已经存在物料[' + item.itemCode + ']的需求信息,是否要修改?', res => {
if (res) {
request.qty = item.qty;
that.detailSource.forEach(detail => {
let index = detail.Items.findIndex(r => {
r.itemCode == item.itemCode
})
detail.Items.splice(index, 1);
})
this.getRecommendInfo(item);
}
});
}
},
getRecommendInfo(item) {
let that = this;
uni.showLoading({
title: '加载中...',
mask: true
})
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => {
if (res.data == null) {
that.showMessage('未获取到推荐信息');
} else {
if (res.data.length > 0) {
that.workShopCode = item.workshopCode;
res.data.forEach(r => {
r.toLocationCode = item.rawLocationCode;
r.productionLineCode = item.productionLineCode;
r.workStationCode = item.workStationCode;
// r.itemCode = item.itemCode;
r.itemName = item.itemName
r.uom = item.uom;
that.subList.push(r);
})
that.detailSource = getDataSource(that.detailSource, that.subList)
//
that.detailSource.forEach(detail => {
detail.Items.forEach(i => {
let request = that.requestList.find(r => r
.itemCode == i
.itemCode);
i.qty = request.qty;
})
})
that.resizeCollapse();
} else {
that.showMessage('列表数据为0');
}
uni.hideLoading();
}
}).catch(error => {
uni.hideLoading()
that.showErrorMessage(error)
})
},
caclcQty() {
var totalQty = 0;
this.detailSource.subList.forEach(res => {
totalQty = calc.add(totalQty, res.qty);
})
this.detailSource.totalQty = totalQty;
},
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
var dataContent = {
allowModifyPackingNumber: "FALSE",
outInventoryStatuses: this.fromInventoryStatuses
}
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, dataContent);
},
closeScanPopup() {
this.updateCommitBtn();
},
updateData(record) {
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode);
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode);
let itemHandleQty = 0;
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b
.packingNumber == null || b.packingNumber == '') && b.batch ==
record.batch);
let handleQty = 0;
if (batch != undefined) {
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty);
})
batch.handleQty = handleQty;
itemHandleQty = calc.add(itemHandleQty, handleQty)
}
})
}
this.resizeCollapse();
// item.handleQty=itemHandleQty;
// this.closeScan();
},
removeItemCode(){
var isClear =this.detailSource[0].Items.length==0
if(isClear){
this.clearData();
this.$refs.comIssueRequestPopup.initData()
}
},
setParams() {
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
record.fromPackingNumber = r
.packingNumber;
record.fromBatch = r.batch;
record.fromContainerNumber = r
.ContainerNumber;
record.toContainerNumber = r
.ContainerNumber;
record.toInventoryStatus = r
.inventoryStatus;
record.toLocationCode = subItem
.toLocationCode;
record.fromLocationCode = fromLocation
.fromLocationCode
record.supplierCode = r.supplierCode;
let single_price = r.singlePrice == null ?
0 : r.singlePrice;
record.singlePrice = single_price;
record.amount = single_price * r.qty;
//使
var info = getPackingNumberAndBatch(
this.managementList, r
.itemCode,
r.packingNumber, r
.batch);
record.toPackingNumber = info
.packingNumber;
record.toBatch = info.batch;
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
this.dataContent.subList = subList
this.dataContent.createTime = createTime;
this.dataContent.creator = creator;
return this.dataContent;
},
submit() {
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode
this.detailSource.forEach(toLocation => {
toLocation.Items.forEach(item => {
itemCodes.push(item.itemCode)
})
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
submitJob() {
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
issueRecordSubmit(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)
})
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
this.$refs.comIssueRequestPopup.initData()
})
},
clearData() {
this.subList= [], //subList
this.detailSource=[], //
this.detailOptions=[],
this.scanOptions= [],
this.workShopCode="",
this.requestList= [],
this.dataContent= {},
this.managementList= []
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {}
});
},
showQuestionMessage(message) {
},
// this.$refs.comMessage.showQuestionMessage('?', res => {
// if (res) {
// that.clearInfo();
// }
// });
}
}
</script>
<style>
</style>

4
src/pages/issue/request/issueRequestCreate.vue

@ -107,7 +107,6 @@
//
requestConfirm(action, item) {
if (this.detailSource.subList.length == 0) {
this.detailSource = {
workshopCode: item.workshopCode,
@ -119,6 +118,7 @@
toLocationCode: item.rawLocationCode,
fromWarehouseCode:item.fromWarehouseCode,
useOnTheWay:this.useOnTheWay,
priority : item.priority,
totalQty: 0,
subList: []
}
@ -153,7 +153,7 @@
qty: item.qty,
uom: item.uom
}
this.detailSource.priority =item.priority
this.detailSource.subList.push(subItem)
} else {

666
src/pages/repleinsh/record/repleinshRecord.vue

@ -1,44 +1,58 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='showRequestPopup' v-if="detailSource.length==0"></com-blank-view>
<com-blank-view @goScan='getBusinessType' v-if="recommendList.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="recommendList.length>0">
<view class="page-header">
<view class="header_item" style="font-size:35rpx; padding: 10rpx;">
<uni-collapse ref="collapse">
<uni-collapse-item :open="true">
<template v-slot:title>
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx;">
先进先出推荐信息
</view>
</template>
<view class="detail-list" v-for="(recommend, index) in recommendList" :key="recommend.id">
<view class="card_view">
<text class="card_item_code ">物料代码</text>
<text class="card_content ">{{recommend.itemCode}}</text>
</view>
<balance :dataContent='recommend' :isShowStatus='false'></balance>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(toLocation, index) in detailSource" :key="index">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<view class="page-header">
<view class="text_lightblue fontsize-16">目标库位:{{toLocation.toLocationCode}}</view>
</view>
<com-issue-detail-card ref='comRepleinshDetailCard' :dataContent="toLocation"
@updateData='updateData'>
</com-issue-detail-card>
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="true" @removeItem="removeItem(index,item)"
:isShowToLocation="false" @updateData="updateData" @removePack="removePack">
</record-com-detail-card>
</view>
<!-- <view class='split_line'></view> -->
</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="">
<requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode"
@getLocation='getToLocationCode' :locationAreaTypeList="toLocationAreaTypeList">
</requiredLocation>
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button>
<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>
<com-repleinsh-request-popup ref="comRepleinshRequestPopup" :toLocationAreaTypeList="toLocationAreaTypeList"
@confirm='requestConfirm'
:itemCodeTypeList="itemCodeTypeList">
</com-repleinsh-request-popup>
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</com-scan-issue-pack>
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
@ -46,93 +60,91 @@
<script>
import {
repleinshRecordSubmit,
validateItemAndLocation,
getPutawayRecommendLocation,
getBalanceByFilter,
getBalanceByBatchOffShelf
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
goHome,
updateTitle,
getCurrDateTime,
getPackingNumberAndBatch
getPackingNumberAndBatchByList,
deepCopyData
} from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getDetailOption,
getDetailRemoveOption,
getDetailEditRemoveOption
} from '@/common/array.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty
} from '@/common/record.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getManagementPrecisions
getManagementPrecisions,
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import comRepleinshRequestPopup from '@/pages/repleinsh/coms/comRepleinshRequestPopup.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import balance from '@/mycomponents/balance/balance.vue'
export default {
components: {
winScanButton,
winScanPack,
requiredLocation,
comBlankView,
winScanLocation,
winScanPackAndLocation,
recordComDetailCard,
comRepleinshRequestPopup,
comIssueDetailCard,
comScanIssuePack
winComScanBalance,
balance
},
data() {
return {
id: '',
receiptJob: {},
subList: [], //subList
dataContent: {}, //
detailSource: [], //
businessTypeInfo: {},
fromLocationCode: "",
toLocationCode: "",
fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
allowModifyLocation: false,
inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {},
requestList: [],
managementList: [],
dataContent: {},
itemCodeTypeList:[]
showToLoaction: true,
recommendLocationList: [], //
fromWarehouseCode: '', //
businessTypeCode: "Repleinment",
toLocationCode: "",
resultData: {},
itemCode: "",
recommendList: []
};
},
onLoad(option) {
var typeCode = "Repleinment"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.itemCodeTypeList = res.itemCodeTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showRequestPopup();
} else {
this.showErrorMessage(res.message)
}
});
uni.setNavigationBarTitle({
title: option.title
})
this.clear();
this.getBusinessType()
},
//
onNavigationBarButtonTap(e) {
@ -146,77 +158,115 @@
onPullDownRefresh() {},
mounted() {},
methods: {
closeScan() {
this.resizeCollapse();
},
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comRepleinshDetailCard.forEach(r => {
r.resizeCollapse();
})
getBusinessType() {
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
showRequestPopup() {
this.$refs.comRepleinshRequestPopup.openRequestPopup();
},
//
requestConfirm(action, item) {
if (item.itemCode == '' || item.itemCode == null) return;
let that = this;
let request = that.requestList.find(r => r.itemCode == item.itemCode);
if (request == undefined) {
that.requestList.push(item);
this.getRecommendInfo(item);
getBalance(label, packageInfo, callback) {
var filters = []
if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
this.$refs.comMessage.showQuestionMessage('已经存在物料[' + item.itemCode + ']的需求信息,是否要修改?', res => {
if (res) {
request.qty = item.qty;
that.detailSource.forEach(detail => {
let index = detail.Items.findIndex(r => {
r.itemCode == item.itemCode
filters.push({
column: "packingNumber",
action: "==",
value: label.packingNumber
})
}
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
detail.Items.splice(index, 1);
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.fromInventoryStatuses
})
this.getRecommendInfo(item);
}
});
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
},
getScanResult(result) {
let that = this;
let pack = result.package;
if (that.recommendList.length > 0) {
let recommend = that.recommendList.filter(r => r.itemCode == pack.itemCode);
if (recommend.length == 0) {
this.showErrorMessage('物料代码【' + pack.itemCode + '】不在推荐列表中');
} else {
let batch = recommend.find(r => r.batch == pack.batch);
if (batch == undefined) {
that.showErrorMessage('扫描的批次【' + pack.batch + '】,不是系统推荐的批次,不满足系统的先进先出规则,请重新扫描物料');
} else {
this.setData(result);
}
}
} else {
this.getRecommendInfo(result);
}
},
getRecommendInfo(item) {
getRecommendInfo(result) {
let that = this;
uni.showLoading({
title: '加载中...',
mask: true
})
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => {
let item = {
itemCode: result.package.itemCode,
qty: result.package.qty,
}
getBalanceByBatchOffShelf(item.itemCode, item.qty, "Repleinment").then(res => {
if (res.data == null) {
that.showMessage('未获取到推荐信息');
that.showErrorMessage('未获取到推荐信息');
} else {
if (res.data.length > 0) {
res.data.forEach(r => {
r.toLocationCode = item.toLocation.code;
r.itemName = item.itemName
r.uom = item.uom;
that.subList.push(r);
})
that.detailSource = getDataSource(that.detailSource, that.subList)
//
that.detailSource.forEach(detail => {
detail.Items.forEach(i => {
let request = that.requestList.find(r => r
.itemCode == i
.itemCode);
i.qty = request.qty;
})
})
// that.resizeCollapse();
that.recommendList = res.data;
that.recommendList.forEach(r => r.locationCode = r.fromLocationCode)
let recommendInfo = res.data[0];
if (recommendInfo.batch != result.package.batch) {
that.showErrorMessage('扫描的批次【' + result.package.batch + '】,不是系统推荐的批次【' +
recommendInfo.batch + '】,不满足系统的先进先出规则,请重新扫描');
} else {
this.setData(result);
}
} else {
that.showMessage('列表数据为0');
that.showErrorMessage('未查找到物料的推荐信息');
}
uni.hideLoading();
}
@ -226,76 +276,98 @@
})
},
caclcQty() {
var totalQty = 0;
this.detailSource.subList.forEach(res => {
totalQty = calc.add(totalQty, res.qty)
})
this.detailSource.totalQty = totalQty;
},
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
var dataContent = {
allowModifyPackingNumber: "FALSE",
outInventoryStatuses: this.fromInventoryStatuses
setData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this
.fromLocationCode + "]没有库存余额")
return;
}
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, dataContent);
},
closeScanPopup() {
this.updateCommitBtn();
},
updateData(record) {
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode);
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode);
let itemHandleQty = 0;
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b
.packingNumber == null || b.packingNumber == '') && b.batch ==
record.batch);
let handleQty = 0;
if (batch != undefined) {
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
batch.handleQty = handleQty;
itemHandleQty = calc.add(itemHandleQty, handleQty)
if (item == undefined) {
if (this.itemCode != "" && this.itemCode != balance.itemCode) {
this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码")
return;
}
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
this.resizeCollapse();
// item.handleQty=itemHandleQty;
// this.closeScan();
item.subList.push(newDetail);
this.scanPopupGetFocus()
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]已经在列表中")
}
}
}
calcHandleQty(this.detailSource);
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.scanPopupGetFocus()
}
});
},
calcHandleQty() {
for (let item of this.detailSource) {
item.qty = 0;
for (let detail of item.subList) {
if (detail != undefined) {
item.qty = calc.add(item.qty,detail.qty)
}
updateData() {
calcHandleQty(this.detailSource);
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
if (item.qty == 0) {
this.detailSource.splice(i, 1)
}
}
this.$forceUpdate();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
this.updateData();
},
removePack() {
@ -309,67 +381,68 @@
},
openScanPopup() {
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
if (this.businessType) {
this.$refs.scanPopup.openScanPopup(this.businessType);
} else {
this.getBusinessType()
}
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus();
}
},
submit() {
if(this.getScanCount()==0){
this.showErrorMessage("当前扫描数为0,请先扫描在提交");
return
scanLocationCode(location, code) {
this.toLocationCode = code
},
commit() {
if (this.toLocationCode == "") {
this.showMessage("请输入目标库位")
return;
}
if (this.detailSource.length == 0) {
this.showMessage("请扫描要发货的物料")
return;
}
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = this.toLocationCode
detail.fromLocation = this.fromLocationCode
})
})
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode
this.detailSource.forEach(toLocation => {
toLocation.Items.forEach(item => {
itemCodes.push(item.itemCode)
})
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
//
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource);
//2:
getPrecisionStrategyList(precisionStrategyParams, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
submitJob() {
var params = this.setParams()
var params = this.setRecordParams()
console.log("提交参数", JSON.stringify(params));
repleinshRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成补料记录<br>" + res.data)
this.showCommitSuccessMessage("提交成功<br>生成直接补料记录<br>" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
@ -377,101 +450,73 @@
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
setParams() {
setRecordParams() {
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
record.fromPackingNumber = r
.packingNumber;
record.fromBatch = r.batch;
record.fromContainerNumber = r
.ContainerNumber;
record.toContainerNumber = r
.ContainerNumber;
record.toInventoryStatus = r
.inventoryStatus;
record.toLocationCode = subItem
.toLocationCode;
record.fromLocationCode = fromLocation
.fromLocationCode
record.supplierCode = r.supplierCode;
//使
var info = getPackingNumberAndBatch(
this.managementList, r
.itemCode,
r.packingNumber, r
.batch);
record.toPackingNumber = info
.packingNumber;
record.toBatch = info.batch;
subItem.recordList.push(record);
})
subList.push(subItem);
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
detail.packingNumber, detail.toLocationCode, detail.batch);
var submitItem = deepCopyData(detail)
submitItem.toPackingNumber = info.packingNumber;
submitItem.toBatch = info.batch;
submitItem.toContainerNumber = detail.containerNumber;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.fromBatch = info.batch;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode;
// detail.toInventoryStatus = detail.inventoryStatus
// detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty;
submitItem.package = "";
submitItem.recordList = [{
toInventoryStatus: detail.inventoryStatus,
fromPackingNumber: info.packingNumber,
fromParentPackingNumber: detail.parentNumber,
fromBatch: info.batch,
toPackingNumber: info.packingNumber,
toBatch: info.batch,
fromLocationCode: detail.locationCode,
toLocationCode: detail.toLocationCode,
handleQty: detail.handleQty,
fromPackUnit: detail.packUnit,
toPackUnit: detail.packUnit,
fromPackQty: detail.packQty,
toPackQty: detail.packQty
}]
subList.push(submitItem)
}
})
})
})
})
if (subList.length > 0) {
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode;
}
this.dataContent.subList = subList
this.dataContent.createTime = createTime;
this.dataContent.creator = creator;
this.dataContent.fromWarehouseCode = this.fromWarehouseCode;
return this.dataContent;
},
getScanCount(){
var scanCount = 0;
var subList = []
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
return scanCount =subList.length;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
@ -484,75 +529,34 @@
closeScanMessage() {
this.scanPopupGetFocus();
},
getLocation(location, code) {
this.getToLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) {
// if (this.fromLocationCode == code) {
// uni.showToast({
// title: "[" + this.fromLocationCode + "][" + code + "]",
// duration: 2000
// })
// return
// }
this.ToLocationCodeInfo = location;
if (this.fromLocationCode == code) {
uni.showToast({
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致",
duration: 2000
})
return
}
this.toLocationCode = code;
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
this.clear();
})
},
clearData() {
clear() {
this.fromLocationCode = '';
this.fromWarehouseCode = '';
this.toWarehouseCode = '';
this.detailSource = [];
this.requestList = [];
this.dataContent = {}
this.managementList = []
},
this.toLocationCode = "";
this.itemCode = ""
}
}
}
</script>
<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>

558
src/pages/repleinsh/record/repleinshRecordV1.vue

@ -0,0 +1,558 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='showRequestPopup' 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">
<view class="detail-list" v-for="(toLocation, index) in detailSource" :key="index">
<view class="">
<view class="page-header">
<view class="text_lightblue fontsize-16">目标库位:{{toLocation.toLocationCode}}</view>
</view>
<com-issue-detail-card ref='comRepleinshDetailCard' :dataContent="toLocation"
@updateData='updateData'>
</com-issue-detail-card>
</view>
<!-- <view class='split_line'></view> -->
</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="submit">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<com-repleinsh-request-popup ref="comRepleinshRequestPopup" :toLocationAreaTypeList="toLocationAreaTypeList"
@confirm='requestConfirm'
:itemCodeTypeList="itemCodeTypeList">
</com-repleinsh-request-popup>
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</com-scan-issue-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
repleinshRecordSubmit,
getBalanceByBatchOffShelf
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
goHome,
getCurrDateTime,
getPackingNumberAndBatch
} from '@/common/basic.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getDetailOption,
getDetailRemoveOption,
getDetailEditRemoveOption
} from '@/common/array.js';
import {
getBusinessType,
calcHandleQty
} from '@/common/record.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import comRepleinshRequestPopup from '@/pages/repleinsh/coms/comRepleinshRequestPopup.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
export default {
components: {
winScanButton,
winScanPack,
comBlankView,
winScanPackAndLocation,
recordComDetailCard,
comRepleinshRequestPopup,
comIssueDetailCard,
comScanIssuePack
},
data() {
return {
id: '',
receiptJob: {},
subList: [], //subList
detailSource: [], //
businessTypeInfo: {},
fromLocationCode: "",
toLocationCode: "",
toLocationAreaTypeList: [],
allowModifyLocation: false,
businessType: {},
requestList: [],
managementList: [],
dataContent: {},
itemCodeTypeList:[]
};
},
onLoad(option) {
var typeCode = "Repleinment"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.itemCodeTypeList = res.itemCodeTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showRequestPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
closeScan() {
this.resizeCollapse();
},
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comRepleinshDetailCard.forEach(r => {
r.resizeCollapse();
})
});
},
showRequestPopup() {
this.$refs.comRepleinshRequestPopup.openRequestPopup();
},
//
requestConfirm(action, item) {
if (item.itemCode == '' || item.itemCode == null) return;
let that = this;
let request = that.requestList.find(r => r.itemCode == item.itemCode);
if (request == undefined) {
that.requestList.push(item);
this.getRecommendInfo(item);
} else {
this.$refs.comMessage.showQuestionMessage('已经存在物料[' + item.itemCode + ']的需求信息,是否要修改?', res => {
if (res) {
request.qty = item.qty;
that.detailSource.forEach(detail => {
let index = detail.Items.findIndex(r => {
r.itemCode == item.itemCode
})
detail.Items.splice(index, 1);
})
this.getRecommendInfo(item);
}
});
}
},
getRecommendInfo(item) {
let that = this;
uni.showLoading({
title: '加载中...',
mask: true
})
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => {
if (res.data == null) {
that.showMessage('未获取到推荐信息');
} else {
if (res.data.length > 0) {
res.data.forEach(r => {
r.toLocationCode = item.toLocation.code;
r.itemName = item.itemName
r.uom = item.uom;
that.subList.push(r);
})
that.detailSource = getDataSource(that.detailSource, that.subList)
//
that.detailSource.forEach(detail => {
detail.Items.forEach(i => {
let request = that.requestList.find(r => r
.itemCode == i
.itemCode);
i.qty = request.qty;
})
})
// that.resizeCollapse();
} else {
that.showMessage('列表数据为0');
}
uni.hideLoading();
}
}).catch(error => {
uni.hideLoading()
that.showErrorMessage(error)
})
},
caclcQty() {
var totalQty = 0;
this.detailSource.subList.forEach(res => {
totalQty = calc.add(totalQty, res.qty)
})
this.detailSource.totalQty = totalQty;
},
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
var dataContent = {
allowModifyPackingNumber: "FALSE",
outInventoryStatuses: this.fromInventoryStatuses
}
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, dataContent);
},
closeScanPopup() {
this.updateCommitBtn();
},
updateData(record) {
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode);
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode);
let itemHandleQty = 0;
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b
.packingNumber == null || b.packingNumber == '') && b.batch ==
record.batch);
let handleQty = 0;
if (batch != undefined) {
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
batch.handleQty = handleQty;
itemHandleQty = calc.add(itemHandleQty, handleQty)
}
})
}
this.resizeCollapse();
// item.handleQty=itemHandleQty;
// this.closeScan();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
calcHandleQty() {
for (let item of this.detailSource) {
item.qty = 0;
for (let detail of item.subList) {
if (detail != undefined) {
item.qty = calc.add(item.qty,detail.qty)
}
}
}
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();
},
openScanPopup() {
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
submit() {
if(this.getScanCount()==0){
this.showErrorMessage("当前扫描数为0,请先扫描在提交");
return
}
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode
this.detailSource.forEach(toLocation => {
toLocation.Items.forEach(item => {
itemCodes.push(item.itemCode)
})
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
submitJob() {
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
repleinshRecordSubmit(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)
})
},
setParams() {
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
record.fromPackingNumber = r
.packingNumber;
record.fromBatch = r.batch;
record.fromContainerNumber = r
.ContainerNumber;
record.toContainerNumber = r
.ContainerNumber;
record.toInventoryStatus = r
.inventoryStatus;
record.toLocationCode = subItem
.toLocationCode;
record.fromLocationCode = fromLocation
.fromLocationCode
record.supplierCode = r.supplierCode;
//使
var info = getPackingNumberAndBatch(
this.managementList, r
.itemCode,
r.packingNumber, r
.batch);
record.toPackingNumber = info
.packingNumber;
record.toBatch = info.batch;
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
this.dataContent.subList = subList
this.dataContent.createTime = createTime;
this.dataContent.creator = creator;
return this.dataContent;
},
getScanCount(){
var scanCount = 0;
var subList = []
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
subItem.recordList.push(record);
})
subList.push(subItem);
}
})
})
})
})
return scanCount =subList.length;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
getLocation(location, code) {
this.getToLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) {
// if (this.fromLocationCode == code) {
// uni.showToast({
// title: "[" + this.fromLocationCode + "][" + code + "]",
// duration: 2000
// })
// return
// }
this.ToLocationCodeInfo = location;
this.toLocationCode = code;
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
clearData() {
this.fromLocationCode = '';
this.detailSource = [];
this.requestList = [];
this.dataContent = {}
this.managementList = []
},
}
}
</script>
<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>
Loading…
Cancel
Save