示例#1
0
 def _process_soh(self):
     stock_report = create_stock_report(Reports.SOH,  
                                        self.hsa.supply_point,
                                        self.report_data, 
                                        self.msg.logger_msg)
     requests = StockRequest.create_from_report(stock_report, self.hsa)
     if stock_report.errors:
         # TODO: respond better.
         self.respond(config.Messages.GENERIC_ERROR)
     else:
         if self.msg.logistics_contact.role == ContactRole.objects.get(code=config.Roles.IN_CHARGE):
             self.respond(config.Messages.REPORT_SOH_RESPONSE,
                          hsa=self.hsa.name,
                          products=", ".join(req.sms_format() for req in requests),
                          hsa_id=self.hsa.supply_point.code)
         else:
             assert(self.msg.logistics_contact.role == ContactRole.objects.get(code=config.Roles.HSA))
             send_soh_responses(self.msg, self.hsa, stock_report, requests)
示例#2
0
 def _process_soh(self):
     stock_report = create_stock_report(Reports.SOH, self.hsa.supply_point,
                                        self.report_data,
                                        self.msg.logger_msg)
     requests = StockRequest.create_from_report(stock_report, self.hsa)
     if stock_report.errors:
         # TODO: respond better.
         self.respond(config.Messages.GENERIC_ERROR)
     else:
         if self.msg.logistics_contact.role == ContactRole.objects.get(
                 code=config.Roles.IN_CHARGE):
             self.respond(config.Messages.REPORT_SOH_RESPONSE,
                          hsa=self.hsa.name,
                          products=", ".join(req.sms_format()
                                             for req in requests),
                          hsa_id=self.hsa.supply_point.code)
         else:
             assert (
                 self.msg.logistics_contact.role == ContactRole.objects.get(
                     code=config.Roles.HSA))
             send_soh_responses(self.msg, self.hsa, stock_report, requests)
示例#3
0
 def send_responses(self, stock_report):
     send_soh_responses(self.msg, self.msg.logistics_contact, stock_report,
                        self.requests)
示例#4
0
 def send_responses(self, stock_report):
     send_soh_responses(self.msg, self.msg.logistics_contact, stock_report, self.requests)