Browse Source

Merge branch 'develop' of http://101.201.121.115:3000/leo/LAPP_AdvancedPlanner_Front into szdq

# Conflicts:
#	src/components/queryComponent/index.vue
#	src/server/request.js
szdq
wangxy 3 years ago
parent
commit
e4fba38014
12 changed files with 1260 additions and 33 deletions
  1. +29
    -4
      src/components/queryComponent/index.vue
  2. +19
    -7
      src/router/productionPlanning.js
  3. +1
    -0
      src/server/productionPlanning/customerForecastDemandReview.js
  4. +20
    -0
      src/server/productionPlanning/emergencyOrder.js
  5. +1
    -1
      src/server/request.js
  6. +1
    -0
      src/views/plan/workbench/homePage/beta/predict/index.vue
  7. +90
    -16
      src/views/productionPlanning/customerForecastDemandReview/demandPlanning/articleDemand/index.vue
  8. +1
    -1
      src/views/productionPlanning/customerForecastDemandReview/demandPlanning/articleDemand/public.vue
  9. +5
    -3
      src/views/productionPlanning/customerForecastDemandReview/demandPlanning/index.vue
  10. +540
    -0
      src/views/productionPlanning/emergencyOrder/index.vue
  11. +2
    -1
      src/views/productionPlanning/productInventory/index.vue
  12. +551
    -0
      src/views/productionPlanning/versionHistory/index.vue

+ 29
- 4
src/components/queryComponent/index.vue View File

@ -84,6 +84,7 @@
import { put, post } from "@/server/api.js";
// isShowAddButton:
import uploadTemplate from "./upload.vue";
import { ElMessage } from 'element-plus'
import lookError from "./lookError.vue";
import {mapMutations} from 'vuex'
export default {
@ -121,7 +122,13 @@ export default {
return post('/admin/ap/custdemandverhead/issueallversion', this.batchImport)
})
.then(() => {
this.msgSuccess("批量发布成功");
// this.msgSuccess("");
ElMessage({
showClose: true,
message: '批量发布成功',
type: 'success',
duration: 0
})
this.$emit('batchReleaseEmit', true)
})
.catch(() => { });
@ -139,12 +146,24 @@ export default {
return put('/admin/ap/custdemandverhead/issueglobalallversion')
})
.then(() => {
this.msgSuccess("全局发布成功");
// this.msgSuccess("");
ElMessage({
showClose: true,
message: '全局发布成功',
type: 'success',
duration: 0
})
this.$emit('batchReleaseEmit', true)
this.getReleaseAllLoading(false)
})
.catch(() => {
.catch(({msg}) => {
this.getReleaseAllLoading(false)
ElMessage({
showClose: true,
message: msg,
type: 'error',
duration: 0
})
});
},
//
@ -158,7 +177,13 @@ export default {
return put('/admin/ap/custdemandverhead/removeissueglobalallversion')
})
.then(() => {
this.msgSuccess("全局反发布成功");
// this.msgSuccess("");
ElMessage({
showClose: true,
message: '全局反发布成功',
type: 'success',
duration: 0
})
this.$emit('batchReleaseEmit', true)
})
.catch(() => { });


+ 19
- 7
src/router/productionPlanning.js View File

@ -1,10 +1,10 @@
const plant = {
icon: "el-icon-coin",
path: "/productionPlanning",
title: "主计划生产管理",
component: () => import("@/views/productionPlanning"),
children: [
{
icon: "el-icon-coin",
path: "/productionPlanning",
title: "主计划生产管理",
component: () => import("@/views/productionPlanning"),
children: [
{
icon: "el-icon-document",
path: "/productionPlanning/customerInquiry",
title: "客户询单",
@ -28,7 +28,19 @@ const plant = {
title: "日生成计划",
component: () => import("@/views/productionPlanning/dailyProductionPlan"),
},
],
{
icon: "el-icon-document",
path: "/productionPlanning/emergencyOrder",
title: "紧急插单",
component: () => import("@/views/productionPlanning/emergencyOrder"),
},
{
icon: "el-icon-document",
path: "/productionPlanning/versionHistory",
title: "历史版本",
component: () => import("@/views/productionPlanning/versionHistory"),
},
],
}
export default plant;

+ 1
- 0
src/server/productionPlanning/customerForecastDemandReview.js View File

@ -80,3 +80,4 @@ export const planOrderQuery = (param)=> get("/admin/ap/planorder/query",param)
export const republish = (data) => post("/admin/ap/planorderversion/relpublish",data)
export const publishIdentifyAll = () => get("admin/ap/planorderversion/publishidentifyall")

+ 20
- 0
src/server/productionPlanning/emergencyOrder.js View File

@ -0,0 +1,20 @@
import {
get,
postForm,
deleteData
} from "../api";
// 工厂列表
export const insertData = (params) => postForm('/admin/ap/balance/articledemandemergencycreate', params);
// 产品列表
export const saveData = (params) => postForm('/admin/ap/balance/articledemandemergencysave', params);
// 查询列表
export const getData = (params) => postForm("/admin/ap/balance/articledemandemergencyget", params);
// 导入文件
export const publishData = (params) => postForm("/admin/ap/balance/articledemandemergencypublish", params);
export const getArtIdList = () => get("/admin/base/article/selectdata?ArtTypeId=FINISHED")
export const deleteall = () => deleteData("/admin/ap/articledemandemergency/deleteall")
export const syncPurchase = () => get("admin/common/task/caigou")

+ 1
- 1
src/server/request.js View File

@ -82,4 +82,4 @@ upService.interceptors.response.use(
return Promise.reject(error.response);
}
);
export {service, upService, baseURL};
export { service, upService, baseURL };

+ 1
- 0
src/views/plan/workbench/homePage/beta/predict/index.vue View File

@ -116,6 +116,7 @@ export default {
"AP_CustDemandVerHead-CreateUser",
"AP_CustDemandVerHead-LastModify",
"AP_CustDemandVerHead-LastUser",
"AP_CustDemandVerHead-UserName",
"AP_CustDemandVerHead-CreateTime",
],
loading: false,


+ 90
- 16
src/views/productionPlanning/customerForecastDemandReview/demandPlanning/articleDemand/index.vue View File

@ -41,10 +41,29 @@
</el-form>
<div class="tool_list">
<div class="search">
<div style="padding:8px;width: 60px;">
<div style="margin-left:15px;padding:8px;width: 35px;">
版本
</div>
<div style="margin-left:15px">
<el-select v-model="publishedVersionNr"
placeholder="请选择">
<el-option v-for="history in historyList"
:key="history.publishedVersionNr"
:label="history.publishedVersionNr"
:value="history.publishedVersionNr" />
</el-select>
</div>
<div style="margin-left:15px">
<el-button class="search-button-style" @click="lookErrorHandler(publishedVersionNr)">日志</el-button>
</div>
<div style="margin-left:15px">
<el-button class="search-button-style" @click="lookErrorLogHandler(publishedVersionNr)">历史数据</el-button>
</div>
<div style="margin-left:15px;padding:8px;width: 80px;">
MPS策略
</div>
<div style="width: 200px;">
<div style="width: 200px;float:left">
<el-select v-model="mode"
placeholder="请选择">
<el-option v-for="item in mpsPlanModeOptions"
@ -73,36 +92,45 @@
MPS计算
</el-button>
</div>
<el-button icon="el-icon-refresh"
size="mini"
class="reset-button-style"
:disabled="syncDataDisable"
@click="syncData" >同步库存</el-button>
</div>
<div class="button_list">
<img :src="require('@/assets/icon/reload.png')"
class="image_button"
title="初始化"
:style="{display:permissions()['reload']?'inline':'none'}"
@click="reloadData">
<div class="button_split"></div>
<div class="button_split" :style="{display:permissions()['reload']?'inline':'none'}"></div>
<img :src="require('@/assets/icon/save.png')"
class="image_button"
title="保存"
:style="{display:permissions()['save']?'inline':'none'}"
@click="saveDemandData">
<div class="button_split"></div>
<div class="button_split" :style="{display:permissions()['save']?'inline':'none'}"></div>
<img :class="publicButtonClass"
:src="require('@/assets/icon/public.png')"
title="发布数据"
:style="{display:permissions()['public']?'inline':'none'}"
@click="publicData">
<div class="button_split"></div>
<div class="button_split" :style="{display:permissions()['public']?'inline':'none'}"></div>
<img :src="require('@/assets/img/download.png')"
class="image_button"
title="导出"
:style="{display:permissions()['export']?'inline':'none'}"
@click="exportData">
<!-- <div class="button_split"></div>
<img :class="editButtonClass" :src="require('@/assets/icon/outsourcing_demand.png')" title="外购需求" @click="editRow('外购需求')"> -->
<div class="button_split"></div>
<div class="button_split" :style="{display:permissions()['export']?'inline':'none'}"></div>
<img :class="editButtonClass"
:src="require('@/assets/icon/net_production.png')"
title="净生产量"
:style="{display:permissions()['net_production']?'inline':'none'}"
@click="editRow('净生产量')">
<!-- <div class="button_split"></div>
<img :src="require('@/assets/icon/refresh.png')" class="image_button" title="刷新数据" @click="refreshData"> -->
</div>
</div>
<el-table ref="articleDemand"
@ -128,7 +156,7 @@
:disabled="item.charAt(item.length - 1) == '*'"
size="mini"></el-input>
<span v-else-if="scope.row[item] == '预测需求' || scope.row[item] == '订单需求' || scope.row[item] == '独立需求'">{{ scope.row[item] }} <div class="add_icon"></div> </span>
<span v-else-if="scope.row[item] == '在制量' || scope.row[item] == '期初库存' ">{{ scope.row[item] }} <div class="subtract_icon"></div> </span>
<span v-else-if="scope.row[item] == '在制量' || scope.row[item] == '期初库存' || scope.row[item] == '采购量' || scope.row[item] == '委外量' ">{{ scope.row[item] }} <div class="subtract_icon"></div> </span>
<span v-else>{{ scope.row[item] }}</span>
</template>
</el-table-column>
@ -162,6 +190,7 @@
import Public from "./public";
import Char from "./char";
import { mapActions, mapMutations, mapState } from "vuex";
import { baseURL } from "@/server/request"
import {
getArtIdList,
publishedVersion,
@ -169,8 +198,10 @@
reloadData,
saveDemand,
searchResource,
exportData
exportData,
publishIdentifyAll
} from "@/server/productionPlanning/customerForecastDemandReview";
import { syncData } from "@/server/productionPlanning/productInventory";
import { getColumnName } from "@/utils/allField.js";
export default {
@ -203,6 +234,9 @@
},
data() {
return {
publishedVersionNr:"",
historyList:[],
syncDataDisable:false,
queryParams: {},
mode: "",
showPublicDialog: false,
@ -216,7 +250,7 @@
editKeyList: [],
pagination:{
pageNumber: 1,
pageSize: 20,
pageSize: 24, // 11 11 .../index.vue 170
total: 0,
}
};
@ -224,6 +258,7 @@
created() {
this.getMpsModeList();
this.getArticleList();
this.getPublishIdentifyAll()
},
mounted() {
this.$nextTick(() => {
@ -306,6 +341,40 @@
"SET_evaluationSecondResourceLoading",
"SET_articleDemandLoading",
]),
getPublishIdentifyAll(){
publishIdentifyAll().then( ( {data = []}) => {
this.historyList = data.publishedVersionLi
})
},
lookErrorHandler(versionNr){
window.open(baseURL + "admin/common/log/read/plan/"+versionNr)
},
lookErrorLogHandler(versionNr){
window.open(baseURL + "admin/common/log/read/planlog/"+versionNr)
},
//
syncData() {
this.syncDataDisable = true
syncData().then(({ code }) => {
if (code == 200) {
this.$message({
type: "success",
message: "同步库存成功"
})
} else {
this.$message({
type: "error",
message: "同步库存失败"
})
}
this.syncDataDisable = false
}).catch(() => {
this.syncDataDisable = false
})
},
getPublishedVersion() {
publishedVersion().then(({ data = "" }) => {
@ -337,10 +406,14 @@
// });
}
},
cancelPublicDialog(opt) {
cancelPublicDialog(data) {
this.showPublicDialog = false
if (opt == "submit") {
if (data !== false) {
this.handleQuery()
this.historyList.push({
publishedVersionNr:data["version"]
})
window.open(baseURL + "admin/common/log/read/planlog/"+data["version"])
}
},
toggleChar() {
@ -628,7 +701,7 @@
justify-content: space-between;
.search {
width: 800px;
width: 1200px;
display: flex;
.mps-button {
@ -669,6 +742,7 @@
background: #ccc;
border-radius: 1px;
border: 1px solid #ccc;
}
.image_button:hover {


+ 1
- 1
src/views/productionPlanning/customerForecastDemandReview/demandPlanning/articleDemand/public.vue View File

@ -156,7 +156,7 @@
publicData(this.formData).then(({ data = [] }) => {
this.loading = false
this.$message({ type: "success", message: "发布成功" });
this.$emit("cancelHandle", "submit")
this.$emit("cancelHandle", this.formData)
}).catch(() => {
this.loading = false
});


+ 5
- 3
src/views/productionPlanning/customerForecastDemandReview/demandPlanning/index.vue View File

@ -58,7 +58,9 @@
"AP_ArticleDemand-TargetInventory": "目标库存",
"AP_ArticleDemand-MinInventory": "最低库存",
"AP_ArticleDemand-NetDemandQty": "净生产量",
"AP_ArticleDemand-EndingInventory": "期末库存"
"AP_ArticleDemand-EndingInventory": "期末库存",
"AP_ArticleDemand-ZaituQty":"采购量",
"AP_ArticleDemand-WeiwaiQty":"委外量"
}
};
},
@ -165,8 +167,8 @@
data["SortKeys"].splice(this.keyStartIndex, 0, "Label");
data["Item"].forEach((item, index) => {
item.key = item["AP_ArticleDemand-ArtId"];
item.Label = this.labelList[item["AP_ArticleDemand-Label"]];
if (index % 10 == 0) {
item.Label = this.labelList[item["AP_ArticleDemand-Label"]]??item["AP_ArticleDemand-Label"];
if (index % 12 == 0) { //
item.show = true;
} else {
item.show = false;


+ 540
- 0
src/views/productionPlanning/emergencyOrder/index.vue View File

@ -0,0 +1,540 @@
<template>
<ContentContainer class="homepage-customer-wrapper">
<div ref="topTableRef"
class="content-table-wrap">
<div class="tool_list">
<el-form :inline="true"
class="clearfix search-content">
<el-form-item :label="getColumnName('AP_ArticleStockLevel-ArtId')">
<el-select v-model="artId"
style="width: 300px"
placeholder="请选择"
filterable
:loading="artIdLoading"
@visible-change="setArtList">
<el-option v-for="item in artList"
:key="item['Article-ArtId']"
:label="item['Article-ArtId'] + '-' + item['Article-Descr1']"
:value="item['Article-ArtId']" />
</el-select>
</el-form-item>
<el-form-item >
<el-button
:disabled="insertArtDoing"
class="add-button-style "
icon="el-icon-plus"
@click="insertArt()">
插入
</el-button>
<el-button icon="el-icon-refresh"
size="mini"
class="reset-button-style"
:disabled="syncDataDisable"
@click="syncPurchase" >同步采购</el-button>
</el-form-item>
</el-form>
<div class="button_list">
<img :src="require('@/assets/icon/reload.png')"
class="image_button"
title="初始化"
@click="initData">
<div class="button_split"></div>
<img :src="require('@/assets/icon/save.png')"
class="image_button"
title="保存"
@click="saveDemandData">
<div class="button_split"></div>
<img :class="publicButtonClass"
:src="require('@/assets/icon/public.png')"
title="发布数据"
@click="publicData">
<div class="button_split"></div>
<div class="button_split"></div>
<img :class="editButtonClass"
:src="require('@/assets/icon/net_production.png')"
title="净生产量"
@click="editRow('净生产量')">
</div>
</div>
<el-table ref="articleDemand"
v-loading="articleDemandLoading"
:cell-class-name="tableCellClassName"
:data="tableData"
:height="height"
:row-class-name="rowClassName"
border
class="articleDemand-table"
highlight-current-row
size="mini"
@row-dblclick="rowDblclick">
<el-table-column v-for="(item,index) in headers"
:key="index"
:label="showTitle(item,index)"
:prop="item"
show-overflow-tooltip
:width="calcWidth(index)">
<template #default="scope">
<el-input v-if="scope.row['Label'] == editField && scope.row['key'] == editKey && index > keyStartIndex "
v-model="scope.row[item]"
:disabled="item.charAt(item.length - 1) == '*'"
size="mini"></el-input>
<span v-else-if="scope.row[item] == '预测需求' || scope.row[item] == '订单需求' || scope.row[item] == '独立需求'">{{ scope.row[item] }}
<div class="add_icon"></div>
</span>
<span v-else-if="scope.row[item] == '在制量' || scope.row[item] == '期初库存' || scope.row[item] == '采购量' || scope.row[item] == '委外量' ">{{ scope.row[item] }}
<div class="subtract_icon"></div>
</span>
<span v-else>{{ scope.row[item] }}</span>
</template>
</el-table-column>
</el-table>
<Pagination v-model:pagination="pagination"
@change="handleQuery" />
</div>
</ContentContainer>
</template>
<script>
import {
insertData,
saveData,
getData,
getArtIdList,
publishData,
deleteall,
syncPurchase,
} from "@/server/productionPlanning/emergencyOrder";
import { getColumnName } from "@/utils/allField.js";
export default {
//
name: "demandPlanning",
data() {
return {
syncDataDisable:false,
artId: "",
insertArtDoing:false,
artIdLoading:false,
articleDemandLoading: false,
publicButtonClass: "disable_button",
editButtonClass: "disable_button",
height: 0,
queryParams: {},
showPublicDialog: false,
showModeDialog: false,
modeType: "",
editField: "",
editKey: "",
selectKey: "",
promptMessage: "",
editKeyList: [],
artList:[],
pagination: {
pageNumber: 1,
pageSize: 24,
total: 0,
},
headers: [],
tableData: [],
mode: "",
keyStartIndex: 6,
selectArticleDemandRow:{},
labelList: {
"AP_ArticleDemandEmergency-ForecastDemandQty": "预测需求",
"AP_ArticleDemandEmergency-OrderQty": "订单需求",
"AP_ArticleDemandEmergency-OutSourcingQty": "外购需求",
"AP_ArticleDemandEmergency-IndependentDemandQty": "独立需求",
"AP_ArticleDemandEmergency-WipQty": "在制量",
"AP_ArticleDemandEmergency-OpeningInventory": "期初库存",
"AP_ArticleDemandEmergency-TargetInventory": "目标库存",
"AP_ArticleDemandEmergency-MinInventory": "最低库存",
"AP_ArticleDemandEmergency-NetDemandQty": "净生产量",
"AP_ArticleDemandEmergency-EndingInventory": "期末库存",
"AP_ArticleDemandEmergency-ZaituQty":"采购量",
"AP_ArticleDemandEmergency-WeiwaiQty":"委外量"
}
};
},
created() {
},
mounted() {
this.getCustomerArticleDemand(this.pagination)
this.$nextTick(() => {
this.height = this.calculationTableHeight(this.$refs.topTableRef, 125)
});
},
computed: {
calcWidth() {
return function (index) {
let width = "100px"
switch (index) {
case 0:
width = "150px"
break;
case 2:
width = "350px"
break;
}
return width
}
},
showTitle() {
return function (item, index) {
if (item == "Label") {
return "标签";
} else {
if (index < 8) {
return getColumnName(item);
} else {
if (item.charAt(item.length - 1) == "*") {
return item.substr(0, item.length - 1);
} else {
return item;
}
}
}
};
}
},
methods: {
syncPurchase(){
this.syncDataDisable = true
syncPurchase().then(({ code }) => {
if (code == 200) {
this.$message({
type: "success",
message: "同步库存成功"
})
} else {
this.$message({
type: "error",
message: "同步库存失败"
})
}
this.syncDataDisable = false
}).catch(() => {
this.syncDataDisable = false
})
},
initData(){
this.articleDemandLoading = true
deleteall().then(({ code,msg }) => {
if(code == 200) {
this.getCustomerArticleDemand(this.pagination)
}
this.articleDemandLoading = false
}).catch(() => {
this.articleDemandLoading = false
});
},
insertArt(){
this.insertArtDoing = true
insertData({artid:this.artId}).then( ({ code,msg }) => {
this.insertArtDoing = false
if(code == 200) {
this.getCustomerArticleDemand(this.pagination)
this.$message({ type: "success", message: msg });
}
}).catch( () => {
this.insertArtDoing = false
})
},
getCustomerArticleDemand(queryParams) {
this.articleDemandLoading = true
getData(queryParams).then(({ data = [] }) => {
this.dealArticleDemandData(data);
this.articleDemandLoading = false
this.pagination.total = data.count
}).catch(() => {
this.articleDemandLoading = false
});
},
dealArticleDemandData(data) {
if (!data["SortKeys"]) {
this.$message({ type: "error", message: "查询的数据为空" });
return;
}
this.publicButtonClass = "image_button"
data["SortKeys"].splice(this.keyStartIndex, 0, "Label");
data["Item"].forEach((item, index) => {
item.key = item["AP_ArticleDemandEmergency-ArtId"];
item.Label = this.labelList[item["AP_ArticleDemandEmergency-Label"]];
if (index % 12 == 0) {
item.show = true;
} else {
item.show = false;
item["AP_ArticleDemandEmergency-ArtId"] = "";
item["AP_ArticleDemandEmergency-Descr1"] = "";
item["AP_ArticleDemandEmergency-CustomerId"] = "";
item["AP_ArticleDemandEmergency-FGStock"] = "";
item["AP_ArticleDemandEmergency-SFGStock"] = "";
item["AP_ArticleDemandEmergency-WIPStock"] = "";
item["AP_ArticleDemandEmergency-PUCStock"] = "";
item["AP_ArticleDemandEmergency-OSCStock"] = "";
}
});
this.headers = data["SortKeys"];
this.tableData = data["Item"];
this.editButtonClass = "disable_button"
},
getPublishedVersion() {
publishedVersion().then(({ data = "" }) => {
this.promptMessage = data
})
},
handleQuery() {
this.getPublishedVersion()
this.getCustomerArticleDemand(this.pagination)
},
//
setArtList() {
this.artIdLoading = true
getArtIdList().then(({ data = [] }) => {
this.artIdLoading = false
this.artList = data;
}).catch( () => {
this.artIdLoading = false
})
},
publicData() {
if(this.publicButtonClass == "disable_button") {
return false
}
this.publicButtonClass = "disable_button"
this.articleDemandLoading = true
publishData().then( ({ code,msg }) => {
this.articleDemandLoading = false
this.publicButtonClass = "image_button"
if(code == 200) {
this.getCustomerArticleDemand(this.pagination)
this.$message({ type: "success", message: msg });
}
}).catch( () => {
this.articleDemandLoading = false
this.publicButtonClass = "image_button"
})
},
cancelPublicDialog(opt) {
this.showPublicDialog = false
if (opt == "submit") {
this.handleQuery()
}
},
//
openModelDialog(type) {
this.modeType = type;
this.showModeDialog = true;
},
//
cancelAddModel() {
this.mode = "";
this.showModeDialog = false;
},
//
rowClassName({ row }) {
return row.show ? "show_row" : "hide_row";
},
//
editRow(data) {
if (!this.editKeyList.includes(this.selectKey)) this.editKeyList.push(this.selectKey)
this.editKey = this.selectKey;
this.editField = data;
},
getTableDataJson() {
let maplist = JSON.parse(JSON.stringify(this.tableData));
maplist.forEach(item => {
item["AP_ArticleDemandEmergency-ArtId"] = item.key;
delete item.index;
delete item.show;
delete item.key;
delete item.Label;
});
return JSON.stringify(maplist);
},
getEditTableDataJson() {
let editMapList = JSON.parse(JSON.stringify(this.tableData)).filter(item => this.editKeyList.includes(item.key))
editMapList.forEach(item => {
item["AP_ArticleDemandEmergency-ArtId"] = item.key;
delete item.index;
delete item.show;
delete item.key;
delete item.Label;
});
return JSON.stringify(editMapList);
},
//
saveDemandData() {
this.editField = "";
let queryParams = {};
queryParams.artid = this.artId;
queryParams.maplist = this.getEditTableDataJson();
this.articleDemandLoading = true
saveData(queryParams).then(({ data = [] }) => {
this.articleDemandLoading = false
this.handleQuery()
this.editKeyList = []
this.$message({ type: "success", message: "保存成功" });
}).catch(() => {
this.articleDemandLoading = false
});
},
//
arraySpanMethod({ rowIndex, columnIndex }) {
if (rowIndex % 11 > 0 && columnIndex < 8) {
if (rowIndex % 11 == 1 && columnIndex == 0) {
return [9, 8];
} else {
return [0, 0];
}
}
},
//
setRowStatus(key) {
this.artId = key
if (this.selectKey == "") {
this.selectKey = key
this.editButtonClass = "image_button"
} else {
if (this.selectKey != key) {
this.selectKey = key
this.editButtonClass = "image_button"
} else {
this.selectKey = ""
this.editButtonClass = "disable_button"
}
}
},
tableCellClassName({ row, column, rowIndex, columnIndex }) {
row.index = rowIndex;
column.index = columnIndex;
},
//
rowDblclick(row) {
if (row.Label == "净生产量") {
this.selectArticleDemandRow = row
this.$refs.articleDemand.setCurrentRow(row);
this.artId = row.artid
this.setRowStatus(row.key);
this.tableData.forEach(item => {
if (item.key == row.key) {
if (item.Label != "净生产量") {
item.show = !item.show;
}
} else {
if (item.Label != "净生产量") {
item.show = false;
}
}
});
}
}
},
}
</script>
<style lang="less" scoped>
.homepage-customer-wrapper {
height: 100%;
background-color: #F1F1F1;
.content-table-wrap {
height: 100%;
:deep(.show_row) {
cursor: pointer;
transform: scale(1)
}
:deep(.hide_row) {
display: none;
transform: scale(0)
}
.tool_list {
width: 100%;
height: 50px;
display: flex;
justify-content: space-between;
align-items: center;
.search {
width: 100%;
display: flex;
.mps-button {
width: 98px;
height: 32px;
box-shadow: 1px 1px 1px 0px #FFFFFF;
border-radius: 2px;
border: 1px solid #073A35;
line-height: 20px;
.icon-upload {
width: 18px;
height: 18px;
background: url("~@/assets/icon/mps_button_icon.png");
float: left;
margin-left: 5px;
}
}
}
.button_list {
width: 150px;
height: 30px;
display: flex;
align-items: center;
.image_button {
margin: 3px 5px;
width: 24px;
height: 24px;
box-shadow: 2px 2px 0px 0px #DADADA;
}
.disable_button {
margin: 3px 5px;
width: 24px;
height: 24px;
background: #ccc;
border-radius: 1px;
border: 1px solid #ccc;
}
.image_button:hover {
background: #DFDFDF;
box-shadow: 2px 2px 0px 0px #FFFFFF;
}
.button_split {
width: 1px;
height: 30px;
background: #DFDFDF;
box-shadow: 1px 0px 0px 0px #FFFFFF;
border-radius: 1px;
}
}
}
.articleDemand-table {
width: 100%;
border: 0;
.add_icon {
margin-top: 3px;
float: right;
width: 14px;
height: 14px;
background: url("~@/assets/icon/add_icon.png");
}
.subtract_icon {
margin-top: 3px;
float: right;
width: 14px;
height: 14px;
background: url("~@/assets/icon/subtract_icon.png");
}
}
}
}
</style>

+ 2
- 1
src/views/productionPlanning/productInventory/index.vue View File

@ -21,7 +21,7 @@
@click="resetQuery">重置
</el-button>
<el-button icon="el-icon-refresh"
size="mini"
size="mini"
class="reset-button-style"
@click="syncData"
:disabled="syncDataDisable">同步库存</el-button>
@ -78,6 +78,7 @@
"ArticleStock-FGQty",
"ArticleStock-WIPQty",
"ArticleStock-PUCQty",
"ArticleStock-OSCQty",
],
articleList: [],
syncDataDisable: false,


+ 551
- 0
src/views/productionPlanning/versionHistory/index.vue View File

@ -0,0 +1,551 @@
<template>
<ContentContainer class="homepage-customer-wrapper">
<div ref="topTableRef"
class="content-table-wrap">
<div class="tool_list">
<el-form :inline="true"
class="clearfix search-content">
<el-form-item :label="getColumnName('AP_ArticleStockLevel-ArtId')">
<el-select v-model="artId"
style="width: 300px"
placeholder="请选择"
filterable
:loading="artIdLoading"
@visible-change="setArtList">
<el-option v-for="item in artList"
:key="item['Article-ArtId']"
:label="item['Article-ArtId'] + '-' + item['Article-Descr1']"
:value="item['Article-ArtId']" />
</el-select>
</el-form-item>
<el-form-item :label="getColumnName('PlanOrderVersion-Version')">
<el-select v-model="history"
style="width: 300px"
placeholder="请选择"
filterable >
<el-option v-for="item in historyList"
:key="item.publishedVersionNr"
:label="item.publishedVersionNr"
:value="item.publishedVersionNr" />
</el-select>
</el-form-item>
<el-form-item :label="getColumnName('Customer-ValidStartDate')">
<el-date-picker
style="width: 100%"
v-model="datePicker"
type="daterange"
start-placeholder="起始日期"
end-placeholder="截至日期"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item >
<el-button icon="el-icon-search"
size="mini"
class="search-button-style"
@click="handleQuery">搜索
</el-button>
</el-form-item>
</el-form>
</div>
<el-table ref="articleDemand"
v-loading="articleDemandLoading"
:cell-class-name="tableCellClassName"
:data="tableData"
:height="height"
:row-class-name="rowClassName"
border
class="articleDemand-table"
highlight-current-row
size="mini"
@row-dblclick="rowDblclick">
<el-table-column v-for="(item,index) in headers"
:key="index"
:label="showTitle(item,index)"
:prop="item"
show-overflow-tooltip
:width="calcWidth(index)">
<template #default="scope">
<el-input v-if="scope.row['Label'] == editField && scope.row['key'] == editKey && index > keyStartIndex "
v-model="scope.row[item]"
:disabled="item.charAt(item.length - 1) == '*'"
size="mini"></el-input>
<span v-else-if="scope.row[item] == '预测需求' || scope.row[item] == '订单需求' || scope.row[item] == '独立需求'">{{ scope.row[item] }}
<div class="add_icon"></div>
</span>
<span v-else-if="scope.row[item] == '在制量' || scope.row[item] == '期初库存' || scope.row[item] == '采购量' || scope.row[item] == '委外量' ">{{ scope.row[item] }}
<div class="subtract_icon"></div>
</span>
<span v-else>{{ scope.row[item] }}</span>
</template>
</el-table-column>
</el-table>
<Pagination v-model:pagination="pagination"
@change="handleQuery" />
</div>
</ContentContainer>
</template>
<script>
import { publishIdentify } from '@/server/productionPlanning/customerForecastDemandReview'
import {
insertData,
saveData,
getData,
getArtIdList,
publishData,
deleteall,
syncPurchase,
} from "@/server/productionPlanning/emergencyOrder";
import { getColumnName } from "@/utils/allField.js";
export default {
//
name: "demandPlanning",
data() {
return {
datePicker:"",
syncDataDisable:false,
artId: "",
insertArtDoing:false,
artIdLoading:false,
articleDemandLoading: false,
publicButtonClass: "disable_button",
editButtonClass: "disable_button",
height: 0,
queryParams: {},
showPublicDialog: false,
showModeDialog: false,
modeType: "",
editField: "",
editKey: "",
selectKey: "",
promptMessage: "",
editKeyList: [],
artList:[],
pagination: {
pageNumber: 1,
pageSize: 24,
total: 0,
},
headers: [],
tableData: [],
mode: "",
keyStartIndex: 6,
historyList:[],
selectArticleDemandRow:{},
labelList: {
"AP_ArticleDemandEmergency-ForecastDemandQty": "预测需求",
"AP_ArticleDemandEmergency-OrderQty": "订单需求",
"AP_ArticleDemandEmergency-OutSourcingQty": "外购需求",
"AP_ArticleDemandEmergency-IndependentDemandQty": "独立需求",
"AP_ArticleDemandEmergency-WipQty": "在制量",
"AP_ArticleDemandEmergency-OpeningInventory": "期初库存",
"AP_ArticleDemandEmergency-TargetInventory": "目标库存",
"AP_ArticleDemandEmergency-MinInventory": "最低库存",
"AP_ArticleDemandEmergency-NetDemandQty": "净生产量",
"AP_ArticleDemandEmergency-EndingInventory": "期末库存",
"AP_ArticleDemandEmergency-ZaituQty":"采购量",
"AP_ArticleDemandEmergency-WeiwaiQty":"委外量"
}
};
},
created() {
this.publishIdentify()
},
mounted() {
this.getCustomerArticleDemand(this.pagination)
this.$nextTick(() => {
this.height = this.calculationTableHeight(this.$refs.topTableRef, 125)
});
},
computed: {
calcWidth() {
return function (index) {
let width = "100px"
switch (index) {
case 0:
width = "150px"
break;
case 2:
width = "350px"
break;
}
return width
}
},
showTitle() {
return function (item, index) {
if (item == "Label") {
return "标签";
} else {
if (index < 8) {
return getColumnName(item);
} else {
if (item.charAt(item.length - 1) == "*") {
return item.substr(0, item.length - 1);
} else {
return item;
}
}
}
};
}
},
methods: {
handleQuery(){
console.log('%cindex.vue line:193 handleQuery', 'color: #007acc;');
},
publishIdentify() {
this.loading = true
publishIdentify().then(({ data = [] }) => {
// this.formData["version"] = data.version
// this.message = data.message
this.historyList = data.publishedVersionLi
this.loading = false
}).catch(() => {
this.loading = false
});
},
syncPurchase(){
this.syncDataDisable = true
syncPurchase().then(({ code }) => {
if (code == 200) {
this.$message({
type: "success",
message: "同步库存成功"
})
} else {
this.$message({
type: "error",
message: "同步库存失败"
})
}
this.syncDataDisable = false
}).catch(() => {
this.syncDataDisable = false
})
},
initData(){
this.articleDemandLoading = true
deleteall().then(({ code,msg }) => {
if(code == 200) {
this.getCustomerArticleDemand(this.pagination)
}
this.articleDemandLoading = false
}).catch(() => {
this.articleDemandLoading = false
});
},
insertArt(){
this.insertArtDoing = true
insertData({artid:this.artId}).then( ({ code,msg }) => {
this.insertArtDoing = false
if(code == 200) {
this.getCustomerArticleDemand(this.pagination)
this.$message({ type: "success", message: msg });
}
}).catch( () => {
this.insertArtDoing = false
})
},
getCustomerArticleDemand(queryParams) {
this.articleDemandLoading = true
getData(queryParams).then(({ data = [] }) => {
this.dealArticleDemandData(data);
this.articleDemandLoading = false
this.pagination.total = data.count
}).catch(() => {
this.articleDemandLoading = false
});
},
dealArticleDemandData(data) {
if (!data["SortKeys"]) {
this.$message({ type: "error", message: "查询的数据为空" });
return;
}
this.publicButtonClass = "image_button"
data["SortKeys"].splice(this.keyStartIndex, 0, "Label");
data["Item"].forEach((item, index) => {
item.key = item["AP_ArticleDemandEmergency-ArtId"];
item.Label = this.labelList[item["AP_ArticleDemandEmergency-Label"]];
if (index % 12 == 0) {
item.show = true;
} else {
item.show = false;
item["AP_ArticleDemandEmergency-ArtId"] = "";
item["AP_ArticleDemandEmergency-Descr1"] = "";
item["AP_ArticleDemandEmergency-CustomerId"] = "";
item["AP_ArticleDemandEmergency-FGStock"] = "";
item["AP_ArticleDemandEmergency-SFGStock"] = "";
item["AP_ArticleDemandEmergency-WIPStock"] = "";
item["AP_ArticleDemandEmergency-PUCStock"] = "";
item["AP_ArticleDemandEmergency-OSCStock"] = "";
}
});
this.headers = data["SortKeys"];
this.tableData = data["Item"];
this.editButtonClass = "disable_button"
},
getPublishedVersion() {
publishedVersion().then(({ data = "" }) => {
this.promptMessage = data
})
},
handleQuery() {
this.getPublishedVersion()
this.getCustomerArticleDemand(this.pagination)
},
//
setArtList() {
this.artIdLoading = true
getArtIdList().then(({ data = [] }) => {
this.artIdLoading = false
this.artList = data;
}).catch( () => {
this.artIdLoading = false
})
},
publicData() {
if(this.publicButtonClass == "disable_button") {
return false
}
this.publicButtonClass = "disable_button"
this.articleDemandLoading = true
publishData().then( ({ code,msg }) => {
this.articleDemandLoading = false
this.publicButtonClass = "image_button"
if(code == 200) {
this.getCustomerArticleDemand(this.pagination)
this.$message({ type: "success", message: msg });
}
}).catch( () => {
this.articleDemandLoading = false
this.publicButtonClass = "image_button"
})
},
cancelPublicDialog(opt) {
this.showPublicDialog = false
if (opt == "submit") {
this.handleQuery()
}
},
//
openModelDialog(type) {
this.modeType = type;
this.showModeDialog = true;
},
//
cancelAddModel() {
this.mode = "";
this.showModeDialog = false;
},
//
rowClassName({ row }) {
return row.show ? "show_row" : "hide_row";
},
//
editRow(data) {
if (!this.editKeyList.includes(this.selectKey)) this.editKeyList.push(this.selectKey)
this.editKey = this.selectKey;
this.editField = data;
},
getTableDataJson() {
let maplist = JSON.parse(JSON.stringify(this.tableData));
maplist.forEach(item => {
item["AP_ArticleDemandEmergency-ArtId"] = item.key;
delete item.index;
delete item.show;
delete item.key;
delete item.Label;
});
return JSON.stringify(maplist);
},
getEditTableDataJson() {
let editMapList = JSON.parse(JSON.stringify(this.tableData)).filter(item => this.editKeyList.includes(item.key))
editMapList.forEach(item => {
item["AP_ArticleDemandEmergency-ArtId"] = item.key;
delete item.index;
delete item.show;
delete item.key;
delete item.Label;
});
return JSON.stringify(editMapList);
},
//
saveDemandData() {
this.editField = "";
let queryParams = {};
queryParams.artid = this.artId;
queryParams.maplist = this.getEditTableDataJson();
this.articleDemandLoading = true
saveData(queryParams).then(({ data = [] }) => {
this.articleDemandLoading = false
this.handleQuery()
this.editKeyList = []
this.$message({ type: "success", message: "保存成功" });
}).catch(() => {
this.articleDemandLoading = false
});
},
//
arraySpanMethod({ rowIndex, columnIndex }) {
if (rowIndex % 11 > 0 && columnIndex < 8) {
if (rowIndex % 11 == 1 && columnIndex == 0) {
return [9, 8];
} else {
return [0, 0];
}
}
},
//
setRowStatus(key) {
this.artId = key
if (this.selectKey == "") {
this.selectKey = key
this.editButtonClass = "image_button"
} else {
if (this.selectKey != key) {
this.selectKey = key
this.editButtonClass = "image_button"
} else {
this.selectKey = ""
this.editButtonClass = "disable_button"
}
}
},
tableCellClassName({ row, column, rowIndex, columnIndex }) {
row.index = rowIndex;
column.index = columnIndex;
},
//
rowDblclick(row) {
if (row.Label == "净生产量") {
this.selectArticleDemandRow = row
this.$refs.articleDemand.setCurrentRow(row);
this.artId = row.artid
this.setRowStatus(row.key);
this.tableData.forEach(item => {
if (item.key == row.key) {
if (item.Label != "净生产量") {
item.show = !item.show;
}
} else {
if (item.Label != "净生产量") {
item.show = false;
}
}
});
}
}
},
}
</script>
<style lang="less" scoped>
:deep(.el-range-separator) {
height: auto;
}
.homepage-customer-wrapper {
height: 100%;
background-color: #F1F1F1;
.content-table-wrap {
height: 100%;
:deep(.show_row) {
cursor: pointer;
transform: scale(1)
}
:deep(.hide_row) {
display: none;
transform: scale(0)
}
.tool_list {
width: 100%;
height: 50px;
display: flex;
justify-content: space-between;
align-items: center;
.search {
width: 100%;
display: flex;
.mps-button {
width: 98px;
height: 32px;
box-shadow: 1px 1px 1px 0px #FFFFFF;
border-radius: 2px;
border: 1px solid #073A35;
line-height: 20px;
.icon-upload {
width: 18px;
height: 18px;
background: url("~@/assets/icon/mps_button_icon.png");
float: left;
margin-left: 5px;
}
}
}
.button_list {
width: 150px;
height: 30px;
display: flex;
align-items: center;
.image_button {
margin: 3px 5px;
width: 24px;
height: 24px;
box-shadow: 2px 2px 0px 0px #DADADA;
}
.disable_button {
margin: 3px 5px;
width: 24px;
height: 24px;
background: #ccc;
border-radius: 1px;
border: 1px solid #ccc;
}
.image_button:hover {
background: #DFDFDF;
box-shadow: 2px 2px 0px 0px #FFFFFF;
}
.button_split {
width: 1px;
height: 30px;
background: #DFDFDF;
box-shadow: 1px 0px 0px 0px #FFFFFF;
border-radius: 1px;
}
}
}
.articleDemand-table {
width: 100%;
border: 0;
.add_icon {
margin-top: 3px;
float: right;
width: 14px;
height: 14px;
background: url("~@/assets/icon/add_icon.png");
}
.subtract_icon {
margin-top: 3px;
float: right;
width: 14px;
height: 14px;
background: url("~@/assets/icon/subtract_icon.png");
}
}
}
}
</style>

Loading…
Cancel
Save