animeic 2 years ago
parent
commit
d30d4e8a43
5 changed files with 43 additions and 476 deletions
  1. 14 1
      boxcost/api/bill-produce.go
  2. 1 1
      boxcost/api/bill.go
  3. 19 19
      boxcost/api/pack.go
  4. 7 453
      boxcost/api/tmp.json
  5. 2 2
      boxcost/app.yaml

+ 14 - 1
boxcost/api/bill-produce.go

@@ -36,7 +36,7 @@ func BillProduce(r *GinRouter) {
 	r.GET("/bill/produce/download", DownProduceBill)
 
 	// 审核单据
-	r.POST("/bill/produce/review/:id", ProduceReview)
+	r.POSTJWT("/bill/produce/review/:id", ProduceReview)
 }
 
 // 审核单据
@@ -207,6 +207,19 @@ func DownProduceBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	f.SetDefaultFont("宋体")
 
 	billExcel := NewProduceBill(f)
+	// 获取已审核的签名数据
+	if bill.Reviewed == 1 {
+		if len(bill.SignUsers) > 0 {
+			signs := []*model.Signature{}
+			repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
+				CollectName: repo.CollectionSignature,
+				Query:       repo.Map{"userId": bson.M{"$in": bill.SignUsers}},
+				Sort:        bson.M{"sort": 1}, // 升序
+			}, &signs)
+			billExcel.Signatures = signs
+		}
+
+	}
 	billExcel.Content = &bill
 	info := model.Setting{}
 	repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{

+ 1 - 1
boxcost/api/bill.go

@@ -36,7 +36,7 @@ func Bill(r *GinRouter) {
 	r.POST("/bill/purchase/delete/:id", DelBill)
 
 	// 审核单据
-	r.POST("/bill/purchase/review/:id", PurchaseReview)
+	r.POSTJWT("/bill/purchase/review/:id", PurchaseReview)
 }
 
 // 审核单据

+ 19 - 19
boxcost/api/pack.go

@@ -48,28 +48,28 @@ func CreatePack(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		return nil, errors.New("包装名为空")
 	}
 	// 创建时生产 CompCounts,packComponent Id,mat。id craft id
-	pack.CompCounts = len(pack.Components)
+	// pack.CompCounts = len(pack.Components)
 
 	// 生成id
 	// components id
-	if pack.CompCounts > 0 {
-		for _, v := range pack.Components {
-			v.Id = primitive.NewObjectID().Hex()
-			// mats id
-			if len(v.Mats) > 0 {
-				for _, v := range v.Mats {
-					v.Id = primitive.NewObjectID().Hex()
-					// crafts id
-					if len(v.Crafts) > 0 {
-						for _, v := range v.Crafts {
-							v.Id = primitive.NewObjectID().Hex()
-
-						}
-					}
-				}
-			}
-		}
-	}
+	// if pack.CompCounts > 0 {
+	// 	for _, v := range pack.Components {
+	// 		v.Id = primitive.NewObjectID().Hex()
+	// 		// mats id
+	// 		if len(v.Mats) > 0 {
+	// 			for _, v := range v.Mats {
+	// 				v.Id = primitive.NewObjectID().Hex()
+	// 				// crafts id
+	// 				if len(v.Crafts) > 0 {
+	// 					for _, v := range v.Crafts {
+	// 						v.Id = primitive.NewObjectID().Hex()
+
+	// 					}
+	// 				}
+	// 			}
+	// 		}
+	// 	}
+	// }
 
 	pack.CreateTime = time.Now()
 	pack.UpdateTime = time.Now()

+ 7 - 453
boxcost/api/tmp.json

@@ -1,455 +1,9 @@
 {
-  "_id": "63904fb753445de55269103b",
-  "name": "测试",
-  "pack": {
-    "_id": "638f108e0027470dd3a42f64",
-    "name": "测试包装",
-    "thumbnail": "",
-    "compCounts": 1,
-    "designer": "1232",
-    "components": [
-      {
-        "id": "638f108e0027470dd3a42f60",
-        "name": "333",
-        "thumbnail": "",
-        "count": 1,
-        "uv": "",
-        "uvSize": "0",
-        "mats": [
-          {
-            "id": "1672128617843638eedb2f9039e0980fe5653",
-            "crafts": [
-              {
-                "id": "16721286489396388430851ba5b3307f8ab600",
-                "size": "0",
-                "count": 1,
-                "craftInfo": {
-                  "_id": "6388430851ba5b3307f8ab60",
-                  "name": "光膜",
-                  "unit": "平方米",
-                  "price": 0.4,
-                  "norm": "按文件要求",
-                  "remark": "",
-                  "createTime": "2022-12-01T06:00:40.068Z",
-                  "updateTime": "2022-12-01T06:00:40.068Z",
-                  "category": "覆膜"
-                },
-                "supplier": {
-                  "calc": null,
-                  "deliveryTime": "2022-12-27T08:11:03Z",
-                  "orderPrice": 0,
-                  "orderCount": 3000,
-                  "orderRealPrice": 0,
-                  "supplierInfo": {
-                    "_id": "6388441551ba5b3307f8ab61",
-                    "name": "熊明军",
-                    "address": "金鸡路556",
-                    "phone": "13980871668",
-                    "category": "覆膜",
-                    "createTime": "2022-12-01T06:05:09.079Z",
-                    "updateTime": "2022-12-01T06:05:09.079Z"
-                  }
-                },
-                "batchCount": 1,
-                "batchSizeWidth": 0,
-                "batchSizeHeight": 0,
-                "billId": "63b3961900be5a99e8f7531b",
-                "remark": ""
-              },
-              {
-                "id": "1672729425983",
-                "size": "0",
-                "count": 1,
-                "craftInfo": {
-                  "_id": "638455584d585ba68be6cb90",
-                  "name": "4c印刷",
-                  "unit": "版/色",
-                  "price": 0.22,
-                  "norm": "按文件要求",
-                  "remark": "",
-                  "createTime": "2022-11-28T06:29:44.629Z",
-                  "updateTime": "2022-11-28T06:29:44.629Z",
-                  "category": "UV印刷"
-                },
-                "supplier": {
-                  "calc": {
-                    "_id": "000000000000000000000000",
-                    "category": "UV印刷",
-                    "name": "uv印刷计价方案1",
-                    "remark": "版费(60)\n起价(普通1200,逆向油1600)\n超过10000份减版费",
-                    "param1": "60",
-                    "param2": "1200",
-                    "param3": "1600",
-                    "param4": "10000",
-                    "param5": "",
-                    "createTime": "0001-01-01T00:00:00Z",
-                    "updateTime": "0001-01-01T00:00:00Z",
-                    "isDefault": null
-                  },
-                  "deliveryTime": "2023-01-03T07:03:57Z",
-                  "orderPrice": 0.22,
-                  "orderCount": 3000,
-                  "orderRealPrice": 1440,
-                  "supplierInfo": {
-                    "_id": "6375e17b3913c1b5774bad73",
-                    "name": "泓瑞包装",
-                    "address": "金鸡路556",
-                    "phone": "15212341234",
-                    "category": "UV印刷",
-                    "createTime": "2022-11-17T07:23:39.49Z",
-                    "updateTime": "2022-12-01T05:55:07.972Z"
-                  }
-                },
-                "batchCount": 1,
-                "batchSizeWidth": 0,
-                "batchSizeHeight": 0,
-                "billId": "63b3d37e00be5a99e8f7531d",
-                "remark": "3123"
-              },
-              {
-                "id": "1672729425983",
-                "size": "0",
-                "count": 1,
-                "craftInfo": {
-                  "_id": "638455584d585ba68be6cb90",
-                  "name": "4c印刷",
-                  "unit": "版/色",
-                  "price": 0.22,
-                  "norm": "按文件要求",
-                  "remark": "",
-                  "createTime": "2022-11-28T06:29:44.629Z",
-                  "updateTime": "2022-11-28T06:29:44.629Z",
-                  "category": "UV印刷"
-                },
-                "supplier": {
-                  "calc": {
-                    "_id": "000000000000000000000000",
-                    "category": "UV印刷",
-                    "name": "uv印刷计价方案1",
-                    "remark": "版费(60)\n起价(普通1200,逆向油1600)\n超过10000份减版费",
-                    "param1": "60",
-                    "param2": "1200",
-                    "param3": "1600",
-                    "param4": "10000",
-                    "param5": "",
-                    "createTime": "0001-01-01T00:00:00Z",
-                    "updateTime": "0001-01-01T00:00:00Z",
-                    "isDefault": null
-                  },
-                  "deliveryTime": "2023-01-03T07:03:57Z",
-                  "orderPrice": 0.22,
-                  "orderCount": 3000,
-                  "orderRealPrice": 1440,
-                  "supplierInfo": {
-                    "_id": "6375e17b3913c1b5774bad73",
-                    "name": "泓瑞包装",
-                    "address": "金鸡路556",
-                    "phone": "15212341234",
-                    "category": "UV印刷",
-                    "createTime": "2022-11-17T07:23:39.49Z",
-                    "updateTime": "2022-12-01T05:55:07.972Z"
-                  }
-                },
-                "batchCount": 1,
-                "batchSizeWidth": 0,
-                "batchSizeHeight": 0,
-                "billId": "63b3d37e00be5a99e8f7531d",
-                "remark": "3123"
-              }
-            ],
-            "matInfo": {
-              "_id": "638eedb2f9039e0980fe5653",
-              "name": "太阳白卡",
-              "category": "纸张类",
-              "price": 5400,
-              "unit": "吨",
-              "norm": "250g",
-              "height": 0,
-              "width": 0,
-              "remark": "",
-              "createTime": "2022-12-06T07:22:26.375Z",
-              "updateTime": "2022-12-06T07:24:48.591Z"
-            },
-            "supplier": {
-              "calc": null,
-              "deliveryTime": "2022-12-30T08:11:03Z",
-              "orderPrice": 0,
-              "orderCount": 3000,
-              "orderRealPrice": 0,
-              "supplierInfo": {
-                "_id": "6384668e4d585ba68be6cb9f",
-                "name": "正大文博",
-                "address": "四川省成都市温江区分水村清波工业园A3号",
-                "phone": "13853360367",
-                "category": "纸张类",
-                "createTime": "2022-11-28T07:43:10.638Z",
-                "updateTime": "2022-12-06T07:19:45.089Z"
-              }
-            },
-            "batchCount": 1,
-            "batchSizeWidth": 0,
-            "batchSizeHeight": 0,
-            "billId": "63b3961000be5a99e8f7531a",
-            "remark": "3123144"
-          },
-          {
-            "id": "1672210568313638465894d585ba68be6cb9e",
-            "crafts": [
-              {
-                "id": "167212855882663846db34d585ba68be6cba30",
-                "size": "0",
-                "count": 1,
-                "craftInfo": {
-                  "_id": "63846db34d585ba68be6cba3",
-                  "name": "哑膜",
-                  "unit": "平方米",
-                  "price": 0.49,
-                  "norm": "按文件要求",
-                  "remark": "",
-                  "createTime": "2022-11-28T08:13:39.864Z",
-                  "updateTime": "2022-11-28T08:13:39.864Z",
-                  "category": "覆膜"
-                },
-                "supplier": {
-                  "calc": null,
-                  "deliveryTime": "2023-01-03T07:03:57Z",
-                  "orderPrice": 0,
-                  "orderCount": 3000,
-                  "orderRealPrice": 0,
-                  "supplierInfo": null
-                },
-                "batchCount": 1,
-                "batchSizeWidth": 0,
-                "batchSizeHeight": 0,
-                "billId": "",
-                "remark": ""
-              }
-            ],
-            "matInfo": {
-              "_id": "638465894d585ba68be6cb9e",
-              "name": "地龙灰底白",
-              "category": "纸张类",
-              "price": 4450,
-              "unit": "吨",
-              "norm": "250g",
-              "height": 0,
-              "width": 0,
-              "remark": "",
-              "createTime": "2022-11-28T07:38:49.329Z",
-              "updateTime": "2022-11-28T07:38:49.329Z"
-            },
-            "supplier": {
-              "calc": null,
-              "deliveryTime": "2023-01-03T07:03:57Z",
-              "orderPrice": 0,
-              "orderCount": 3000,
-              "orderRealPrice": 0,
-              "supplierInfo": {
-                "_id": "63846b744d585ba68be6cba1",
-                "name": "宏川",
-                "address": "崇州泗潍路333号",
-                "phone": "13882239198",
-                "category": "普通印刷",
-                "createTime": "2022-11-28T08:04:04.791Z",
-                "updateTime": "2022-12-06T06:55:33.649Z"
-              }
-            },
-            "batchCount": 1,
-            "batchSizeWidth": 0,
-            "batchSizeHeight": 0,
-            "billId": "",
-            "remark": ""
-          },
-          {
-            "id": "167211384335463846f924d585ba68be6cba6",
-            "crafts": [
-              {
-                "id": "1672113843354638471684d585ba68be6cbb00",
-                "size": "0",
-                "count": 1,
-                "craftInfo": {
-                  "_id": "638471684d585ba68be6cbb0",
-                  "name": "打包",
-                  "unit": "张",
-                  "price": 0.01,
-                  "norm": "按文件要求",
-                  "remark": "",
-                  "createTime": "2022-11-28T08:29:28.343Z",
-                  "updateTime": "2022-11-28T08:29:28.343Z",
-                  "category": "打包"
-                },
-                "supplier": {
-                  "calc": null,
-                  "deliveryTime": "2022-12-27T04:04:10Z",
-                  "orderPrice": 0.01,
-                  "orderCount": 3000,
-                  "orderRealPrice": 30,
-                  "supplierInfo": null
-                },
-                "batchCount": 1,
-                "batchSizeWidth": 0,
-                "batchSizeHeight": 0,
-                "billId": "",
-                "remark": ""
-              }
-            ],
-            "matInfo": {
-              "_id": "63846f924d585ba68be6cba6",
-              "name": "E瓦",
-              "category": "瓦纸",
-              "price": 2,
-              "unit": "平方米",
-              "norm": "130+130",
-              "height": 0,
-              "width": 0,
-              "remark": "",
-              "createTime": "2022-11-28T08:21:38.722Z",
-              "updateTime": "2022-11-28T08:30:57.71Z"
-            },
-            "supplier": {
-              "calc": null,
-              "deliveryTime": "2022-12-27T04:04:10Z",
-              "orderPrice": 1.28,
-              "orderCount": 3000,
-              "orderRealPrice": 3840,
-              "supplierInfo": {
-                "_id": "638844d151ba5b3307f8ab68",
-                "name": "中印正隆",
-                "address": "崇州2",
-                "phone": "13699069388",
-                "category": "打包",
-                "createTime": "2022-12-01T06:08:17.095Z",
-                "updateTime": "2022-12-01T06:08:17.095Z"
-              }
-            },
-            "batchCount": 1,
-            "batchSizeWidth": 800,
-            "batchSizeHeight": 800,
-            "billId": "63aa8f4d97479fa5562287cd",
-            "remark": ""
-          }
-        ],
-        "remark": "",
-        "totalPrice": 5310
-      },
-      {
-        "id": "1670397519144",
-        "name": "盒盖",
-        "thumbnail": "",
-        "count": 1,
-        "uv": "",
-        "uvSize": "200*300",
-        "mats": [
-          {
-            "id": "1670397527450638eedb2f9039e0980fe5653",
-            "crafts": [
-              {
-                "id": "1670397527450638471684d585ba68be6cbb00",
-                "size": "100*200",
-                "count": 1,
-                "craftInfo": {
-                  "_id": "638471684d585ba68be6cbb0",
-                  "name": "打包",
-                  "unit": "张",
-                  "price": 0.01,
-                  "norm": "按文件要求",
-                  "remark": "",
-                  "createTime": "2022-11-28T08:29:28.343Z",
-                  "updateTime": "2022-11-28T08:29:28.343Z",
-                  "category": "打包"
-                },
-                "supplier": {
-                  "calc": null,
-                  "deliveryTime": "2022-12-07T08:32:48Z",
-                  "orderPrice": 0.01,
-                  "orderCount": 3000,
-                  "orderRealPrice": 30,
-                  "supplierInfo": null
-                },
-                "batchCount": 1,
-                "batchSizeWidth": 100,
-                "batchSizeHeight": 200,
-                "billId": "",
-                "remark": ""
-              },
-              {
-                "id": "1670397527450638470d24d585ba68be6cbaf1",
-                "size": "0",
-                "count": 1,
-                "craftInfo": {
-                  "_id": "638470d24d585ba68be6cbaf",
-                  "name": "粘盒",
-                  "unit": "张",
-                  "price": 0.08,
-                  "norm": "按文件要求",
-                  "remark": "",
-                  "createTime": "2022-11-28T08:26:58.869Z",
-                  "updateTime": "2022-11-28T08:27:24.914Z",
-                  "category": "粘盒"
-                },
-                "supplier": {
-                  "calc": null,
-                  "deliveryTime": "2022-12-07T08:32:48Z",
-                  "orderPrice": 0.08,
-                  "orderCount": 3000,
-                  "orderRealPrice": 240,
-                  "supplierInfo": null
-                },
-                "batchCount": 1,
-                "batchSizeWidth": 0,
-                "batchSizeHeight": 0,
-                "billId": "",
-                "remark": ""
-              }
-            ],
-            "matInfo": {
-              "_id": "638eedb2f9039e0980fe5653",
-              "name": "太阳白卡",
-              "category": "纸张类",
-              "price": 5400,
-              "unit": "吨",
-              "norm": "250g",
-              "height": 0,
-              "width": 0,
-              "remark": "",
-              "createTime": "2022-12-06T07:22:26.375Z",
-              "updateTime": "2022-12-06T07:24:48.591Z"
-            },
-            "supplier": {
-              "calc": null,
-              "deliveryTime": "2022-12-07T08:32:48Z",
-              "orderPrice": 0.081,
-              "orderCount": 3000,
-              "orderRealPrice": 243,
-              "supplierInfo": {
-                "_id": "6384668e4d585ba68be6cb9f",
-                "name": "正大文博",
-                "address": "四川省成都市温江区分水村清波工业园A3号",
-                "phone": "13853360367",
-                "category": "纸张类",
-                "createTime": "2022-11-28T07:43:10.638Z",
-                "updateTime": "2022-12-06T07:19:45.089Z"
-              }
-            },
-            "batchCount": 1,
-            "batchSizeWidth": 200,
-            "batchSizeHeight": 300,
-            "billId": "63915142af181d9ba5d87aaa",
-            "remark": ""
-          }
-        ],
-        "remark": "",
-        "totalPrice": 513
-      }
-    ],
-    "createTime": "2022-12-06T09:51:10.885Z",
-    "updateTime": "2023-01-03T07:03:50.03Z"
-  },
-  "thumbnail": "",
-  "createUser": "31231",
-  "total": 3000,
-  "status": "process",
-  "totalPrice": 5823,
-  "updateTime": "2023-01-03T10:02:39.441Z",
-  "createTime": "2022-12-07T08:32:55.92Z"
+  "x_scale": 0.12,
+  "y_scale": 0.12,
+  "x_offset": 30,
+  "print_obj": true,
+  "lock_aspect_ratio": false,
+  "locked": false,
+  "positioning": "oncell"
 }

+ 2 - 2
boxcost/app.yaml

@@ -29,7 +29,7 @@ debug:
   UserRole: string
 
 nats:
-  url: nats://124.71.139.24:14300
-  #url: nats://127.0.0.1:14300
+  # url: nats://124.71.139.24:14300
+  url: nats://127.0.0.1:14300
   maxReconnect: 1000
   reconnDelaySecond: 5