Dear Jacopo, Thanks for your guiding and you're such a genius. I just check the version of the installed mysql by using "select version();" and it shows me 5.7.19. Then I try to google if mysql support milliseconds and I find the following 2 links: https://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
It seems like starting from version 5.6 mysql had supported microseconds (so as milliseconds), which could be proven by using the code "SELECT MICROSECOND('2010-12-10 14:12:09.019473');". However, when MySQL stores a value into a column of any temporal data type, it discards any fractional part and does not store it. Solution to this would be: To define a column that includes a fractional seconds part, use the syntax type_name(fsp), where type_name is TIME, DATETIME, or TIMESTAMP, and fsp is the fractional seconds precision. For example: CREATE TABLE t1 (t TIME(3), dt DATETIME(6)); The fsp value, if given, must be in the range 0 to 6. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. (This differs from the standard SQL default of 6, for compatibility with previous MySQL versions.) So I assume you are right then what table field in mysql ofbiz table I should change to verify your theory. According to the code snippet, it should be the field Event_Date of the table ofbiz.mrp_event as shown in MrpServices.java. So after updating the column by "ALTER TABLE ofbiz.mrp_event change EVENT_DATE EVENT_DATE DATETIME(6); " and a reboot, MRP is running correctly. Everything now works like a charm. BTW, shall I set the JIRA note to closed or someone else would do so? Thanks again. Schumann -----邮件原件----- 发件人: Jacopo Cappellato <jacopo.cappell...@hotwaxsystems.com> 发送时间: 2018年3月29日 22:23 收件人: user@ofbiz.apache.org ML <user@ofbiz.apache.org> 主题: Re: A major bug in OFBiz Manufacturing MRP function Dear Schumann, thanks for your report and analysis. What version of MySQL are you using? I suspect that the error is caused by the fact that your version doesn't support milliseconds in the DATETIME field and this causes the "duplicate record" condition. Kind regards, Jacopo On Thu, Mar 29, 2018 at 11:04 AM, Schumann Ye <schumanny...@hotmail.com> wrote: > Dear Gurus, > > I found a serious bug in MRP calculation function (hope I was wrong) > and I've created a JIRA note OFBIZ-10321. > In a word, OFBiz MRP function seems currently not supportive of > multilevel BOM calculation with same material (raw material in my case > test) located in different BOM level. > > While the tested scenario above is quite normal in various industries, > so my question is, is there any workaround or we have to wait until > next patch or release? > > Thanks > > Best Regards > > Schumann > > >