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
63
64
65
66
67
68
import { default as BaseController } from "../baseController";
import { Post } from "egg-shell-decorators";
 
export default class productPositionGroupController extends BaseController {
  //#region app-提交盘点
  @Post()
  public async getOriginalPlateList() {
    let { ctx } = this;
    let body = ctx.request.body;
    let storage_Id = body.storage_Id;
    let paiCode = body.paiCode;
    try {
      let sql = `SELECT p.consignor_Id, p.consignorCode, p.consignorName, 
                p.product_Id,p.productCode,p.productModel,MAX(p.productName) AS productName,MAX(p.positionName) AS positionNo, 
                SUM(validQty) AS quantity,MAX(I.remark) AS remark, p.productSpec, p.produceDate, p.batchNumber, 
                0 AS scanCount,
                p.storageStatus, p.productAttribute,
                MAX(I.relationCode) as relationCode, 
                MAX(I.relationCode2) as relationCode2, 
                MAX(I.relationCode3) as relationCode3, 
                MAX(I.relationCode4) as relationCode4, 
                MAX(I.relationCode5) as relationCode5,
                MAX(I.middleBarcode) as middleBarcode, 
                MAX(I.middleUnitConvert) as middleUnitConvert, 
                MAX(I.bigBarcode) as bigBarcode, 
                MAX(I.unitConvert) as unitConvert,
                    p.plateCode
              FROM dbo.vBase_ProductPosition p INNER JOIN dbo.vBase_ProductInfo_SKU I ON p.product_Id=I.product_Id 
              WHERE p.Storage_Id=@0
                AND p.plateCode=@1 
                AND p.validQty>0
              GROUP BY p.consignor_Id, p.consignorCode, p.consignorName, p.product_Id,
              p.productCode,p.productModel, p.produceDate, p.productSpec, p.batchNumber, p.storageStatus, p.productAttribute,p.plateCode`;
      let tableList = await this.dbRead.query(sql, [storage_Id, paiCode]);
      if (tableList.length == 0) {
        this.info.result = false;
        this.info.msg = "没有找到库存数据";
        return this.info;
      } else {
        this.info.result = true;
        this.info.data = tableList;
      }
    } catch (error) {
      this, (this.info.result = false);
      this.info.msg = "错误:" + error.message;
    }
    ctx.body = this.info;
  }
  //#endregion
 
  //#region app-提交盘点
  @Post()
  public async savePlateTransfer() {
    let { ctx } = this;
    let body = ctx.request.body;
    let storage_Id = body.storage_Id; // 仓库
    let position = body.position; // 目标货位
    let plateCode = body.plateCode; // 拍号
    try {
      this.info = await ctx.service.storage.positionGroupService.savePlateTransfer(storage_Id, position, plateCode);
    } catch (error) {
      this, (this.info.result = false);
      this.info.msg = "错误:" + error.message;
    }
    ctx.body = this.info;
  }
  //#endregion
}