...
|
...
|
@@ -367,6 +367,48 @@ func (productGroupService *ProductGroupService) SearchProductGroup(operateInfo * |
|
|
return count, results, nil
|
|
|
}
|
|
|
|
|
|
// 返回生产班组服务列表
|
|
|
func (productGroupService *ProductGroupService) SearchProductGroupEmployees(operateInfo *domain.OperateInfo, cmd *query.SearchProductGroupEmployeesQuery) (int64, interface{}, error) {
|
|
|
if err := cmd.ValidateQuery(); err != nil {
|
|
|
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
//workshops, _ := factory.FastPgWorkshops(transactionContext, operateInfo.CompanyId)
|
|
|
queryOptions := utils.ObjectToMap(cmd)
|
|
|
//queryOptions = workshops.FindByNameWithQuery(queryOptions, cmd.WorkshopName, cmd.LineName, "")
|
|
|
|
|
|
var productGroupRepository domain.ProductGroupRepository
|
|
|
productGroupRepository, _, _ = factory.FastPgProductGroup(transactionContext, 0)
|
|
|
_, productGroups, err := productGroupRepository.Find(queryOptions)
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
var results = dto.NewProductGroupEmployeesDtos()
|
|
|
for i := range productGroups {
|
|
|
item := productGroups[i]
|
|
|
//workStation := workshops.FindWorkStation(item.WorkStation.WorkshopId, item.WorkStation.LineId, item.WorkStation.SectionId)
|
|
|
//item.WorkStation = workStation
|
|
|
items := dto.NewProductGroupEmployeesDto(item)
|
|
|
results.Append(items...)
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return int64(len(results.Result)), map[string]interface{}{
|
|
|
"employees": results.Result,
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
func NewProductGroupService(options map[string]interface{}) *ProductGroupService {
|
|
|
newProductGroupService := &ProductGroupService{}
|
|
|
return newProductGroupService
|
...
|
...
|
|