| 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 | 
| } |