java实现mrp_java mrp算法实现

【实例简介】

这是用Java是现代的mrp系统的算法,通过各种物料,计算出各种物料的需求,是ERP课程实验一。控制台界面,用mysql数据库。

【实例截图】

【核心代码】

ERP大作业1

└── NEWMRP

├── billofmaterial.sql

├── bin

│   └── com

│   └── mrp

│   ├── algorithm

│   │   ├── Algorithm.class

│   │   └── MasterMaterialManager.class

│   └── entity

│   ├── BillOfMaterial.class

│   ├── ClassAB.class

│   ├── Dosql.class

│   ├── MasterMaterial.class

│   ├── Mclass.class

│   ├── RealMaterial.class

│   ├── TPOPNode.class

│   └── Table3.class

├── itemmaster.sql

├── mysql-connector-java-5.1.7-bin.jar

├── src

│   └── com

│   └── mrp

│   ├── algorithm

│   │   ├── Algorithm.java

│   │   └── MasterMaterialManager.java

│   └── entity

│   ├── BillOfMa

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的Java实现MRP算法的示例代码: ```java import java.util.*; public class MRPAlgorithm { public static void main(String[] args) { // 定义需求量矩阵(Demand Matrix) int[][] demandMatrix = {{100, 150, 200}, {50, 75, 100}, {150, 200, 250}}; // 定义库存矩阵(Inventory Matrix) int[][] inventoryMatrix = {{50, 25, 0}, {25, 10, 5}, {15, 10, 5}}; // 定义产出矩阵(Output Matrix) int[][] outputMatrix = {{80, 100, 120}, {60, 80, 100}, {100, 120, 140}}; // 定义MRP对象 MRP mrp = new MRP(demandMatrix, inventoryMatrix, outputMatrix); // 运行MRP算法 mrp.runMRP(); // 输出计划表 System.out.println("Material Requirements Planning (MRP) Report:"); System.out.println("Item\tPeriod 1\t\tPeriod 2\t\tPeriod 3"); for (int i = 0; i < mrp.getNumberOfItems(); i++) { System.out.print((char) ('A' + i) + "\t"); for (int j = 0; j < 3; j++) { System.out.print(mrp.getPlannedProduction(i, j) + "\t\t"); } System.out.println(); } } } class MRP { private int[][] demandMatrix; // 需求量矩阵 private int[][] inventoryMatrix; // 库存矩阵 private int[][] outputMatrix; // 产出矩阵 private int numberOfItems; // 物料数量 private int numberOfPeriods; // 周期数量 private int[][] plannedProduction; // 计划生产量矩阵 public MRP(int[][] demandMatrix, int[][] inventoryMatrix, int[][] outputMatrix) { this.demandMatrix = demandMatrix; this.inventoryMatrix = inventoryMatrix; this.outputMatrix = outputMatrix; numberOfItems = demandMatrix.length; numberOfPeriods = demandMatrix[0].length; plannedProduction = new int[numberOfItems][numberOfPeriods]; } public void runMRP() { for (int i = 0; i < numberOfItems; i++) { for (int j = 0; j < numberOfPeriods; j++) { // 计算净需求量 int netDemand = demandMatrix[i][j] - inventoryMatrix[i][j]; // 如果净需求量小于等于0,则无需生产 if (netDemand <= 0) { plannedProduction[i][j] = 0; } else { // 计算所需毛需求量 int grossDemand = netDemand; // 计算所需总产出量 int totalOutput = 0; for (int k = j; k < numberOfPeriods; k++) { totalOutput += outputMatrix[i][k]; } // 如果所需总产出量小于所需毛需求量,则需要增加生产计划 if (totalOutput < grossDemand) { plannedProduction[i][j] = grossDemand - totalOutput; } } } } } public int getNumberOfItems() { return numberOfItems; } public int getPlannedProduction(int itemIndex, int period) { return plannedProduction[itemIndex][period]; } } ``` 该示例代码中定义了一个MRP类,其中包含了需求量矩阵、库存矩阵和产出矩阵等属性,以及计划生产量矩阵和运行MRP算法的方法。在main方法中,我们定义了一个需求量矩阵、库存矩阵和产出矩阵,然后创建MRP对象并运行MRP算法。最后,我们输出了计划表。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值