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
52
53
54
55
56
57
58
59
60
61
62
import BaseController from "../baseController";
import { Post } from "egg-shell-decorators";
import { BaseConsignor } from "../../entity/basicInfo/consignor/baseConsignor";
import { BaseEmptyEquipmentReturn } from "../../entity/outbound/sale/baseEmptyEquipmentReturn";
import { BaseDestination } from "../../entity/basicInfo/workshop/baseDestination";
/**
 * 身份证处理
 */
export default class EmptyEquipmentReturnController extends BaseController {
  //#region addNewEquipment
  /// <summary>
  /// 空器具回库信息添加
  /// </summary>
  /// <param name="ReturnCode">空器具回库添加</param>
  /// <returns>空器具回库添加</returns>
  @Post()
  public async addNewEquipment() {
    let { ctx } = this;
    try {
      let body = ctx.request.body;
      let userInfo = await ctx.helper.userInfo();
      var emptyReturn = body.emptyReturn;
 
      let consignorInfo = await this.dbRead.findOne(BaseConsignor, { userProduct_Id: userInfo.userProduct_Id });
      let destinationInfo = await this.dbRead.findOne(BaseDestination, { destination_Id: emptyReturn.destination_Id });
 
      var emptyInfo = new BaseEmptyEquipmentReturn();
      emptyInfo.emptyEquipmentReturnCode = await ctx.service.common.getCodeRegular(1807);
      emptyInfo.consignorName = consignorInfo.consignorName;
      emptyInfo.consignor_Id = consignorInfo.consignor_Id;
      emptyInfo.consignorCode = consignorInfo.consignorCode;
      emptyInfo.totalQuantity = emptyReturn.totalQuantity;
      emptyInfo.remark = emptyReturn.remark;
      emptyInfo.destination_Id = emptyReturn.destination_Id;
      emptyInfo.destinationName = destinationInfo.destinationName;
      emptyInfo.orderType = "空器具回库";
      emptyInfo.statusText = "新建";
      emptyInfo.storage_Id = 87;
      emptyInfo.storageName = "立体库";
 
      await this.setAccountInfo(emptyInfo);
      await this.dbWrite.save(emptyInfo);
 
      // var orderListInfo = new PurchaseOrderList();
      // orderListInfo.order_Id = orderInfo.order_Id;
      // orderListInfo.productName = productInfo.productName;
      // orderListInfo.productCode = productInfo.productCode;
      // orderListInfo.product_Id = productInfo.product_Id;
      // orderListInfo.productModel = productInfo.productModel;
      // // orderListInfo.sortingStatus = 1;
      // await this.dbWrite.save(orderListInfo);
      this.info.result = true;
      this.info.msg = "添加成功!";
      this.info.data = emptyInfo;
    } catch (ex) {
      this.info.result = false;
      this.info.msg = "错误信息:" + ex.message;
    }
    ctx.body = this.info;
  }
  //#endregion
}