def exeSim(): # launch import...quando si trasforma jsonReader importInput() # find initial operation opDone = [] seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) print 'opready', opReady, G.seqPrjDone while len(opReady): # set current operation currentOp = opReady[0] print 'chosen operation', currentOp['id'] # check op mode if currentOp['mode'] == 'MA' or currentOp['mode'] == 'MM': MAM_allocation(currentOp) else: manual_allocation(currentOp) # elif currentOp['mode'] == 'MM': # print 'MM' # MM_allocation(currentOp) # save results opDone.append(currentOp['id']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 print 'op', currentOp if currentOp['preID'] != None: opDone.append(currentOp['preID']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 # aggiorna seqPrjDone seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) print opDone print 'completion date', G.completionDate G.reportResults.add_sheet(G.tabSchedule) with open('schedule.xlsx', 'wb') as f: #time level schedule info f.write(G.reportResults.xlsx)
def exeSim(jsonInput, workplanInput, algorithmAttributes): mime_type, attachement_data = jsonInput[len('data:'):].split(';base64,', 1) attachement_data = attachement_data.decode('base64') jInput = attachement_data mime_type, attachement_data = workplanInput[len('data:'):].split(';base64,', 1) attachement_data = attachement_data.decode('base64') excelInput = attachement_data # read input data G.simMode = 'Earliest' importInput(jInput, excelInput, algorithmAttributes) #========================== # Earliest Completion Date #========================== initGlobals() # find initial operation opDone = [] seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) while len(opReady): # set current operation currentOp = opReady[0] # check op mode and allocate operation if currentOp['mode'] == 'MA' or currentOp['mode'] == 'MM': MAM_allocation(currentOp) else: manual_allocation(currentOp) # save results and update sequence number opDone.append(currentOp['id']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 if currentOp['preID'] != None: opDone.append(currentOp['preID']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 # find next operation seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) # add result sheets G.reportResults.add_sheet(G.tabSchedule[G.simMode]) G.reportResults.add_sheet(G.pmSchedule[G.simMode]) #========================== # Latest Completion Date #========================== G.simMode = 'Latest' initGlobals() # find initial operation opDone = [] seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) while len(opReady): # set current operation currentOp = opReady[0] # allocate operation MAM_allocation(currentOp) # save results opDone.append(currentOp['id']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 if currentOp['preID'] != None: opDone.append(currentOp['preID']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 # find following operation seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) # report results G.reportResults.add_sheet(G.tabSchedule[G.simMode]) G.reportResults.add_sheet(G.pmSchedule[G.simMode])
def exeSim(jsonInput, workplanInput, algorithmAttributes): mime_type, attachement_data = jsonInput[len('data:'):].split(';base64,', 1) attachement_data = attachement_data.decode('base64') jInput = attachement_data mime_type, attachement_data = workplanInput[len('data:'):].split( ';base64,', 1) attachement_data = attachement_data.decode('base64') excelInput = attachement_data # read input data G.simMode = 'Earliest' importInput(jInput, excelInput, algorithmAttributes) #========================== # Earliest Completion Date #========================== initGlobals() # find initial operation opDone = [] seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) while len(opReady): # set current operation currentOp = opReady[0] # check op mode and allocate operation if currentOp['mode'] == 'MA' or currentOp['mode'] == 'MM': MAM_allocation(currentOp) else: manual_allocation(currentOp) # save results and update sequence number opDone.append(currentOp['id']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 if currentOp['preID'] != None: opDone.append(currentOp['preID']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 # find next operation seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) # add result sheets G.reportResults.add_sheet(G.tabSchedule[G.simMode]) G.reportResults.add_sheet(G.pmSchedule[G.simMode]) #========================== # Latest Completion Date #========================== G.simMode = 'Latest' initGlobals() # find initial operation opDone = [] seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) while len(opReady): # set current operation currentOp = opReady[0] # allocate operation MAM_allocation(currentOp) # save results opDone.append(currentOp['id']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 if currentOp['preID'] != None: opDone.append(currentOp['preID']) G.seqPrjDone[currentOp['project']][currentOp['part']] += 1 # find following operation seq = deepcopy(G.seqPrjDone) proj = deepcopy(G.Projects) opReady = findSequence(proj, seq, opDone) # report results G.reportResults.add_sheet(G.tabSchedule[G.simMode]) G.reportResults.add_sheet(G.pmSchedule[G.simMode])