@cpzxrobot/sdk 1.2.20 → 1.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/car_gateway.ts CHANGED
@@ -57,4 +57,17 @@ export class CarGateway extends Object {
57
57
  },
58
58
  }
59
59
  }
60
+
61
+ //POST /api/v2/car/record
62
+ // {
63
+ // "id":123,
64
+ // "manualLoadWeight":40000,
65
+ // "manualLoadWeightTime":"2025-05-08 05:10:49"
66
+ // "manualCarWeight":20000,
67
+ // "manualCarWeightTime":"2025-05-08 08:20:49"
68
+ // }
69
+ async updateRecord(factory: Factory, record: any) {
70
+ var axios = await this.context.ready;
71
+ return axios.post(`/api/v2/car/${factory.pid}/weightRecord`, record);
72
+ }
60
73
  }
@@ -50,5 +50,17 @@ class CarGateway extends Object {
50
50
  },
51
51
  };
52
52
  }
53
+ //POST /api/v2/car/record
54
+ // {
55
+ // "id":123,
56
+ // "manualLoadWeight":40000,
57
+ // "manualLoadWeightTime":"2025-05-08 05:10:49"
58
+ // "manualCarWeight":20000,
59
+ // "manualCarWeightTime":"2025-05-08 08:20:49"
60
+ // }
61
+ async updateRecord(factory, record) {
62
+ var axios = await this.context.ready;
63
+ return axios.post(`/api/v2/car/${factory.pid}/weightRecord`, record);
64
+ }
53
65
  }
54
66
  exports.CarGateway = CarGateway;
@@ -147,5 +147,14 @@ class FactoryGateway extends Object {
147
147
  }
148
148
  };
149
149
  }
150
+ //获得工厂的设备报警信息
151
+ async alert(params) {
152
+ let axios = await this.context.ready;
153
+ const response = await axios.get(`/api/v1/device/alert`, {
154
+ params: params,
155
+ });
156
+ const json = response.data;
157
+ return json;
158
+ }
150
159
  }
151
160
  exports.FactoryGateway = FactoryGateway;
@@ -182,4 +182,16 @@ export class FactoryGateway extends Object {
182
182
  }
183
183
  }
184
184
  }
185
+
186
+ //获得工厂的设备报警信息
187
+ async alert(params:any): Promise<any> {
188
+ let axios = await this.context.ready;
189
+ const response = await axios.get(
190
+ `/api/v1/device/alert`,{
191
+ params: params,
192
+ }
193
+ );
194
+ const json = response.data;
195
+ return json;
196
+ }
185
197
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -112,11 +112,44 @@ cpzxrobot().device.validate(serialNumbers)
112
112
  cpzxrobot().device.thresholdConfig.list()
113
113
 
114
114
  // 获取设备报警列表
115
+ cpzxrobot().device.alert(factoryId, type)
115
116
 
116
117
  // 报告设备问题
117
118
  cpzxrobot().device.report(deviceId, status, description)
118
119
  ```
119
120
 
121
+ ### alert函数说明
122
+
123
+ 获取工厂设备的告警列表
124
+
125
+ #### 参数
126
+ - `factoryId`: string - 工厂ID
127
+ - `type`?: string - (可选)告警类型
128
+
129
+ #### 返回值
130
+ Promise<DeviceFault[]> - 按时间排序的告警记录数组
131
+
132
+ #### 使用示例
133
+ ```typescript
134
+ // 获取工厂123的所有告警
135
+ const alerts = await cpzxrobot().device.alert("123");
136
+
137
+ // 获取工厂123的温度相关告警
138
+ const tempAlerts = await cpzxrobot().device.alert("123", "temperature");
139
+ ```
140
+
141
+ ### DeviceFault接口
142
+ ```typescript
143
+ interface DeviceFault {
144
+ category: string; // 告警类别
145
+ time: Date; // 发生时间
146
+ resolved: boolean; // 是否已解决
147
+ repeated?: number; // 重复次数(可选)
148
+ value?: any; // 告警值(可选)
149
+ message?: string; // 告警消息(可选)
150
+ }
151
+ ```
152
+
120
153
  ### report函数说明
121
154
 
122
155
  报告设备问题状态
@@ -549,6 +582,37 @@ cpzxrobot().quotation.list({
549
582
  cpzxrobot().quotation.add({
550
583
  // 报价单数据
551
584
  })
585
+
586
+ // 获取报价单详情
587
+ cpzxrobot().quotation.get(id: number)
588
+
589
+ // 更新报价单信息
590
+ cpzxrobot().quotation.update({
591
+ quotationTypeId: number,
592
+ quotationTypeName: string,
593
+ customerId: number,
594
+ customerName: string,
595
+ quotationContent: string,
596
+ customerContactId: number,
597
+ customerContactName: string,
598
+ contactPhone: string,
599
+ salesman: string,
600
+ amount: number,
601
+ quotationCost: number,
602
+ quotationGrossProfit: number,
603
+ quotationDemandDate: string,
604
+ companyId: number,
605
+ tax: number,
606
+ projectId: number,
607
+ validDay: number,
608
+ quotationDate: string
609
+ })
610
+
611
+ // 删除报价单
612
+ cpzxrobot().quotation.delete(id: number)
613
+
614
+ // 将报价单转化为合同
615
+ cpzxrobot().quotation.transform(id: number)
552
616
  ```
553
617
 
554
618
  ### 合同管理
@@ -581,6 +645,55 @@ cpzxrobot().contract.export({
581
645
  })
582
646
  ```
583
647
 
648
+ #### 合同分组接口
649
+ ```javascript
650
+ // 项目相关合同接口
651
+ cpzxrobot().contract.project = {
652
+ // 添加项目合同 (替代原addForProject)
653
+ addContract: (args: any) => Promise<any>
654
+
655
+ // 添加项目回款信息
656
+ addPayment: (args: {
657
+ createTime: string;
658
+ createUserId: number;
659
+ updateTime: string;
660
+ updateUserId: number;
661
+ companyId: number;
662
+ contractId: number;
663
+ receivedPayments: number;
664
+ receivedPerson: string;
665
+ receiveDate: string;
666
+ remark: string;
667
+ }) => Promise<any>
668
+
669
+ // 查看项目回款记录
670
+ listPayments: (id: number) => Promise<any>
671
+ }
672
+
673
+ // 产品相关合同接口
674
+ cpzxrobot().contract.product = {
675
+ // 添加产品合同 (替代原addForProduct)
676
+ addContract: (args: any) => Promise<any>
677
+
678
+ // 添加产品回款信息
679
+ addPayment: (args: {
680
+ createTime: string;
681
+ createUserId: number;
682
+ updateTime: string;
683
+ updateUserId: number;
684
+ companyId: number;
685
+ contractId: number;
686
+ receivedPayments: number;
687
+ receivedPerson: string;
688
+ receiveDate: string;
689
+ remark: string;
690
+ }) => Promise<any>
691
+
692
+ // 查看产品回款记录
693
+ listPayments: (id: number) => Promise<any>
694
+ }
695
+ ```
696
+
584
697
  #### 合同审批流程
585
698
  ```javascript
586
699
  // 提交合同审批
@@ -599,6 +712,15 @@ cpzxrobot().contract.restart({
599
712
  cpzxrobot().contract.types(factoryId)
600
713
  ```
601
714
 
715
+ #### Deprecated 接口
716
+ ```javascript
717
+ // 已废弃 - 请使用contract.project.addContract
718
+ cpzxrobot().contract.addForProject(args: any)
719
+
720
+ // 已废弃 - 请使用contract.product.addContract
721
+ cpzxrobot().contract.addForProduct(args: any)
722
+ ```
723
+
602
724
  #### 合同关联信息
603
725
  ```javascript
604
726
  // 获取客户列表
@@ -666,6 +788,15 @@ cpzxrobot().car.listByDistrict(district)
666
788
  // 获取车辆运单
667
789
  cpzxrobot().car.orders(factoryId)
668
790
  cpzxrobot().car.ordersByFactory(factoryId)
791
+
792
+ // 更新车辆称重记录
793
+ cpzxrobot().car.updateRecord(factory: Factory, record: {
794
+ id: number, // 记录ID
795
+ manualLoadWeight: number, // 手动装载重量(kg)
796
+ manualLoadWeightTime: string, // 手动装载时间(格式: "YYYY-MM-DD HH:mm:ss")
797
+ manualCarWeight: number, // 手动车辆重量(kg)
798
+ manualCarWeightTime: string // 手动车辆称重时间(格式: "YYYY-MM-DD HH:mm:ss")
799
+ })
669
800
  ```
670
801
  ```
671
802
  cpzxrobot({