Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-10321

Multi-level BOM (same raw MM in different level) MRP not supportive

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Release Branch 16.11, 16.11.04
    • Fix Version/s: 16.11.05
    • Component/s: manufacturing
    • Labels:
    • Environment:

      OS: Windows Server 2008 R2

      Database: MySQL 5.7

      JDK: 1.8.0_131

    • Flags:
      Important

      Description

      For MRP funciton in Manufacturing Manager, I intentionally created a BOM as follows:

      Level 0:   Table (Qty 1, finished goods)

      Level 1:   Wood (Qty 5, raw material)

      Level 1:   Nails (Qty 20, raw material)

      Level 1:   Varnish (Qty 1, raw material)

      Level 1:   TableBoardCover (Qty 1, finished goods)

      Level 2:   Wood (Qty 1, raw material)

      I've done all routing tasks associated with routings and linked with products.

      Everything is ok but when I run MRP, I get the following error messages:

       

      Code below:

       
      
      Caused by: org.apache.ofbiz.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO MRP_EVENT (MRP_ID, PRODUCT_ID, EVENT_DATE, MRP_EVENT_TYPE_ID, FACILITY_ID, QUANTI
      
      TY, EVENT_NAME, IS_LATE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '10008-{color:#f79232}10010{color}-2018-03-29 16:03:39-MRP_R
      
      EQUIREMENT' for key 'PRIMARY')
      
              at org.apache.ofbiz.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:434) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.datasource.GenericDAO.singleInsert(GenericDAO.java:173) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.datasource.GenericDAO.insert(GenericDAO.java:115) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.datasource.GenericHelperDAO.create(GenericHelperDAO.java:65) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.GenericDelegator.create(GenericDelegator.java:883) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.GenericValue.create(GenericValue.java:73) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.manufacturing.mrp.InventoryEventPlannedServices.createOrUpdateMrpEvent(InventoryEventPlannedServices.java:77) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.manufacturing.mrp.MrpServices.processBomComponent(MrpServices.java:568) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.manufacturing.mrp.MrpServices.executeMrp(MrpServices.java:799) ~[ofbiz.jar:?]
      
              ... 14 more
      
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10008-{color:#f79232}10010{color}-2018-03-29 16:03:39-MRP_REQUIREMENT' for key 'PRIMARY'
      
              at sun.reflect.GeneratedConstructorAccessor179.newInstance(Unknown Source) ~[?:?]
      
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_131]
      
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_131]
      
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2487) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998) ~[mysql-connector-java-5.1.44-bin.jar:5.1.44]
      
              at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98) ~[commons-dbcp2-2.1.jar:2.1]
      
              at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98) ~[commons-dbcp2-2.1.jar:2.1]
      
              at org.apache.ofbiz.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:430) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.datasource.GenericDAO.singleInsert(GenericDAO.java:173) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.datasource.GenericDAO.insert(GenericDAO.java:115) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.datasource.GenericHelperDAO.create(GenericHelperDAO.java:65) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.GenericDelegator.create(GenericDelegator.java:883) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.entity.GenericValue.create(GenericValue.java:73) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.manufacturing.mrp.InventoryEventPlannedServices.createOrUpdateMrpEvent(InventoryEventPlannedServices.java:77) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.manufacturing.mrp.MrpServices.processBomComponent(MrpServices.java:568) ~[ofbiz.jar:?]
      
              at org.apache.ofbiz.manufacturing.mrp.MrpServices.executeMrp(MrpServices.java:799) ~[ofbiz.jar:?]
      
      

       

       

      As you can see above, 10008 is MRP_ID while 10010 is the PRODUCT_ID for Wood!

      It looks like the MRP calculation logic needs to be udpated!

      This is because I made another test by changing the BOM above to the following:

      Level 0:   Table (Qty 1, finished goods)

      Level 1:   Wood (Qty 5, raw material)

      Level 1:   Nails (Qty 20, raw material)

      Level 1:   Varnish (Qty 1, raw material)

       

      And run MRP again, everything is back to Normal.

      I will try look into it but my skill is quite poor and hope you master can solve it quickly!

       

       

        Attachments

        1. OFBIZ-10321.patch
          1 kB
          Jacopo Cappellato

          Activity

            People

            • Assignee:
              jacopoc Jacopo Cappellato
              Reporter:
              Schumann Schumann Ye
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 168h
                168h
                Remaining:
                Remaining Estimate - 168h
                168h
                Logged:
                Time Spent - Not Specified
                Not Specified