schangxiang@126.com
2025-09-09 3d8966ba2c81e7e0365c8b123e861d18ee4f94f5
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import { Post } from "egg-shell-decorators";
import BaseController from "../baseController";
import { BasePosition } from "../../entity/basicInfo/base/basePosition";
// import { vBaseProductPosition } from "../../entity/storage/product/vBaseProductPosition";
 
/**
 * 无单扫描出库
 */
export default class NoBillScanController extends BaseController {
  //#region 无单扫描入库 - 根据条码获取物料信息
  /**
   * 创建日期:2015/10/9
   * 说    明:无单扫描入库 - 根据条码获取物料信息
   */
  @Post()
  public async getProductInfo() {
    let { ctx } = this;
    let body = ctx.request.body;
 
    try {
      this.info = await ctx.service.outbound.outScanService.getProductInfo(body.storage_Id, body.positionName, body.productModel, body.consignor_Id);
 
      ctx.body = this.info;
    } catch (ex) {
      this.info.result = false;
      this.info.msg = "获取数据时出错:" + ex.message;
 
      ctx.body = this.info;
    }
  }
  //#endregion
 
  //#region 无单扫描出库 - 根据条码获取物料信息
  /**
   * 创建日期:2015/10/9
   * 说    明:无单扫描出库 - 根据条码获取物料信息
   */
  @Post()
  public async getProductInfoOut() {
    let { ctx } = this;
    let body = ctx.request.body;
    try {
      this.info = await ctx.service.outbound.outScanService.getProductInfoOut(
        body.storage_Id,
        body.positionName,
        body.productModel,
        body.consignor_Id
      );
 
      ctx.body = this.info;
    } catch (ex) {
      this.info.result = false;
      this.info.msg = "获取数据时出错:" + ex.message;
 
      ctx.body = this.info;
    }
  }
  //#endregion
 
  //#region 无单扫描 - 根据条码获取物料信息(权限控制)
  /**
   * 创建日期:2018/11/15
   * 说    明:无单扫描入库 - 根据条码获取物料信息
   */
  @Post()
  public async getProductInfoAuth() {
    let { ctx } = this;
    let body = ctx.request.body;
    var positionInfo = await this.dbRead.find(BasePosition, {
      positionName: body.positionName,
      storage_Id: body.storage_Id
    });
    if (positionInfo == null) {
      this.info.result = false;
      this.info.msg = "仓库货位不对应!";
      ctx.body = this.info;
      return;
    }
 
    try {
      this.info = await ctx.service.outbound.outScanService.getProductInfoAuth(body.storage_Id, body.positionName, body.productModel);
      ctx.body = this.info;
    } catch (ex) {
      this.info.result = false;
      this.info.msg = "获取数据时出错:" + ex.message;
 
      ctx.body = this.info;
    }
  }
  //#endregion
 
  //#region  无单扫描保存
  /// <summary>
  /// 说明:无单扫描保存
  /// </summary>
  /// <returns></returns>
  @Post()
  public async saleOuterNoBillSave() {
    let { ctx } = this;
    let body = ctx.request.body;
 
    this.info = await this.service.outbound.outScanService.noBillOutSave(body.list);
    ctx.body = this.info;
  }
  //#endregion
 
  //#region  无单扫描保存(自由选择货主)
  /// <summary>
  /// 说明:无单扫描保存(自由选择货主)
  /// </summary>
  /// <returns></returns>
  @Post()
  public async saleOuterNoBillSaveByConsignor() {
    let { ctx } = this;
    let body = ctx.request.body;
 
    //效验信息是否正确
    // let positionInfo = await this.dbRead.findOne(vBaseProductPosition, {
    //   storage_Id: body.dataList[0].storage_Id,
    //   consignor_Id: body.dataList[0].consignor_Id,
    //   positionName: body.dataList[0].positionName,
    //   productCode: body.dataList[0].productCode
    // });
    // if (!positionInfo) {
    //   this.info.result = false;
    //   this.info.msg = "未找到有效库存,请核对基础信息!";
    //   ctx.body = this.info;
    //   return;
    // }
    this.info = await ctx.service.outbound.outScanService.noBillOutSaveByConsignor(body.dataList);
    ctx.body = this.info;
    return;
  }
  //#endregion
}