...
|
...
|
@@ -333,7 +333,19 @@ func (srv ProductTroubleService) BatchAddProductTrouble(operateInfo *domain.Oper |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "查询操作人数据失败。"+err.Error())
|
|
|
}
|
|
|
//车间数据
|
|
|
workshopRepo, _ := factory.CreateWorkshopRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
//获取车间列表
|
|
|
_, workshopList, err := workshopRepo.Find(map[string]interface{}{
|
|
|
"companyId": operateInfo.CompanyId,
|
|
|
"orgId": operateInfo.OrgId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "获取车间列表失败"+err.Error())
|
|
|
}
|
|
|
//生产班组 数据
|
|
|
productGroupRepo, _ := factory.CreateProductGroupRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -345,18 +357,13 @@ func (srv ProductTroubleService) BatchAddProductTrouble(operateInfo *domain.Oper |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
//车间名称+/+线别名称+/+工段名称 作为键名
|
|
|
workStationMap := map[string]*domain.WorkStation{}
|
|
|
|
|
|
//车间名称+/+工人名 作为键名
|
|
|
workerMap := map[string][]*domain.User{}
|
|
|
//班组名称 作为键名
|
|
|
productGroupMap := map[string]*domain.ProductGroup{}
|
|
|
// productGroupMap := map[string]*domain.ProductGroup{}
|
|
|
for _, v := range productGroupList {
|
|
|
workStationName := strings.Join([]string{
|
|
|
v.WorkStation.WorkshopName, v.WorkStation.LineName, v.WorkStation.SectionName,
|
|
|
}, "/")
|
|
|
workStationMap[workStationName] = v.WorkStation
|
|
|
productGroupMap[v.GroupName] = v
|
|
|
// productGroupMap[v.GroupName] = v
|
|
|
for _, vv := range v.GroupMembers {
|
|
|
k := v.WorkStation.WorkshopName + "/" + vv.UserName
|
|
|
isIn := false
|
...
|
...
|
@@ -371,6 +378,18 @@ func (srv ProductTroubleService) BatchAddProductTrouble(operateInfo *domain.Oper |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//车间名称+/+线别名称+/+工段名称 作为键名
|
|
|
workStationMap := map[string]*domain.WorkStation{}
|
|
|
for _, v := range workshopList {
|
|
|
for _, v2 := range v.ProductLines {
|
|
|
for _, v3 := range v2.ProductSections {
|
|
|
workStationName := strings.Join([]string{
|
|
|
v.WorkshopName, v2.LineName, v3.SectionName,
|
|
|
}, "/")
|
|
|
workStationMap[workStationName] = domain.NewWorkStation(v, v2, v3)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
troubleDataList := make([]*domain.ProductTrouble, 0, len(param))
|
|
|
nowTime := time.Now()
|
...
|
...
|
|