|
@@ -7,6 +7,7 @@ import ( |
|
@@ -7,6 +7,7 @@ import ( |
|
7
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
7
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
|
8
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
|
8
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
|
|
9
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productMaterial/command"
|
9
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productMaterial/command"
|
|
|
|
10
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productMaterial/dto"
|
|
10
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productMaterial/query"
|
11
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productMaterial/query"
|
|
11
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
|
12
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
|
|
12
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
|
13
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
|
|
@@ -49,7 +50,7 @@ func (productMaterialService *ProductMaterialService) CreateProductMaterial(oper |
|
@@ -49,7 +50,7 @@ func (productMaterialService *ProductMaterialService) CreateProductMaterial(oper |
|
49
|
}
|
50
|
}
|
|
50
|
//var productMaterial *domain.ProductMaterial
|
51
|
//var productMaterial *domain.ProductMaterial
|
|
51
|
materialService, _ := domainService.NewPGMaterialService(transactionContext.(*pgTransaction.TransactionContext))
|
52
|
materialService, _ := domainService.NewPGMaterialService(transactionContext.(*pgTransaction.TransactionContext))
|
|
52
|
- if _, err = materialService.AddMaterial(operateInfo, newProductMaterial); err != nil {
|
53
|
+ if _, err := materialService.AddMaterial(operateInfo, newProductMaterial); err != nil {
|
|
53
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
54
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
54
|
}
|
55
|
}
|
|
55
|
if err := transactionContext.CommitTransaction(); err != nil {
|
56
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
@@ -58,8 +59,8 @@ func (productMaterialService *ProductMaterialService) CreateProductMaterial(oper |
|
@@ -58,8 +59,8 @@ func (productMaterialService *ProductMaterialService) CreateProductMaterial(oper |
|
58
|
return struct{}{}, nil
|
59
|
return struct{}{}, nil
|
|
59
|
}
|
60
|
}
|
|
60
|
|
61
|
|
|
61
|
-// 返回生产物料服务
|
|
|
|
62
|
-func (productMaterialService *ProductMaterialService) GetProductMaterial(getProductMaterialQuery *query.GetProductMaterialQuery) (interface{}, error) {
|
62
|
+// 返回生产物料服务单个
|
|
|
|
63
|
+func (productMaterialService *ProductMaterialService) GetProductMaterial(operateInfo *domain.OperateInfo, getProductMaterialQuery *query.GetProductMaterialQuery) (interface{}, error) {
|
|
63
|
if err := getProductMaterialQuery.ValidateQuery(); err != nil {
|
64
|
if err := getProductMaterialQuery.ValidateQuery(); err != nil {
|
|
64
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
65
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
65
|
}
|
66
|
}
|
|
@@ -88,15 +89,25 @@ func (productMaterialService *ProductMaterialService) GetProductMaterial(getProd |
|
@@ -88,15 +89,25 @@ func (productMaterialService *ProductMaterialService) GetProductMaterial(getProd |
|
88
|
if productMaterial == nil {
|
89
|
if productMaterial == nil {
|
|
89
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(getProductMaterialQuery.ProductMaterialId)))
|
90
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(getProductMaterialQuery.ProductMaterialId)))
|
|
90
|
} else {
|
91
|
} else {
|
|
|
|
92
|
+ materialService, _ := domainService.NewPGMaterialService(transactionContext.(*pgTransaction.TransactionContext))
|
|
|
|
93
|
+ ProductMaterialGroupIdName, _, err := materialService.AllMaterialGroupParent(operateInfo, productMaterial.ProductMaterialGroupId)
|
|
|
|
94
|
+ if err != nil {
|
|
|
|
95
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
96
|
+ }
|
|
|
|
97
|
+ if len(ProductMaterialGroupIdName) == 0 {
|
|
|
|
98
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
99
|
+ }
|
|
|
|
100
|
+ one := dto.DtoProductMaterial(productMaterial)
|
|
|
|
101
|
+ one.ProductMaterialGroupIdName = ProductMaterialGroupIdName
|
|
91
|
if err := transactionContext.CommitTransaction(); err != nil {
|
102
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
92
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
103
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
93
|
}
|
104
|
}
|
|
94
|
- return productMaterial, nil
|
105
|
+ return one, nil
|
|
95
|
}
|
106
|
}
|
|
96
|
}
|
107
|
}
|
|
97
|
|
108
|
|
|
98
|
-// 返回生产物料服务列表
|
|
|
|
99
|
-func (productMaterialService *ProductMaterialService) ListProductMaterial(listProductMaterialQuery *query.ListProductMaterialQuery) (interface{}, error) {
|
109
|
+// 返回生产物料服务列表,未用
|
|
|
|
110
|
+func (productMaterialService *ProductMaterialService) ListProductMaterial(operateInfo *domain.OperateInfo, listProductMaterialQuery *query.ListProductMaterialQuery) (interface{}, error) {
|
|
100
|
if err := listProductMaterialQuery.ValidateQuery(); err != nil {
|
111
|
if err := listProductMaterialQuery.ValidateQuery(); err != nil {
|
|
101
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
112
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
102
|
}
|
113
|
}
|
|
@@ -118,21 +129,80 @@ func (productMaterialService *ProductMaterialService) ListProductMaterial(listPr |
|
@@ -118,21 +129,80 @@ func (productMaterialService *ProductMaterialService) ListProductMaterial(listPr |
|
118
|
} else {
|
129
|
} else {
|
|
119
|
productMaterialRepository = value
|
130
|
productMaterialRepository = value
|
|
120
|
}
|
131
|
}
|
|
|
|
132
|
+ var results []*dto.DtoMaterial
|
|
|
|
133
|
+ if listProductMaterialQuery.ProductMaterialGroupId != 0 {
|
|
|
|
134
|
+ materialService, _ := domainService.NewPGMaterialService(transactionContext.(*pgTransaction.TransactionContext))
|
|
|
|
135
|
+ _, ProductMaterialGroupIds, err := materialService.AllMaterialGroupChild(operateInfo, listProductMaterialQuery.ProductMaterialGroupId)
|
|
|
|
136
|
+ if err != nil {
|
|
|
|
137
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
138
|
+ }
|
|
|
|
139
|
+ listProductMaterialQuery.ProductMaterialGroupIds = ProductMaterialGroupIds
|
|
|
|
140
|
+ }
|
|
|
|
141
|
+ listProductMaterialQuery.CompanyId = operateInfo.CompanyId
|
|
121
|
if count, productMaterials, err := productMaterialRepository.Find(tool_funs.SimpleStructToMap(listProductMaterialQuery)); err != nil {
|
142
|
if count, productMaterials, err := productMaterialRepository.Find(tool_funs.SimpleStructToMap(listProductMaterialQuery)); err != nil {
|
|
122
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
143
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
123
|
} else {
|
144
|
} else {
|
|
|
|
145
|
+ for _, productMaterial := range productMaterials {
|
|
|
|
146
|
+ results = append(results, dto.DtoProductMaterial(productMaterial))
|
|
|
|
147
|
+ }
|
|
124
|
if err := transactionContext.CommitTransaction(); err != nil {
|
148
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
125
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
149
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
126
|
}
|
150
|
}
|
|
127
|
return map[string]interface{}{
|
151
|
return map[string]interface{}{
|
|
128
|
"count": count,
|
152
|
"count": count,
|
|
129
|
- "productMaterials": productMaterials,
|
153
|
+ "productMaterials": results,
|
|
130
|
}, nil
|
154
|
}, nil
|
|
131
|
}
|
155
|
}
|
|
132
|
}
|
156
|
}
|
|
133
|
|
157
|
|
|
|
|
158
|
+// 返回生产物料服务列表
|
|
|
|
159
|
+func (productMaterialService *ProductMaterialService) SearchProductMaterial(operateInfo *domain.OperateInfo, listProductMaterialQuery *query.ListProductMaterialQuery) (int64, []*dto.DtoMaterial, error) {
|
|
|
|
160
|
+ if err := listProductMaterialQuery.ValidateQuery(); err != nil {
|
|
|
|
161
|
+ return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
|
162
|
+ }
|
|
|
|
163
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
|
164
|
+ if err != nil {
|
|
|
|
165
|
+ return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
166
|
+ }
|
|
|
|
167
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
|
168
|
+ return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
169
|
+ }
|
|
|
|
170
|
+ defer func() {
|
|
|
|
171
|
+ transactionContext.RollbackTransaction()
|
|
|
|
172
|
+ }()
|
|
|
|
173
|
+ var productMaterialRepository domain.ProductMaterialRepository
|
|
|
|
174
|
+ if value, err := factory.CreateProductMaterialRepository(map[string]interface{}{
|
|
|
|
175
|
+ "transactionContext": transactionContext,
|
|
|
|
176
|
+ }); err != nil {
|
|
|
|
177
|
+ return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
178
|
+ } else {
|
|
|
|
179
|
+ productMaterialRepository = value
|
|
|
|
180
|
+ }
|
|
|
|
181
|
+ var results []*dto.DtoMaterial
|
|
|
|
182
|
+ if listProductMaterialQuery.ProductMaterialGroupId != 0 {
|
|
|
|
183
|
+ materialService, _ := domainService.NewPGMaterialService(transactionContext.(*pgTransaction.TransactionContext))
|
|
|
|
184
|
+ _, ProductMaterialGroupIds, err := materialService.AllMaterialGroupChild(operateInfo, listProductMaterialQuery.ProductMaterialGroupId)
|
|
|
|
185
|
+ if err != nil {
|
|
|
|
186
|
+ return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
187
|
+ }
|
|
|
|
188
|
+ listProductMaterialQuery.ProductMaterialGroupIds = ProductMaterialGroupIds
|
|
|
|
189
|
+ }
|
|
|
|
190
|
+ listProductMaterialQuery.CompanyId = operateInfo.CompanyId
|
|
|
|
191
|
+ count, productMaterials, err := productMaterialRepository.Find(tool_funs.SimpleStructToMap(listProductMaterialQuery))
|
|
|
|
192
|
+ if err != nil {
|
|
|
|
193
|
+ return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
194
|
+ }
|
|
|
|
195
|
+ for _, productMaterial := range productMaterials {
|
|
|
|
196
|
+ results = append(results, dto.DtoProductMaterial(productMaterial))
|
|
|
|
197
|
+ }
|
|
|
|
198
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
|
199
|
+ return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
200
|
+ }
|
|
|
|
201
|
+ return count, results, err
|
|
|
|
202
|
+}
|
|
|
|
203
|
+
|
|
134
|
// 移除生产物料服务
|
204
|
// 移除生产物料服务
|
|
135
|
-func (productMaterialService *ProductMaterialService) RemoveProductMaterial(removeProductMaterialCommand *command.RemoveProductMaterialCommand) (interface{}, error) {
|
205
|
+func (productMaterialService *ProductMaterialService) RemoveProductMaterial(operateInfo *domain.OperateInfo, removeProductMaterialCommand *command.RemoveProductMaterialCommand) (interface{}, error) {
|
|
136
|
if err := removeProductMaterialCommand.ValidateCommand(); err != nil {
|
206
|
if err := removeProductMaterialCommand.ValidateCommand(); err != nil {
|
|
137
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
207
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
138
|
}
|
208
|
}
|
|
@@ -154,7 +224,7 @@ func (productMaterialService *ProductMaterialService) RemoveProductMaterial(remo |
|
@@ -154,7 +224,7 @@ func (productMaterialService *ProductMaterialService) RemoveProductMaterial(remo |
|
154
|
} else {
|
224
|
} else {
|
|
155
|
productMaterialRepository = value
|
225
|
productMaterialRepository = value
|
|
156
|
}
|
226
|
}
|
|
157
|
- productMaterial, err := productMaterialRepository.FindOne(map[string]interface{}{"productMaterialId": removeProductMaterialCommand.ProductMaterialId})
|
227
|
+ productMaterial, err := productMaterialRepository.FindOne(map[string]interface{}{"companyId": operateInfo.CompanyId, "productMaterialId": removeProductMaterialCommand.ProductMaterialId})
|
|
158
|
if err != nil {
|
228
|
if err != nil {
|
|
159
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
229
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
160
|
}
|
230
|
}
|
|
@@ -172,8 +242,8 @@ func (productMaterialService *ProductMaterialService) RemoveProductMaterial(remo |
|
@@ -172,8 +242,8 @@ func (productMaterialService *ProductMaterialService) RemoveProductMaterial(remo |
|
172
|
}
|
242
|
}
|
|
173
|
|
243
|
|
|
174
|
// 更新生产物料服务
|
244
|
// 更新生产物料服务
|
|
175
|
-func (productMaterialService *ProductMaterialService) UpdateProductMaterial(updateProductMaterialCommand *command.UpdateProductMaterialCommand) (interface{}, error) {
|
|
|
|
176
|
- if err := updateProductMaterialCommand.ValidateCommand(); err != nil {
|
245
|
+func (productMaterialService *ProductMaterialService) UpdateProductMaterial(operateInfo *domain.OperateInfo, cmd *command.UpdateProductMaterialCommand) (interface{}, error) {
|
|
|
|
246
|
+ if err := cmd.ValidateCommand(); err != nil {
|
|
177
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
247
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
178
|
}
|
248
|
}
|
|
179
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
249
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
@@ -194,24 +264,80 @@ func (productMaterialService *ProductMaterialService) UpdateProductMaterial(upda |
|
@@ -194,24 +264,80 @@ func (productMaterialService *ProductMaterialService) UpdateProductMaterial(upda |
|
194
|
} else {
|
264
|
} else {
|
|
195
|
productMaterialRepository = value
|
265
|
productMaterialRepository = value
|
|
196
|
}
|
266
|
}
|
|
197
|
- productMaterial, err := productMaterialRepository.FindOne(map[string]interface{}{"productMaterialId": updateProductMaterialCommand.ProductMaterialId})
|
267
|
+ productMaterial, err := productMaterialRepository.FindOne(map[string]interface{}{"productMaterialId": cmd.ProductMaterialId})
|
|
198
|
if err != nil {
|
268
|
if err != nil {
|
|
199
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
269
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
200
|
}
|
270
|
}
|
|
201
|
if productMaterial == nil {
|
271
|
if productMaterial == nil {
|
|
202
|
- return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateProductMaterialCommand.ProductMaterialId)))
|
272
|
+ return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(cmd.ProductMaterialId)))
|
|
|
|
273
|
+ }
|
|
|
|
274
|
+ newProductMaterial := &domain.ProductMaterial{ //赋值
|
|
|
|
275
|
+ ProductMaterialId: cmd.ProductMaterialId,
|
|
|
|
276
|
+ ProductMaterialGroupId: cmd.ProductMaterialGroupId,
|
|
|
|
277
|
+ MaterialName: cmd.MaterialName,
|
|
|
|
278
|
+ MaterialNumber: productMaterial.MaterialNumber,
|
|
|
|
279
|
+ MaterialAttribute: &domain.MaterialAttribute{Attribute: cmd.MaterialAttribute},
|
|
|
|
280
|
+ MaterialCategory: &domain.MaterialCategory{Category: cmd.MaterialCategory},
|
|
|
|
281
|
+ ProductMaterialExt: &domain.MaterialExt{
|
|
|
|
282
|
+ Specification: cmd.Specification,
|
|
|
|
283
|
+ Unit: cmd.Unit,
|
|
|
|
284
|
+ ExpiredDay: cmd.ExpiredDay,
|
|
|
|
285
|
+ Remark: cmd.Remark,
|
|
|
|
286
|
+ },
|
|
|
|
287
|
+ CreatedAt: productMaterial.CreatedAt,
|
|
203
|
}
|
288
|
}
|
|
204
|
- if err := productMaterial.Update(tool_funs.SimpleStructToMap(updateProductMaterialCommand)); err != nil {
|
|
|
|
205
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
289
|
+ materialService, _ := domainService.NewPGMaterialService(transactionContext.(*pgTransaction.TransactionContext))
|
|
|
|
290
|
+ data, err := materialService.UpdateMaterial(operateInfo, newProductMaterial)
|
|
|
|
291
|
+ if err != nil {
|
|
|
|
292
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
293
|
+ }
|
|
|
|
294
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
|
295
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
206
|
}
|
296
|
}
|
|
207
|
- if productMaterial, err := productMaterialRepository.Save(productMaterial); err != nil {
|
297
|
+ return data, nil
|
|
|
|
298
|
+}
|
|
|
|
299
|
+
|
|
|
|
300
|
+// 批量移除生产物料服务
|
|
|
|
301
|
+func (productMaterialService *ProductMaterialService) BatchRemoveProductMaterial(operateInfo *domain.OperateInfo, batchRemoveProductMaterialCommand *command.BatchRemoveProductMaterialCommand) (interface{}, error) {
|
|
|
|
302
|
+ if err := batchRemoveProductMaterialCommand.ValidateCommand(); err != nil {
|
|
|
|
303
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
|
304
|
+ }
|
|
|
|
305
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
|
306
|
+ if err != nil {
|
|
|
|
307
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
308
|
+ }
|
|
|
|
309
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
|
310
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
311
|
+ }
|
|
|
|
312
|
+ defer func() {
|
|
|
|
313
|
+ transactionContext.RollbackTransaction()
|
|
|
|
314
|
+ }()
|
|
|
|
315
|
+ var productMaterialRepository domain.ProductMaterialRepository
|
|
|
|
316
|
+ if value, err := factory.CreateProductMaterialRepository(map[string]interface{}{
|
|
|
|
317
|
+ "transactionContext": transactionContext,
|
|
|
|
318
|
+ }); err != nil {
|
|
208
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
319
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
209
|
} else {
|
320
|
} else {
|
|
210
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
|
211
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
321
|
+ productMaterialRepository = value
|
|
|
|
322
|
+ }
|
|
|
|
323
|
+ for i := range batchRemoveProductMaterialCommand.ProductMaterialIds {
|
|
|
|
324
|
+ ProductMaterialId := batchRemoveProductMaterialCommand.ProductMaterialIds[i]
|
|
|
|
325
|
+ productMaterial, err := productMaterialRepository.FindOne(map[string]interface{}{"companyId": operateInfo.CompanyId, "productMaterialId": ProductMaterialId})
|
|
|
|
326
|
+ if err != nil {
|
|
|
|
327
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
328
|
+ }
|
|
|
|
329
|
+ if productMaterial == nil {
|
|
|
|
330
|
+ return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(ProductMaterialId)))
|
|
|
|
331
|
+ }
|
|
|
|
332
|
+ if _, err := productMaterialRepository.Remove(productMaterial); err != nil {
|
|
|
|
333
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
212
|
}
|
334
|
}
|
|
213
|
- return productMaterial, nil
|
|
|
|
214
|
}
|
335
|
}
|
|
|
|
336
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
|
337
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
338
|
+ }
|
|
|
|
339
|
+ return struct{}{}, nil
|
|
|
|
340
|
+
|
|
215
|
}
|
341
|
}
|
|
216
|
|
342
|
|
|
217
|
func NewProductMaterialService(options map[string]interface{}) *ProductMaterialService {
|
343
|
func NewProductMaterialService(options map[string]interface{}) *ProductMaterialService {
|