@cpzxrobot/sdk 1.2.21 → 1.2.23

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;
@@ -126,6 +126,24 @@ class ProjectGateway extends Object {
126
126
  return axios.get(`/api/v2/coremde-sale/project/province/get?area_code=${area_code}`);
127
127
  });
128
128
  }
129
+ // 新增项目
130
+ add(projectData) {
131
+ return this.context.ready.then((axios) => {
132
+ return axios.post(`/api/v2/coremde-sale/project/add`, projectData);
133
+ });
134
+ }
135
+ // 更新项目
136
+ update(projectData) {
137
+ return this.context.ready.then((axios) => {
138
+ return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
139
+ });
140
+ }
141
+ // 删除项目
142
+ delete(id) {
143
+ return this.context.ready.then((axios) => {
144
+ return axios.get(`/api/v2/coremde-sale/project/delete?id=${id}`);
145
+ });
146
+ }
129
147
  get inquiry() {
130
148
  return {
131
149
  // 获取询价列表
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -162,6 +162,27 @@ export class ProjectGateway extends Object {
162
162
  });
163
163
  }
164
164
 
165
+ // 新增项目
166
+ add(projectData: any) {
167
+ return this.context.ready.then((axios) => {
168
+ return axios.post(`/api/v2/coremde-sale/project/add`, projectData);
169
+ });
170
+ }
171
+
172
+ // 更新项目
173
+ update(projectData: any) {
174
+ return this.context.ready.then((axios) => {
175
+ return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
176
+ });
177
+ }
178
+
179
+ // 删除项目
180
+ delete(id: number) {
181
+ return this.context.ready.then((axios) => {
182
+ return axios.get(`/api/v2/coremde-sale/project/delete?id=${id}`);
183
+ });
184
+ }
185
+
165
186
  get inquiry() {
166
187
  return {
167
188
  // 获取询价列表
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
  报告设备问题状态
@@ -452,6 +485,76 @@ cpzxrobot().project.list({
452
485
  // 获取项目详情
453
486
  cpzxrobot().project.get(projectId)
454
487
 
488
+ // 新增项目
489
+ cpzxrobot().project.add({
490
+ projectCode: string, // 项目代码
491
+ projectName: string, // 项目名称
492
+ description: string, // 项目描述
493
+ image: string, // 项目图片
494
+ type: number, // 项目类型
495
+ scale: string, // 项目规模
496
+ amount: number, // 项目金额
497
+ principalId: number, // 负责人ID
498
+ startDate: string, // 开始日期(YYYY-MM-DD)
499
+ workDate: string, // 工作日期(YYYY-MM-DD)
500
+ endDate: string, // 结束日期(YYYY-MM-DD)
501
+ customerId: number, // 客户ID
502
+ progressPercentage: string, // 进度百分比
503
+ projectProgress: number, // 项目进度
504
+ projectPayment: number, // 项目付款
505
+ activeFlag: number, // 激活标志
506
+ fileId: number, // 文件ID
507
+ icpRecordNumber: string, // ICP备案号
508
+ supervise: string, // 监督人
509
+ supervisePhone: string, // 监督电话
510
+ areaCode: number, // 区域代码
511
+ address: string, // 地址
512
+ lat: string, // 纬度
513
+ lng: string, // 经度
514
+ budget: number, // 预算
515
+ expectedTransactionTime: string, // 预计交易时间
516
+ currentStage: string, // 当前阶段
517
+ customerContactId: number, // 客户联系人ID
518
+ projectStageId: number // 项目阶段ID
519
+ })
520
+
521
+ // 更新项目
522
+ cpzxrobot().project.update({
523
+ id: number, // 项目ID
524
+ projectCode: string, // 项目代码
525
+ projectName: string, // 项目名称
526
+ description: string, // 项目描述
527
+ image: string, // 项目图片
528
+ type: number, // 项目类型
529
+ scale: string, // 项目规模
530
+ amount: number, // 项目金额
531
+ principalId: number, // 负责人ID
532
+ startDate: string, // 开始日期(YYYY-MM-DD)
533
+ workDate: string, // 工作日期(YYYY-MM-DD)
534
+ endDate: string, // 结束日期(YYYY-MM-DD)
535
+ customerId: number, // 客户ID
536
+ progressPercentage: string, // 进度百分比
537
+ projectProgress: number, // 项目进度
538
+ projectPayment: number, // 项目付款
539
+ activeFlag: number, // 激活标志
540
+ fileId: number, // 文件ID
541
+ icpRecordNumber: string, // ICP备案号
542
+ supervise: string, // 监督人
543
+ supervisePhone: string, // 监督电话
544
+ areaCode: number, // 区域代码
545
+ address: string, // 地址
546
+ lat: string, // 纬度
547
+ lng: string, // 经度
548
+ budget: number, // 预算
549
+ expectedTransactionTime: string, // 预计交易时间
550
+ currentStage: string, // 当前阶段
551
+ customerContactId: number, // 客户联系人ID
552
+ projectStageId: number // 项目阶段ID
553
+ })
554
+
555
+ // 删除项目
556
+ cpzxrobot().project.delete(projectId: number) // 项目ID
557
+
455
558
  // 全国项目统计
456
559
  cpzxrobot().project.stat.china()
457
560
 
@@ -755,6 +858,15 @@ cpzxrobot().car.listByDistrict(district)
755
858
  // 获取车辆运单
756
859
  cpzxrobot().car.orders(factoryId)
757
860
  cpzxrobot().car.ordersByFactory(factoryId)
861
+
862
+ // 更新车辆称重记录
863
+ cpzxrobot().car.updateRecord(factory: Factory, record: {
864
+ id: number, // 记录ID
865
+ manualLoadWeight: number, // 手动装载重量(kg)
866
+ manualLoadWeightTime: string, // 手动装载时间(格式: "YYYY-MM-DD HH:mm:ss")
867
+ manualCarWeight: number, // 手动车辆重量(kg)
868
+ manualCarWeightTime: string // 手动车辆称重时间(格式: "YYYY-MM-DD HH:mm:ss")
869
+ })
758
870
  ```
759
871
  ```
760
872
  cpzxrobot({