333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//#region import
import BaseApiService from "../baseApiService";
import { SysParamValue } from "../../entity/sys/core/sysParamValue";
import { PurchaseOrderStatusHistory } from "../../entity/inbound/purchase/purchaseOrderStatusHistory";
//#endregion
 
/**
 * 运单轨迹帮助类
 */
export default class OrderHelperService extends BaseApiService {
  public async setStatusHistory(
    order_Id: number,
    fromStatusText: string,
    toStatusText: string,
    statusType: string,
    operationType: string,
    billId?: number,
    billCode?: string,
    creator?: string
  ) {
    let { ctx } = this;
    let userInfo = await ctx.helper.userInfo();
    if (!creator) creator = userInfo.userTrueName;
 
    let hisEntity = new PurchaseOrderStatusHistory();
    hisEntity.billId = billId;
    hisEntity.billCode = billCode;
    hisEntity.fromStatus = fromStatusText;
    hisEntity.toStatus = toStatusText;
    hisEntity.statusType = statusType;
    hisEntity.operationType = operationType;
    hisEntity.order_Id = order_Id;
    hisEntity.creator = creator;
    hisEntity.createDate = new Date();
 
    await this.dbWrite.save(hisEntity);
  }
 
  async getStatusText(statusText: string) {
    let paramInfo = await this.dbRead.findOne(SysParamValue, {
      select: ["value01"],
      where: { type_Id: 526, value02: statusText }
    });
 
    if (!paramInfo) {
      return null;
    }
 
    return paramInfo.value01;
  }
}