Commit 0a5a68b7 authored by chuan.liu's avatar chuan.liu

材料计划联调

parent 8962c2c3
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
<view class="cell-list"> <view class="cell-list">
<view class="middle view planout-block-item"> <view class="middle view planout-block-item">
<view class="item-block item-block-code"> <view class="item-block item-block-code">
<text class="item-block-label">单号:{{itemHead.PRODPL_ID}}</text> <text class="item-block-label">单号:{{itemHead.PACKPL_ID}}</text>
<button class="item-block-btn" type="default"><text <button class="item-block-btn" type="default"><text
class="item-block-btn__text">{{itemHead.STATUS}}</text></button> class="item-block-btn__text">{{itemHead.STATUS}}</text></button>
</view> </view>
<view class="item-block item-block-name"> <view class="item-block item-block-name">
<text class="item-block-label item-block__label">高端总经销材料计划</text> <text class="item-block-label item-block__label">{{itemHead.PACKTYPE}}</text>
</view> </view>
<view class="item-block"> <view class="item-block">
<text class="item-block-label-des">{{itemHead.DATUM}}</text> <text class="item-block-label-des">{{itemHead.DATUM}}</text>
...@@ -30,12 +30,12 @@ ...@@ -30,12 +30,12 @@
</view> </view>
<view class="block-detal-item block-detal-item-last"> <view class="block-detal-item block-detal-item-last">
<text class="detal-item-label">吨数</text> <text class="detal-item-label">吨数</text>
<text class="detal-item-value">7</text> <text class="detal-item-value">{{item.PLANQTY_TON}}</text>
</view> </view>
</view> </view>
<view class="item-block"> <view class="item-block">
<text class="item-block-label-des">尽快发货</text> <text class="item-block-label-des">{{itemHead.REMARK}}</text>
</view> </view>
<view class="item-block item-block-date"> <view class="item-block item-block-date">
<text class="detal-item-label">备注</text> <text class="detal-item-label">备注</text>
...@@ -196,13 +196,10 @@ ...@@ -196,13 +196,10 @@
} }
.item-block-btn { .item-block-btn {
width: 120rpx;
height: 48rpx; height: 48rpx;
line-height: 48rpx; line-height: 44rpx;
background: #f61d30; background: #f61d30;
border-radius: 80rpx 200rpx 200rpx 80rpx; border-radius: 80rpx 200rpx 200rpx 80rpx;
font-size: 12px;
color: #fff;
text-align: center; text-align: center;
} }
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
} from 'vuex' } from 'vuex'
import { import {
apiGetProduceOrder apiGetProduceMaterialOrder
} from '@/servers/produceOrder.js' } from '@/servers/produceMaterial.js'
export default { export default {
components: { components: {
...@@ -77,15 +77,7 @@ ...@@ -77,15 +77,7 @@
}, },
data() { data() {
return { return {
dataList: [{ dataList: [],
id: "tab01",
name: '最新',
newsid: 0
}, {
id: "tab02",
name: '大公司',
newsid: 23
}],
navigateFlag: false, navigateFlag: false,
pulling: false, pulling: false,
refreshing: false, refreshing: false,
...@@ -163,7 +155,7 @@ ...@@ -163,7 +155,7 @@
...this.page ...this.page
} }
apiGetProduceOrder(params).then((res) => { apiGetProduceMaterialOrder(params).then((res) => {
console.log('loadData', res) console.log('loadData', res)
const { const {
DATA, DATA,
...@@ -204,6 +196,7 @@ ...@@ -204,6 +196,7 @@
}) })
}, },
loadMore(e) { loadMore(e) {
console.log('loadMore')
this.page.PAGE++ this.page.PAGE++
this.loadData(); this.loadData();
}, },
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
<view class="lists"> <view class="lists">
<view class="status_bar" :style="navHeight"></view> <view class="status_bar" :style="navHeight"></view>
<view class="middle summary"> <view class="middle summary">
<view class="summary-line"> <!-- <view class="summary-line"> -->
<view class="summary-block"> <view class="summary-block">
<text class="upload-text">预约</text> <text class="upload-text">预约</text>
</view>
<switch class="summary-num" color='red' :checked="isChecked" @change="switchChange" />
</view> </view>
<view class="summary-line summary-line-last"> <switch class="summary-num" color='red' :checked="isChecked" @change="switchChange" />
<!-- </view> -->
<!-- <view class="summary-line summary-line-last">
<text class="upload-text-2">材料保证金</text> <text class="upload-text-2">材料保证金</text>
<text class="summary-num-2">0.00</text> <text class="summary-num-2">0.00</text>
</view> </view> -->
</view> </view>
<view class="middle upload salescenter"> <view class="middle upload salescenter">
...@@ -44,22 +44,23 @@ ...@@ -44,22 +44,23 @@
<view class="planout-block"> <view class="planout-block">
<text class="planout-block-title">备料产品</text> <text class="planout-block-title">备料产品</text>
<image class="planout-block-icon" src="@/static/image/shop_more@3x.png" mode="aspectFit"></image> <image class="planout-block-icon" src="@/static/image/shop_more@3x.png" @click="addPlanout()"
mode="aspectFit"></image>
</view> </view>
<scroll-view class="scroll-area view" :scroll-top="scrollTop" scroll-y="true" :show-scrollbar='false'> <scroll-view class="scroll-area view" :scroll-top="scrollTop" scroll-y="true" :show-scrollbar='false'>
<uni-swipe-action class="planout-block-lists"> <uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="item in 2" :key='item'> <uni-swipe-action-item v-for="(item,index) in planinnerLists" :key='index'>
<view class="middle view planout-block-item"> <view class="middle view planout-block-item">
<view class="text-block title-first"> <view class="text-block title-first">
<text class="middle-date title-first__text">1</text> <text class="middle-date title-first__text">{{index+1}}</text>
</view> </view>
<view class="text-block"> <view class="text-block" @click="selectProduct(index,'inner')">
<text class="middle-date">产品</text> <text class="middle-date">产品</text>
<view class="middle-date-des uni-list picker-year"> <view class="middle-date-des uni-list picker-year">
<view class="uni-list-cell"> <view class="uni-list-cell">
<view class="uni-list-cell-db"> <view class="uni-list-cell-db">
<text class="middle-date-des">请选择</text> <text class="middle-date-des">{{item.DESCRIPTION}}</text>
</view> </view>
</view> </view>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image> <image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
...@@ -67,23 +68,24 @@ ...@@ -67,23 +68,24 @@
</view> </view>
<view class="text-block"> <view class="text-block">
<text class="middle-date">备料件数</text> <text class="middle-date">备料件数</text>
<input class="middle-date-des" type="text" value="" placeholder="请填写" /> <input class="middle-date-des" type="text" @blur="updateNoQuotaData(index,'',item)"
v-model="item.quantity" placeholder="请填写" />
</view> </view>
<view class="text-block"> <view class="text-block">
<text class="middle-date">吨</text> <text class="middle-date">吨</text>
<text class="middle-date-des">2.5</text> <text class="middle-date-des">{{item.PLANQTY_TON}}</text>
</view> </view>
<view class="text-block"> <!-- <view class="text-block">
<text class="middle-date">保证金</text> <text class="middle-date">保证金</text>
<text class="middle-date-des">0.00</text> <text class="middle-date-des">0.00</text>
</view> </view> -->
<view class="text-block text-block-last"> <view class="text-block text-block-last">
<text class="middle-date">备注</text> <text class="middle-date">备注</text>
<text class="middle-date-des">尽快发货</text> <input class="middle-date-des" type="text" v-model="item.REMARK" placeholder="请填写" />
</view> </view>
</view> </view>
<template v-slot:right> <template v-slot:right>
<view class="swipe-right-block" @click="handleDel"><text <view class="swipe-right-block" @click="handleDel(index)"><text
class="swipe-right-block__text">删除</text> class="swipe-right-block__text">删除</text>
</view> </view>
</template> </template>
...@@ -98,8 +100,8 @@ ...@@ -98,8 +100,8 @@
</view> </view>
<view class="popup-content-content"> <view class="popup-content-content">
<text class="popup-content-content__title">提交成功</text> <text class="popup-content-content__title">提交成功</text>
<text class="popup-content-content__title2">生产备料编号:{{ orderNo }}</text> <text class="popup-content-content__title2">生产备料编号:{{ orderInfo.OBJECT_ID }}</text>
<text class="popup-content-content__title2">生产备料单号:{{ orderNo }}</text> <text class="popup-content-content__title2">生产备料单号:{{ orderInfo.PRODPL_ID }}</text>
</view> </view>
<view class="popup-content-foot"> <view class="popup-content-foot">
<text class="popup-content-foot__btn" @click="fnBackHome()">继续添加</text> <text class="popup-content-foot__btn" @click="fnBackHome()">继续添加</text>
...@@ -118,16 +120,16 @@ ...@@ -118,16 +120,16 @@
} from 'vuex' } from 'vuex'
import { import {
apiProducePlanInit, apiProduceMaterialPlanInit,
apiUpdateProducePlanData, apiUpdateProduceMaterialPlanData,
apiUpdateProduceOrder apiUpdateProduceMaterialOrder,
} from '@/servers/produceOrder.js' apiSubmitProduceMaterialOrder
} from '@/servers/produceMaterial.js'
export default { export default {
data() { data() {
return { return {
isChecked: false, isChecked: false,
orderNo: '',
scrollTop: 0, scrollTop: 0,
selectedSalesCenterArr: [{ selectedSalesCenterArr: [{
KEY: -1, KEY: -1,
...@@ -154,34 +156,161 @@ ...@@ -154,34 +156,161 @@
'height': `${this.sysinfo.safeArea.top + 44}px` 'height': `${this.sysinfo.safeArea.top + 44}px`
} }
}, },
...mapState(['sysinfo']) ...mapState(['sysinfo', 'userInfo'])
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
this.$refs.popup.open('center') this.initProduceMaterialPlanData()
},
created() {
this.initProduceMaterialPlanData()
},
mounted() {
console.log('监听到事件来自 onShow');
let _this = this
uni.$on('selectedProduct', function(data) {
console.log('监听到事件来自 selectedProduct ,携带参数 msg 为:', data);
const fromIndex = data.index * 1
const selectedProduct = data.selectedProduct
let product = {}
_this.planinnerLists = _this.planinnerLists.map((item, i) => {
if (i === fromIndex) {
item.product_info = {
...selectedProduct
}
product = {
...item
}
}
return item
})
_this.updateNoQuotaData(fromIndex, '', product);
})
},
onUnload() {
uni.$off('selectedProduct')
}, },
methods: { methods: {
change(e) { // 初始化订单数据
console.log('当前模式:' + e.type + ',状态:' + e.show); async initProduceMaterialPlanData() {
const params = {
'PARTNER': this.userInfo.customerCode
}
const res = await apiProduceMaterialPlanInit(params)
const {
HEAD,
YXDY,
ITEM
} = res.DATA
this.selectedSalesCenterArr = YXDY
this.planinnerLists[0] = {
...this.planinnerLists[0],
...ITEM[0]
}
this.HEADINFO = HEAD
this.productInitInfo = ITEM[0]
}, },
fnBackHome() { async updateNoQuotaData(productIndex, mode = '', product) {
this.$refs.popup.close() console.log('updateNoQuotaData---entry', productIndex, mode, product)
let item_inner = []
let productAfterInit = this.updateProductByInit(productIndex, mode, product)
console.log('productAfterInit', productAfterInit)
// 产品编号和件数 都有才请求
if (!(productAfterInit?.product_info?.PRODUCT_ID &&
productAfterInit?.PLANQTY_BOX)) {
return
}
item_inner = [productAfterInit]
const params = {
// "HEAD": this.HEADINFO,
"ITEM": item_inner,
}
const res = await apiUpdateProduceMaterialPlanData(params)
console.log('updateNoQuotaData', res)
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item = {
...item,
...product,
...res.DATA[0]
}
}
return item
})
console.log('planinnerLists', this.planinnerLists)
}, },
fnCheckOrderByNo() { // 更新选中的产品
this.$refs.popup.close() updateProductByInit(productIndex, mode, product) {
uni.navigateTo({ const {
url: `/pages/produce-material/produce-material` PRODUCT_ID,
SHORT_TEXT
} = product.product_info
let obj = {}
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item.PRODUCT_ID = PRODUCT_ID
item.DESCRIPTION = SHORT_TEXT
item.PLANQTY_BOX = item.quantity
obj = item
}
return item
}) })
return obj
},
selectProduct(index) {
if (this.salesCenterIndex !== -1) {
uni.navigateTo({
url: `/pages/select-product-pro/select-product-pro?from=produceMaterialOrder&mode=&index=${index*1}&head=${JSON.stringify(this.HEADINFO)}`
});
} else {
uni.showToast({
title: '请先选择营销中心',
duration: 2000,
icon: 'none'
});
}
},
addPlanout() {
let product = {
checked: false,
"PRODUCT_ID": "",
"DESCRIPTION": "",
"SHORT_TEXT": "",
'product_info': {}
}
this.planinnerLists.unshift(product)
}, },
// 选择营销中心 // 选择营销中心
bindPickerSalesCenterChange(e) { bindPickerSalesCenterChange(e) {
console.log('picker发送选择改变,携带值为', e.detail.value) console.log('picker发送选择改变,携带值为', e.detail.value)
this.salesCenterIndex = e.detail.value this.salesCenterIndex = e.detail.value
this.selectedSalesCenter = this.selectedSalesCenterArr[this.salesCenterIndex] this.selectedSalesCenter = this.selectedSalesCenterArr[this.salesCenterIndex]
this.HEADINFO.SALS_CENTER = this.selectedSalesCenter.VALUE this.HEADINFO.ZZFLD00001H = this.selectedSalesCenter.VALUE
}, },
handleDel(index, ) { handleDel(index, ) {
this.planinnerLists.splice(index, 1) this.planinnerLists.splice(index, 1)
}, },
fnBackHome() {
this.$refs.popup.close()
},
fnCheckOrderByNo() {
this.$refs.popup.close()
uni.navigateTo({
url: `/pages/produce-material/produce-material`
})
},
preStep() { preStep() {
uni.switchTab({ uni.switchTab({
url: `/pages/go-order/go-order` url: `/pages/go-order/go-order`
...@@ -190,7 +319,41 @@ ...@@ -190,7 +319,41 @@
switchChange(e) { switchChange(e) {
console.log('switch1 发生 change 事件,携带值为', e.detail.value) console.log('switch1 发生 change 事件,携带值为', e.detail.value)
this.isChecked = e.detail.value this.isChecked = e.detail.value
this.HEADINFO.PREORDER = e.detail.value === false ? 0 : 1
},
async submit() {
const params = {
HEAD: this.HEADINFO,
ITEM: this.planinnerLists
}
const res = await apiUpdateProduceMaterialOrder(params)
const {
DATA1: HEAD2,
DATA2: ITEM2
} = res
const params2 = {
HEAD: HEAD2,
ITEM: ITEM2
}
// this.HEADINFO = HEAD2
// this.planinnerLists = ITEM2
const res2 = await apiSubmitProduceMaterialOrder(params2)
this.orderInfo = res.DATA1
this.$refs.popup.open('center')
}, },
resetData() {
this.planinnerLists = []
this.salesCenterIndex = -1
this.selectedSalesCenter = {}
this.initProduceMaterialPlanData()
}
} }
} }
</script> </script>
...@@ -320,9 +483,17 @@ ...@@ -320,9 +483,17 @@
.summary { .summary {
display: flex; display: flex;
flex-direction: column; justify-content: space-between;
justify-content: center;
padding: 32rpx 48rpx; padding: 32rpx 48rpx;
margin-bottom: 32rpx;
}
.salescenter {
display: flex;
align-items: center;
height: 100rpx;
padding: 0 16px 0 24px;
} }
.summary-line { .summary-line {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
class="item-block-btn__text">{{itemHead.STATUS}}</text></button> class="item-block-btn__text">{{itemHead.STATUS}}</text></button>
</view> </view>
<view class="item-block item-block-name"> <view class="item-block item-block-name">
<text class="item-block-label item-block__label">配额生产计划</text> <text class="item-block-label item-block__label">{{itemHead.PRODPLTYPE}}</text>
</view> </view>
<view class="item-block"> <view class="item-block">
<text class="item-block-label-des">{{itemHead.DATUM}}</text> <text class="item-block-label-des">{{itemHead.DATUM}}</text>
......
...@@ -105,7 +105,8 @@ ...@@ -105,7 +105,8 @@
import { import {
apiProducePlanInit, apiProducePlanInit,
apiUpdateProducePlanData, apiUpdateProducePlanData,
apiUpdateProduceOrder apiUpdateProduceOrder,
apiSubmitProduceOrder
} from '@/servers/produceOrder.js' } from '@/servers/produceOrder.js'
export default { export default {
...@@ -113,7 +114,6 @@ ...@@ -113,7 +114,6 @@
return { return {
isChecked: false, isChecked: false,
scrollTop: 0, scrollTop: 0,
orderNo: '',
selectedSalesCenterArr: [{ selectedSalesCenterArr: [{
KEY: -1, KEY: -1,
VALUE: '' VALUE: ''
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
} }
const res = await apiProducePlanInit(params) const res = await apiProducePlanInit(params)
const { const {
INFO, HEAD,
YXDY, YXDY,
ITEM ITEM
} = res.DATA } = res.DATA
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
...this.planinnerLists[0], ...this.planinnerLists[0],
...ITEM[0] ...ITEM[0]
} }
this.HEADINFO = INFO this.HEADINFO = HEAD
this.productInitInfo = ITEM[0] this.productInitInfo = ITEM[0]
}, },
async updateNoQuotaData(productIndex, mode = '', product) { async updateNoQuotaData(productIndex, mode = '', product) {
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
item_inner = [productAfterInit] item_inner = [productAfterInit]
const params = { const params = {
"INFO": this.HEADINFO, "HEAD": this.HEADINFO,
"ITEM": item_inner, "ITEM": item_inner,
} }
const res = await apiUpdateProducePlanData(params) const res = await apiUpdateProducePlanData(params)
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
let obj = {} let obj = {}
this.planinnerLists = this.planinnerLists.map((item, i) => { this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) { if (i === productIndex) {
item.ORDERED_PROD = PRODUCT_ID item.PROD_ID = PRODUCT_ID
item.DESCRIPTION = SHORT_TEXT item.DESCRIPTION = SHORT_TEXT
item.PLANQTY_BOX = item.quantity item.PLANQTY_BOX = item.quantity
obj = item obj = item
...@@ -288,9 +288,6 @@ ...@@ -288,9 +288,6 @@
handleDel(index, ) { handleDel(index, ) {
this.planinnerLists.splice(index, 1) this.planinnerLists.splice(index, 1)
}, },
change(e) {
console.log('当前模式:' + e.type + ',状态:' + e.show);
},
fnBackHome() { fnBackHome() {
this.resetData() this.resetData()
this.$refs.popup.close() this.$refs.popup.close()
...@@ -314,11 +311,26 @@ ...@@ -314,11 +311,26 @@
async submit() { async submit() {
const params = { const params = {
INFO: this.HEADINFO, HEAD: this.HEADINFO,
ITEM: this.planinnerLists ITEM: this.planinnerLists
} }
const res = await apiUpdateProduceOrder(params) const res = await apiUpdateProduceOrder(params)
const {
DATA1: HEAD2,
DATA2: ITEM2
} = res
const params2 = {
HEAD: HEAD2,
ITEM: ITEM2
}
// this.HEADINFO = HEAD2
// this.planinnerLists = ITEM2
const res2 = await apiSubmitProduceOrder(params2)
this.orderInfo = res.DATA1 this.orderInfo = res.DATA1
this.$refs.popup.open('center') this.$refs.popup.open('center')
......
import apiHelper from './api.helper.js'
/**
* 根据搜索条件查询材料计划信息。
* @param name 账户名
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiGetProduceMaterialOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/get_m_plan_app', params)
return res
}
/**
* 材料计划创建初始化数据。
* @param name 账户名
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiProduceMaterialPlanInit(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/m_plan_init', params)
return res
}
/**
* 材料计划项目更新数据
* @param name 账户名
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiUpdateProduceMaterialPlanData(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/m_plan_update', params)
return res
}
/**
* 材料计划单保存。
* @param
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiUpdateProduceMaterialOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/prodplan03', params)
return res
}
/**
* 材料计划单提交。
* @param
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiSubmitProduceMaterialOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/masterdata/materialplnsubm', params)
return res
}
/**
* 查询客户可售产品。
* @param captcha 验证码
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiProductSelect(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/bp_pro_search', params)
return res
}
...@@ -32,11 +32,21 @@ export async function apiUpdateProducePlanData(params) { ...@@ -32,11 +32,21 @@ export async function apiUpdateProducePlanData(params) {
} }
/** /**
* 生产计划单提交 * 生产计划单保存
* @param * @param
* @returns {Promise<AxiosResponse<T>>} * @returns {Promise<AxiosResponse<T>>}
*/ */
export async function apiUpdateProduceOrder(params) { export async function apiUpdateProduceOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/prodplan03', params)
return res
}
/**
* 生产计划单提交。
* @param
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiSubmitProduceOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/prodplan003', params) const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/prodplan003', params)
return res return res
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment