Commit 8a6f5547 authored by xiangzj's avatar xiangzj

生产计划和包材计划

parent 77948db1
......@@ -177,6 +177,7 @@
let product = {}
_this.planinnerLists = _this.planinnerLists.map((item, i) => {
if (i === fromIndex) {
item.description = selectedProduct.SHORT_TEXT
item.product_info = {
...selectedProduct,
product_id: selectedProduct.PRODUCT_ID
......@@ -188,7 +189,7 @@
return item
})
_this.updateNoQuotaData(fromIndex, '', product);
// _this.updateNoQuotaData(fromIndex, '', product);
})
},
......@@ -222,34 +223,39 @@
},
async updateNoQuotaData(productIndex, mode = '', product) {
console.log('updateNoQuotaData---entry', productIndex, mode, product)
let item_inner = []
let productAfterInit = this.updateProductByInit(productIndex, mode, product)
const {
PRODUCT_ID,
SHORT_TEXT
} = product.product_info
let productAfterInit = []
this.planinnerLists.forEach(item => {
productAfterInit.push({
...item,
product_id: PRODUCT_ID,
description: SHORT_TEXT,
})
});
console.log('productAfterInit', productAfterInit)
// 产品编号和件数 都有才请求
if (!(productAfterInit?.product_info?.product_id &&
productAfterInit?.planqty_box)) {
const flag = productAfterInit.every(function(item){
return item.product_id
});
console.log(flag,'90909')
if(!flag){
return
}
item_inner = [productAfterInit]
const params = {
'user_bp': this.userInfo.code,
"head": this.HEADINFO,
"item": item_inner,
"item": productAfterInit,
}
const res = await apiUpdateProduceMaterialPlanData(params)
console.log('updateNoQuotaData', res)
this.HEADINFO.tby_dmbtr = res.data.head.tby_dmbtr || 0
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item = {
...item,
...product,
...res.DATA
}
item = {
...item,
...product,
...res.data.item[i]
}
return item
})
......@@ -266,6 +272,7 @@
let obj = {}
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item.product_id = PRODUCT_ID
item.product_id = PRODUCT_ID
item.description = SHORT_TEXT
item.planqty_box = item.planqty_box
......@@ -286,7 +293,8 @@
"product_id": "",
"description": "",
"SHORT_TEXT": "",
'product_info': {}
'product_info': {},
...this.productInitInfo
}
this.planinnerLists.unshift(product)
},
......@@ -317,29 +325,41 @@
this.HEADINFO.preorder = e.detail.value === false ? 0 : 1
},
async submit() {
const params = {
USER_BP: this.userInfo.code,
HEAD: this.HEADINFO,
ITEM: this.planinnerLists
let res1 = null
try{
const params = {
USER_BP: this.userInfo.code,
HEAD: this.HEADINFO,
ITEM: this.planinnerLists
}
res1 = await apiUpdateProduceMaterialOrder(params)
if(res1.msgtype !== 'S'){
return
}
}catch(e){
//TODO handle the exception
}
const res = await apiUpdateProduceMaterialOrder(params)
try{
const { head, item } = res1
const params2 = {
USER_BP: this.userInfo.code,
ROLE:'WLY001',
MODE: 'SUBMIT',
head,
item
}
// this.HEADINFO = HEAD2
// this.planinnerLists = ITEM2
const res2 = await apiSubmitProduceMaterialOrder(params2)
if(res2.msgtype !== 'S'){
return
}
this.orderInfo = res.HEAD
const { head, item } = res
const params2 = {
USER_BP: this.userInfo.code,
ROLE:'WLY001',
MODE: 'SUBMIT',
head,
item
this.$refs.popup.open('center')
}catch(e){
//TODO handle the exception
}
// this.HEADINFO = HEAD2
// this.planinnerLists = ITEM2
const res2 = await apiSubmitProduceMaterialOrder(params2)
this.orderInfo = res.HEAD
this.$refs.popup.open('center')
},
resetData() {
this.planinnerLists = []
......@@ -529,7 +549,7 @@
.swipe-right-block {
width: 152rpx;
background: linear-gradient(90deg, #fb4d61, #ff0f00 100%);
background: #ff0f00;
border-radius: 0px 8px 8px 0px;
display: flex;
align-items: center;
......@@ -540,6 +560,7 @@
width: 152rpx;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
color: #fff;
font-size: 34rpx;
......
......@@ -76,7 +76,7 @@
<view class="popup-content-content">
<text class="popup-content-content__title">提交成功</text>
<!-- <text class="popup-content-content__title2">生产计划编号:{{ orderInfo.OBJECT_ID }}</text> -->
<text class="popup-content-content__title2">生产计划单号:{{ orderInfo.PRODPL_ID }}</text>
<text class="popup-content-content__title2">生产计划单号:{{ orderInfo.prodpl_id }}</text>
</view>
<view class="popup-content-foot">
<text class="popup-content-foot__btn" @click="resetData()">继续添加</text>
......@@ -116,13 +116,14 @@
checked: false,
'planqty_box': 0,
'total': 0,
'description': '请选择',
'description': '',
'product_info': {},
}],
HEADINFO: {},
productInitInfo: {},
orderInfo: {
PRODPL_ID: ''
prodpl_id: ''
},
}
},
......@@ -152,9 +153,10 @@
let product = {}
_this.planinnerLists = _this.planinnerLists.map((item, i) => {
if (i === fromIndex) {
item.description = selectedProduct.SHORT_TEXT
item.product_info = {
...selectedProduct,
product_id: selectedProduct.PRODUCT_ID
prod_id: selectedProduct.PRODUCT_ID
}
product = {
...item
......@@ -163,7 +165,7 @@
return item
})
_this.updateNoQuotaData(fromIndex, '', product);
// _this.updateNoQuotaData(fromIndex, '', product);
})
},
......@@ -197,23 +199,29 @@
},
async updateNoQuotaData(productIndex, mode = '', product) {
console.log('updateNoQuotaData---entry', productIndex, mode, product)
let item_inner = []
let productAfterInit = this.updateProductByInit(productIndex, mode, product)
// let productAfterInit = this.updateProductByInit(productIndex, mode, product)
const {
PRODUCT_ID,
SHORT_TEXT
} = product.product_info
let productAfterInit = []
this.planinnerLists.forEach(item => {
productAfterInit.push({
...item,
prod_id: PRODUCT_ID,
description: SHORT_TEXT
})
});
console.log('productAfterInit', productAfterInit)
// 产品编号和件数 都有才请求
if (!(productAfterInit?.product_info?.product_id &&
productAfterInit?.planqty_box)) {
const flag = productAfterInit.every(function(item){
return item.prod_id
});
if(!flag){
return
}
item_inner = [productAfterInit]
const params = {
"head": this.HEADINFO,
"item": item_inner,
"item": productAfterInit,
}
const res = await apiUpdateProducePlanData(params)
console.log('updateNoQuotaData', res)
......@@ -223,7 +231,7 @@
item = {
...item,
...product,
...res.data[0]
...res.data.item[i]
}
}
return item
......@@ -238,17 +246,25 @@
PRODUCT_ID,
SHORT_TEXT
} = product.product_info
let obj = {}
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item.PROD_ID = PRODUCT_ID
item.description = SHORT_TEXT
item.planqty_box = item.planqty_box
obj = item
this.planinnerLists = this.planinnerLists.forEach(item => {
item = {
...item,
prod_id: PRODUCT_ID,
description: SHORT_TEXT
}
return item
})
return obj
});
return this.planinnerLists
// let obj = {}
// this.planinnerLists = this.planinnerLists.map((item, i) => {
// if (i === productIndex) {
// item.prod_id = PRODUCT_ID
// item.description = SHORT_TEXT
// item.planqty_box = item.planqty_box
// obj = item
// }
// return item
// })
// return obj
},
selectProduct(index) {
uni.navigateTo({
......@@ -264,7 +280,8 @@
"short_text": "",
'net_price': '',
'net_value': '',
'product_info': {}
'product_info': {},
...this.productInitInfo
}
this.planinnerLists.unshift(product)
},
......@@ -298,13 +315,34 @@
this.HEADINFO.preorder = e.detail.value === false ? 0 : 1
},
async submit() {
// const flag = this.planinnerLists.every(function(item){
// console.log(item,'')
// return item.description
// });
// console.log(flag,'123321')
// if(!flag){
// uni.showToast({
// title: '请先选择产品',
// duration: 2000,
// icon: 'none'
// });
// return
// }
let res1 = null
try{
const params = {
head: this.HEADINFO,
item: this.planinnerLists
}
const res = await apiUpdateProduceOrder(params)
const { head, item } = res.data
res1 = await apiUpdateProduceOrder(params)
if(res1.msgtype !== 'S'){
return
}
}catch(e){
//TODO handle the exception
}
try{
const { head, item } = res1.data
const params2 = {
ROLE:'WLY001',
MODE: 'SUBMIT',
......@@ -314,9 +352,10 @@
// this.HEADINFO = HEAD2
// this.planinnerLists = ITEM2
const res2 = await apiSubmitProduceOrder(params2)
this.orderInfo = res.DATA1
if(res2.msgtype !== 'S'){
return
}
this.orderInfo = {...res1.data.head}
this.$refs.popup.open('center')
}catch(e){
//TODO handle the exception
......@@ -493,7 +532,7 @@
.swipe-right-block {
width: 152rpx;
background: linear-gradient(90deg, #fb4d61, #ff0f00 100%);
background: #ff0f00;
border-radius: 0px 8px 8px 0px;
display: flex;
align-items: center;
......@@ -504,6 +543,7 @@
width: 152rpx;
display: flex;
align-items: center;
text-align: center;
color: #fff;
font-size: 34rpx;
font-weight: 500;
......
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