|
@@ -232,41 +232,41 @@ func updateBilltoStage(c *gin.Context, planId primitive.ObjectID, idStatges map[
|
|
|
}
|
|
|
|
|
|
// 更新供应商确定数量与plan中stage项的同步
|
|
|
-func updateStageCount(c *gin.Context, planId primitive.ObjectID, idCounts map[string]int, apictx *ApiSession) (interface{}, error) {
|
|
|
- if len(idCounts) == 0 {
|
|
|
- return true, nil
|
|
|
- }
|
|
|
-
|
|
|
- plan := model.ProductPlan{}
|
|
|
- found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
|
- CollectName: repo.CollectionProductPlan,
|
|
|
- Query: repo.Map{"_id": planId},
|
|
|
- }, &plan)
|
|
|
- if !found || err != nil {
|
|
|
- return nil, errors.New("数据未找到")
|
|
|
- }
|
|
|
- for _, comp := range plan.Pack.Components {
|
|
|
- if comp.Id == "" || len(comp.Stages) == 0 {
|
|
|
- continue
|
|
|
- }
|
|
|
- for _, stage := range comp.Stages {
|
|
|
- if v, ok := idCounts[stage.Id]; ok {
|
|
|
- stage.ConfirmCount = v
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- plan.UpdateTime = time.Now()
|
|
|
- userId, _ := primitive.ObjectIDFromHex(apictx.User.ID)
|
|
|
- user, _ := getUserById(apictx, userId)
|
|
|
- // return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionProductPlan, planId.Hex(), &plan)
|
|
|
- return repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionProductPlan, planId.Hex(), &plan, &repo.RecordLogReq{
|
|
|
- Path: c.Request.URL.Path,
|
|
|
- UserInfo: user,
|
|
|
- TargetId: planId.Hex(),
|
|
|
- Type: "sync",
|
|
|
- })
|
|
|
-}
|
|
|
+// func updateStageCount(c *gin.Context, planId primitive.ObjectID, idCounts map[string]int, apictx *ApiSession) (interface{}, error) {
|
|
|
+// if len(idCounts) == 0 {
|
|
|
+// return true, nil
|
|
|
+// }
|
|
|
+
|
|
|
+// plan := model.ProductPlan{}
|
|
|
+// found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
|
+// CollectName: repo.CollectionProductPlan,
|
|
|
+// Query: repo.Map{"_id": planId},
|
|
|
+// }, &plan)
|
|
|
+// if !found || err != nil {
|
|
|
+// return nil, errors.New("数据未找到")
|
|
|
+// }
|
|
|
+// for _, comp := range plan.Pack.Components {
|
|
|
+// if comp.Id == "" || len(comp.Stages) == 0 {
|
|
|
+// continue
|
|
|
+// }
|
|
|
+// for _, stage := range comp.Stages {
|
|
|
+// if v, ok := idCounts[stage.Id]; ok {
|
|
|
+// stage.ConfirmCount = v
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// }
|
|
|
+// plan.UpdateTime = time.Now()
|
|
|
+// userId, _ := primitive.ObjectIDFromHex(apictx.User.ID)
|
|
|
+// user, _ := getUserById(apictx, userId)
|
|
|
+// // return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionProductPlan, planId.Hex(), &plan)
|
|
|
+// return repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionProductPlan, planId.Hex(), &plan, &repo.RecordLogReq{
|
|
|
+// Path: c.Request.URL.Path,
|
|
|
+// UserInfo: user,
|
|
|
+// TargetId: planId.Hex(),
|
|
|
+// Type: "sync",
|
|
|
+// })
|
|
|
+// }
|
|
|
|
|
|
type SupplierPlanCost struct {
|
|
|
*model.ProductPlan
|