|
@@ -6,51 +6,86 @@
|
|
|
* @version
|
|
|
*/
|
|
|
import BaseModel from "../../common/base/base_model";
|
|
|
-import mongoose from 'mongoose';
|
|
|
-const STDGLJLibMapSchema = mongoose.model('std_glj_lib_map');
|
|
|
+import mongoose from "mongoose";
|
|
|
+const STDGLJLibMapSchema = mongoose.model("std_glj_lib_map");
|
|
|
|
|
|
class STDGLJLibMapModel extends BaseModel {
|
|
|
+ /**
|
|
|
+ * 构造函数
|
|
|
+ *
|
|
|
+ * @return {void}
|
|
|
+ */
|
|
|
+ constructor() {
|
|
|
+ let parent = super();
|
|
|
+ parent.model = STDGLJLibMapSchema;
|
|
|
+ parent.init();
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 构造函数
|
|
|
- *
|
|
|
- * @return {void}
|
|
|
- */
|
|
|
- constructor() {
|
|
|
- let parent = super();
|
|
|
- parent.model = STDGLJLibMapSchema;
|
|
|
- parent.init();
|
|
|
+ /**
|
|
|
+ * 获取对应的工料机库
|
|
|
+ *
|
|
|
+ * @param {String} compilationId
|
|
|
+ * @return {Promise}
|
|
|
+ */
|
|
|
+ async getGLJLibList(compilationId) {
|
|
|
+ let result = [];
|
|
|
+ let gliLib = await this.findDataByCondition(
|
|
|
+ { deleted: false, compilationId: compilationId.toString() },
|
|
|
+ null,
|
|
|
+ false
|
|
|
+ );
|
|
|
+
|
|
|
+ if (gliLib.length <= 0) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 整理数据
|
|
|
+ let gljList = [];
|
|
|
+ for (let tmp of gliLib) {
|
|
|
+ let tmpRation = { id: tmp.ID, name: tmp.dispName };
|
|
|
+ if (gljList.length <= 0) {
|
|
|
+ gljList = [tmpRation];
|
|
|
+ } else {
|
|
|
+ gljList.push(tmpRation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ result = gljList;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有未删除的的工料机库
|
|
|
+ *
|
|
|
+ * @param {String} compilationId
|
|
|
+ * @return {Promise}
|
|
|
+ */
|
|
|
+ async getAllGLJLibList() {
|
|
|
+ let result = [];
|
|
|
+ let gliLib = await this.findDataByCondition(
|
|
|
+ { deleted: false },
|
|
|
+ null,
|
|
|
+ false
|
|
|
+ );
|
|
|
+
|
|
|
+ if (gliLib.length <= 0) {
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取对应的工料机库
|
|
|
- *
|
|
|
- * @param {String} compilationId
|
|
|
- * @return {Promise}
|
|
|
- */
|
|
|
- async getGLJLibList(compilationId) {
|
|
|
- let result = [];
|
|
|
- let gliLib = await this.findDataByCondition({deleted: false, compilationId: compilationId.toString()}, null, false);
|
|
|
-
|
|
|
- if (gliLib.length <= 0) {
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- // 整理数据
|
|
|
- let gljList = [];
|
|
|
- for(let tmp of gliLib) {
|
|
|
- let tmpRation = {id: tmp.ID, name: tmp.dispName};
|
|
|
- if (gljList.length <= 0) {
|
|
|
- gljList = [tmpRation];
|
|
|
- } else {
|
|
|
- gljList.push(tmpRation);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- result = gljList;
|
|
|
- return result;
|
|
|
+ // 整理数据
|
|
|
+ let gljList = [];
|
|
|
+ for (let tmp of gliLib) {
|
|
|
+ let tmpRation = { id: tmp.ID, name: tmp.dispName };
|
|
|
+ if (gljList.length <= 0) {
|
|
|
+ gljList = [tmpRation];
|
|
|
+ } else {
|
|
|
+ gljList.push(tmpRation);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ result = gljList;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-export default STDGLJLibMapModel;
|
|
|
+export default STDGLJLibMapModel;
|