quwangxin 3 years ago
parent
commit
3d241a4707

+ 18 - 0
src/api/mainData/index.js

@@ -19,3 +19,21 @@ export async function getTaskListById (id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+// SAP-查询库存
+export async function realTimeStorage (params) {
+  const res = await request.get(`/sap/sync/realTimeStorage`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 根据生产版本ID查询bom子项列表
+export async function bomSubListByVersionId (params) {
+  const res = await request.get(
+    `/main/produceversion/resource/bomSubListByVersionId/${params.versionId}/${params.taskInstanceId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 14 - 5
src/components/EquipmentDailog/equipment-dailog.vue

@@ -41,7 +41,16 @@
 <script>
   import { getDeviceList, getPlanDeviceList } from '@/api/aps/index';
   export default {
-    props: ['produceVersionId'],
+    props: {
+      produceVersionId: {
+        type: String,
+        default: ''
+      },
+      isPlan: {
+        type: Boolean,
+        default: false
+      }
+    },
     data () {
       return {
         visible: false,
@@ -112,11 +121,11 @@
       }
     },
     methods: {
-      open (val, list = []) {
+      open (list = []) {
         this.memoList = list;
         this.isSingle = false;
         this.visible = true;
-        this._getList(val);
+        this._getList();
       },
       openSingle (list = [], callback) {
         this.memoList = list;
@@ -141,8 +150,8 @@
           });
         }
       },
-      async _getList (val) {
-        const fn = val ? getPlanDeviceList : getDeviceList;
+      async _getList () {
+        const fn = this.isPlan ? getPlanDeviceList : getDeviceList;
         const data = await fn({
           name: this.name,
           productionId: this.produceVersionId

+ 227 - 0
src/components/catogary/index.vue

@@ -0,0 +1,227 @@
+<template>
+  <el-dialog
+    title="选择"
+    :visible.sync="materialdialog"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="60%"
+  >
+    <div>
+      <el-row>
+        <el-col :span="24" class="topsearch">
+          <el-form>
+            <el-row>
+              <el-col :span="6">
+                <el-input
+                  v-model.trim="searchKey"
+                  placeholder="输入编码或名称"
+                  size="small"
+                ></el-input>
+              </el-col>
+              <el-col :span="6" style="margin-left: 10px">
+                <el-button type="primary" size="small" @click="searchByKeyWords"
+                  >搜索</el-button
+                >
+                <el-button size="small" @click="reset">重置</el-button>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="6" class="tree_col">
+          <AssetTree
+            @handleNodeClick="handleNodeClick"
+            @setRootId="setRootId"
+            :id="id"
+            ref="treeList"
+          />
+        </el-col>
+        <el-col :span="18" class="table_col">
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            @done="handleDone"
+            @update:selection="selectionChange"
+            row-key="id"
+            :initLoad="false"
+            :selection.sync="selectionList"
+            :datasource="datasource"
+            height="45vh"
+          >
+          </ele-pro-table>
+        </el-col>
+      </el-row>
+    </div>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import AssetTree from '@/components/AssetTree';
+  import { getList } from '@/api/classifyManage/itemInformation';
+  export default {
+    props: {
+      id: {
+        type: String,
+        default: '1'
+      }
+    },
+    components: {
+      AssetTree
+    },
+    data () {
+      return {
+        materialdialog: false,
+        selectionList: [],
+        total: 0,
+        searchKey: null,
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            fixed: 'left',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '物品编码',
+            align: 'center'
+          },
+          {
+            prop: 'name',
+            label: '物品名称',
+            align: 'center'
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center'
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center'
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center'
+          },
+          {
+            type: 'selection',
+            width: 55,
+            align: 'center',
+            fixed: 'right',
+            reserveSelection: true
+          }
+        ]
+      };
+    },
+    watch: {
+      selectionList (newVal, oldVal) {
+        console.log(newVal, oldVal);
+        if (newVal.length < oldVal.length) {
+          const arr = oldVal.filter(
+            (item) => !newVal.find((p) => p.id === item.id)
+          );
+
+          this.memoList = this.memoList.filter(
+            (item) => !arr.find((p) => p.id === item.id)
+          );
+        }
+      }
+    },
+    methods: {
+      open (memoList) {
+        this.memoList = memoList;
+        this.materialdialog = true;
+        if (this.current?.id) {
+          this.reload();
+        }
+      },
+      handleNodeClick (info) {
+        this.current = info;
+        this.reload();
+      },
+      // 获取根节点id
+      setRootId (id) {
+        this.rootId = id;
+      },
+      handleDone ({ data }) {
+        if (this.memoList.length && data.length) {
+          this.$nextTick(() => {
+            this.$refs.table.setSelectedRowKeys(
+              this.memoList.map((i) => i.materialId)
+            );
+          });
+        }
+      },
+      selectionChange (...rest) {
+        console.log(rest);
+      },
+      handleClose () {
+        this.materialdialog = false;
+        this.searchKey = '';
+      },
+
+      datasource ({ page, limit }) {
+        return getList({
+          pageNum: page,
+          size: limit,
+          searchKey: this.searchKey
+        });
+      },
+      reload () {
+        this.$refs.table.reload();
+      },
+      // 弹窗 - 按关键字搜索
+      searchByKeyWords () {
+        this.reload();
+      },
+      // 重置
+      reset () {
+        this.searchKey = '';
+        this.reload();
+      },
+      selected () {
+        if (!this.selectionList.length) {
+          return this.$message.error('请选择物料!');
+        }
+
+        this.$emit('success', [...this.selectionList, ...this.memoList]);
+
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+  }
+  .table_col {
+    padding-left: 10px;
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 121 - 0
src/views/produceOrder/components/catogaryDialog.vue

@@ -0,0 +1,121 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    title="创建工单"
+    width="65vw"
+    append-to-body
+  >
+    <div class="search-box">
+      编码/名称
+      <el-input placeholder="请输入" v-model="searchKey"></el-input>
+    </div>
+    <!-- 数据表格 -->
+    <ele-pro-table
+      ref="tableRef"
+      :columns="columns"
+      :key="categoryLevelId"
+      @done="handleDone"
+      row-key="id"
+      cache-key="materialDialogtable"
+      :datasource="datasource"
+      :current.sync="current"
+      highlight-current-row
+      height="45vh"
+    >
+    </ele-pro-table>
+    <div class="footer" slot="footer">
+      <el-button @click="cancel">取消</el-button>
+      <el-button @click="confirm" type="primary">确定</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import { getList } from '@/api/classifyManage/itemInformation';
+  export default {
+    data () {
+      return {
+        visible: false,
+        current: null,
+        callback: null,
+        categoryLevelId: '',
+        searchKey: ''
+      };
+    },
+    computed: {
+      columns () {
+        const list = [
+          {
+            label: '编码',
+            prop: 'code'
+          },
+          {
+            label: '名称',
+            prop: 'name'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum'
+          }
+        ];
+        return list;
+      }
+    },
+    methods: {
+      open (categoryLevelId, memo, callback) {
+        this.categoryLevelId = categoryLevelId;
+        this.memo = memo;
+        this.callback = callback;
+        this.visible = true;
+      },
+      reload () {
+        this.$refs.tableRef.reload();
+      },
+      handleDone ({ data }) {
+        if (this.memo?.id) {
+          this.$nextTick(() => {
+            this.$refs.tableRef.setCurrentRow(
+              data.find((item) => item.id == this.memo.id)
+            );
+          });
+        }
+      },
+
+      datasource ({ page, limit }) {
+        return getList({
+          pageNum: page,
+          size: limit,
+          isProduct: true,
+          categoryLevelId: this.categoryLevelId,
+          searchKey: this.searchKey
+        });
+      },
+      confirm () {
+        if (!this.current) return this.$message.error('请选择数据');
+
+        this.callback && this.callback(this.current);
+
+        this.cancel();
+      },
+      cancel () {
+        this.$refs.tableRef.setCurrentRow();
+        this.searchKey = '';
+        this.current = null;
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .search-box {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    margin-bottom: 20px;
+    .el-input {
+      width: 220px;
+      margin: 0 32px;
+    }
+  }
+</style>

+ 133 - 0
src/views/produceOrder/components/materialDialog.vue

@@ -0,0 +1,133 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    title="创建工单"
+    width="65vw"
+    append-to-body
+  >
+    <div class="search-box">
+      编码/名称
+      <el-input placeholder="请输入" v-model="searchKey"></el-input>
+    </div>
+    <!-- 数据表格 -->
+    <ele-pro-table
+      ref="tableRef"
+      :columns="columns"
+      @done="handleDone"
+      row-key="id"
+      toolKit="[ 'size', 'columns', 'fullscreen']"
+      cache-key="materialDialogtable"
+      :datasource="datasourceShow"
+      :current.sync="current"
+      :needPage="false"
+      :initLoad="false"
+      highlight-current-row
+      height="45vh"
+    >
+    </ele-pro-table>
+    <div class="footer" slot="footer">
+      <el-button @click="cancel">取消</el-button>
+      <el-button @click="confirm" type="primary">确定</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import { bomSubListByVersionId } from '@/api/mainData';
+  export default {
+    props: ['params'],
+    data () {
+      return {
+        visible: false,
+        current: null,
+        callback: null,
+        searchKey: '',
+        datasource: []
+      };
+    },
+    computed: {
+      columns () {
+        const list = [
+          {
+            label: '原料编码',
+            prop: 'categoryCode'
+          },
+          {
+            label: '原料名称',
+            prop: 'categoryName'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum'
+          }
+        ];
+        return list;
+      },
+      datasourceShow () {
+        return this.datasource.filter((item) => {
+          if (this.searchKey) {
+            return (
+              item.categoryName.indexOf(this.searchKey) !== -1 ||
+              item.categoryCode.indexOf(this.searchKey) !== -1
+            );
+          }
+          return true;
+        });
+      }
+    },
+    methods: {
+      open (memo, callback) {
+        this.memo = memo;
+        this.callback = callback;
+        this.visible = true;
+
+        this._bomSubListByVersionId();
+      },
+      reload () {
+        this.$refs.tableRef.reload();
+      },
+      handleDone ({ data }) {
+        if (this.memo?.id) {
+          this.$nextTick(() => {
+            this.$refs.tableRef.setCurrentRow(
+              data.find((item) => item.id == this.memo.id)
+            );
+          });
+        }
+      },
+      async _bomSubListByVersionId () {
+        const res = await bomSubListByVersionId({
+          ...this.params
+        });
+
+        this.datasource = res;
+      },
+      confirm () {
+        if (!this.current) return this.$message.error('请选择数据');
+
+        this.callback && this.callback(this.current);
+
+        this.cancel();
+      },
+      cancel () {
+        this.$refs.tableRef.clearSelection();
+        this.searchKey = '';
+        this.current = null;
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .search-box {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    margin-bottom: 20px;
+    .el-input {
+      width: 220px;
+      margin: 0 32px;
+    }
+  }
+</style>

+ 2 - 1
src/views/produceOrder/components/report/Common.vue

@@ -160,7 +160,7 @@
           ></el-input-number
         ></el-descriptions-item>
         <el-descriptions-item label="备注">
-          <el-input></el-input
+          <el-input v-model="workReport.remark"></el-input
         ></el-descriptions-item>
       </el-descriptions>
       <el-descriptions
@@ -220,6 +220,7 @@
           executorId: '',
           executorJobNum: '',
           executorTime: '',
+          remark: '',
           packInfo: {
             packNum: '',
             netWeight: ''

+ 302 - 87
src/views/produceOrder/components/report/Extrusion.vue

@@ -1,24 +1,43 @@
 <template>
-  <el-form :inline="true">
+  <el-form :model="{ categoryMsg, ...workReport }" ref="formRef">
     <div class="message-box">
       <ul>
-        <li> <span class="label">报工次数</span>{{ countMsg.reportNum }}</li>
+        <li> <span class="label">报工次数</span> {{ countMsg.reportNum }}</li>
         <li>
-          <span class="label">累计合格品数量</span
-          >{{ countMsg.standardTotalNum }}</li
+          <span class="label">累计合格品数量</span>
+          {{ countMsg.standardTotalNum }}</li
         >
         <li>
-          <span class="label">累计合格品重量</span
-          >{{ countMsg.standardTotalWeight }}</li
+          <span class="label">累计合格品重量</span>
+          {{ countMsg.standardTotalWeight }}</li
         >
         <li>
-          <span class="label">累计投料重量</span
-          >{{ countMsg.feedProductWeight }}</li
+          <span class="label">累计投料重量</span>
+          {{ countMsg.feedMaterielWeight }}</li
         >
       </ul>
       <div class="right">
-        <el-form-item label="执行人工号"><el-input></el-input></el-form-item>
-        <el-form-item label="执行日期"><el-input></el-input></el-form-item>
+        <el-form-item
+          label="执行人工号"
+          prop="executorJobNum"
+          required
+          label-width="100px"
+          ><personSelectRemote
+            v-model="workReport.executorId"
+            placeholder="请输入"
+            @selfChange="
+              (val, item) => (workReport.executorJobNum = item.jobNumber)
+            "
+        /></el-form-item>
+        <el-form-item label="执行日期" prop="executorTime" label-width="100px"
+          ><el-date-picker
+            v-model="workReport.executorTime"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            type="datetime"
+            format="yyyy-MM-dd HH:mm"
+            placeholder="请选择"
+          ></el-date-picker
+        ></el-form-item>
       </div>
     </div>
     <el-card>
@@ -29,93 +48,208 @@
             label=""
             label-width="0"
             class="w100"
-            prop="packInfo.packNum"
+            prop="categoryMsg.packNum"
           >
-            <el-input v-model="workReport.packInfo.packNum"></el-input>
+            <el-input
+              placeholder="请输入"
+              :value="`${categoryMsg.code}/${categoryMsg.name}`"
+              @click.native="getMaterial"
+            ></el-input>
           </el-form-item>
         </el-descriptions-item>
-        <el-descriptions-item label="原料牌号"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="批次号">kooriookami</el-descriptions-item>
+        <el-descriptions-item label="原料牌号">{{
+          categoryMsg.brandNum
+        }}</el-descriptions-item>
+        <el-descriptions-item label="批次号">
+          <el-select v-model="categoryMsg.batchNo" placeholder="请选择">
+            <el-option
+              v-for="(item, index) in batchList"
+              :key="index"
+              :label="item.batchNum"
+              :value="item.batchNum"
+              @click.native="categoryMsg.totalWeight = item.storageNum"
+            ></el-option>
+          </el-select>
+        </el-descriptions-item>
         <el-descriptions-item label="原料重量(KG)"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="质检项">kooriookami</el-descriptions-item>
-        <el-descriptions-item label="质检标准"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="合格品数量(PCS)"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="合格品重量(KG)"
-          >kooriookami</el-descriptions-item
-        >
+          ><el-input
+            v-model="categoryMsg.totalWeight"
+            placeholder="请输入"
+          ></el-input
+        ></el-descriptions-item>
+        <el-descriptions-item label="质检项" :span="2">{{
+          infoData.qualityItem
+        }}</el-descriptions-item>
+        <el-descriptions-item label="质检标准" :span="3">{{
+          infoData.qualityStandard
+        }}</el-descriptions-item>
+        <el-descriptions-item label="">
+          <span class="label-required after" slot="label">合格品数量(PCS)</span>
+          <el-form-item
+            label=""
+            label-width="0"
+            class="w100"
+            prop="productInfo.standardNum"
+            ><el-input-number
+              class="w100"
+              :controls="false"
+              v-model="workReport.productInfo.standardNum"
+              :min="0"
+              clearable
+            ></el-input-number> </el-form-item
+        ></el-descriptions-item>
+        <el-descriptions-item label=""
+          ><span class="label-required after" slot="label">合格品重量(KG)</span>
+          <el-form-item
+            label=""
+            label-width="0"
+            class="w100"
+            prop="productInfo.standardWeight"
+            ><el-input-number
+              readonly
+              class="w100"
+              :controls="false"
+              :value="
+                (workReport.productInfo.standardWeight =
+                  workReport.productInfo.standardNum *
+                  (infoData.productUnitWeight || 1))
+              "
+              :min="0"
+              clearable
+            ></el-input-number> </el-form-item
+        ></el-descriptions-item>
         <el-descriptions-item label="不合格品数量(PCS)">
-          <el-input>
-            <template slot="append">
-              <el-button type="primary">处置</el-button>
-            </template>
-          </el-input></el-descriptions-item
-        >
+          <el-input-number
+            class="w100"
+            :controls="false"
+            v-model="workReport.productInfo.noStandardNum"
+            :min="0"
+            clearable
+          ></el-input-number>
+        </el-descriptions-item>
         <el-descriptions-item label="不合格品重量(KG)"
-          ><el-input>
-            <template slot="append">
-              <el-button type="primary">处置</el-button>
-            </template>
-          </el-input></el-descriptions-item
-        >
+          ><el-input-number
+            class="w100"
+            readonly
+            :controls="false"
+            :value="
+              (workReport.productInfo.noStandardWeight =
+                workReport.noStandardNum * (infoData.productUnitWeight || 1))
+            "
+            :min="0"
+            clearable
+          ></el-input-number
+        ></el-descriptions-item>
         <el-descriptions-item label="副产品重量(KG)"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="备注" :span="2"
-          >kooriookami</el-descriptions-item
-        >
+          ><el-input-number
+            class="w100"
+            :controls="false"
+            v-model="workReport.productInfo.netWeight"
+            :min="0"
+            clearable
+          ></el-input-number
+        ></el-descriptions-item>
+        <el-descriptions-item label="备注">
+          <el-input v-model="workReport.remark"></el-input
+        ></el-descriptions-item>
       </el-descriptions>
+
       <el-descriptions
         title="设备信息"
+        class="mt-16"
         direction="vertical"
         :column="7"
         border
-        class="mt-16"
       >
-        <el-descriptions-item label="设备编码"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="设备名称"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="规格">kooriookami</el-descriptions-item>
-        <el-descriptions-item label="型号">kooriookami</el-descriptions-item>
-        <el-descriptions-item label="设备位置" :span="3"
-          >kooriookami</el-descriptions-item
-        >
+        <el-descriptions-item label="设备编码">{{
+          workReportDeviceList.code
+        }}</el-descriptions-item>
+        <el-descriptions-item label="设备名称">{{
+          workReportDeviceList.name
+        }}</el-descriptions-item>
+        <el-descriptions-item label="规格">{{
+          workReportDeviceList.specification
+        }}</el-descriptions-item>
+        <el-descriptions-item label="型号">{{
+          workReportDeviceList.model
+        }}</el-descriptions-item>
 
-        <el-descriptions-item label="模具编码/名称" :span="2"
-          >kooriookami</el-descriptions-item
+        <el-descriptions-item label="设备位置">{{
+          workReportDeviceList.path
+        }}</el-descriptions-item>
+        <el-descriptions-item label="操作" :span="2"
+          ><el-link @click="getEquip" type="primary"
+            >更改设备</el-link
+          ></el-descriptions-item
         >
-        <el-descriptions-item label="规格">kooriookami</el-descriptions-item>
-        <el-descriptions-item label="型号">kooriookami</el-descriptions-item>
-        <el-descriptions-item label="冲压次数" :span="3"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="舟皿编码/名称" :span="2"
-          >kooriookami</el-descriptions-item
-        >
-        <el-descriptions-item label="规格">kooriookami</el-descriptions-item>
-        <el-descriptions-item label="槽数">kooriookami</el-descriptions-item>
-        <el-descriptions-item label="数量">kooriookami</el-descriptions-item>
+        <el-descriptions-item label="模具编码/名称"
+          ><el-input
+            class="w100"
+            :value="`${moduleMsg.code}/${moduleMsg.name}`"
+            @click.native="getCategory('5', 'moduleMsg')"
+          ></el-input
+        ></el-descriptions-item>
+        <el-descriptions-item label="规格">{{
+          moduleMsg.specification
+        }}</el-descriptions-item>
+        <el-descriptions-item label="型号">{{
+          moduleMsg.model
+        }}</el-descriptions-item>
+        <el-descriptions-item label="冲压次数" :span="4"
+          ><el-input
+            placeholder="请输入"
+            v-model="moduleMsg.extraField.stampingTimes"
+          ></el-input
+        ></el-descriptions-item>
+        <el-descriptions-item label="舟皿编码/名称"
+          ><el-input
+            :value="`${boatMsg.code}/${boatMsg.name}`"
+            @click.native="getCategory('8', 'boatMsg')"
+          ></el-input
+        ></el-descriptions-item>
+        <el-descriptions-item label="规格">{{
+          boatMsg.specification
+        }}</el-descriptions-item>
+        <el-descriptions-item label="槽数"></el-descriptions-item>
+        <el-descriptions-item label="数量"
+          ><el-input
+            placeholder="请输入"
+            v-model="boatMsg.extraField.num"
+          ></el-input
+        ></el-descriptions-item>
       </el-descriptions>
     </el-card>
+    <equipmentDailog
+      ref="equipmentRef"
+      :isPlan="true"
+      :produceVersionId="infoData.produceVersionId"
+    />
+    <materialDialog
+      ref="materialRef"
+      :params="{
+        taskInstanceId: taskInfo.id,
+        versionId: infoData.produceVersionId
+      }"
+    />
+
+    <catogaryDialog ref="catogaryDialogRef" />
   </el-form>
 </template>
 
 <script>
+  import { realTimeStorage } from '@/api/mainData';
   import personSelectRemote from '@/components/CommomSelect/person-select-remote';
   import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
+  import materialDialog from '../materialDialog.vue';
+  import catogaryDialog from '../catogaryDialog.vue';
   import { reportCount } from '@/api/produceOrder';
   export default {
-    components: { personSelectRemote, equipmentDailog },
+    components: {
+      personSelectRemote,
+      equipmentDailog,
+      materialDialog,
+      catogaryDialog
+    },
     props: {
       infoData: {
         type: Object,
@@ -128,14 +262,20 @@
     },
     data () {
       return {
+        categoryMsg: {
+          batchNo: '',
+          totalWeight: '',
+          brandNum: '',
+          sourceCategoryId: '',
+          rootCategoryLevelId: '1',
+          name: '',
+          code: ''
+        },
         workReport: {
           executorId: '',
           executorJobNum: '',
           executorTime: '',
-          packInfo: {
-            packNum: '',
-            netWeight: ''
-          },
+          remark: '',
           productInfo: {
             standardNum: '',
             standardWeight: '',
@@ -143,13 +283,41 @@
             noStandardWeight: ''
           }
         },
+        // 设备
         workReportDeviceList: {
           code: '',
           name: '',
           path: '',
+          model: '',
+          rootCategoryLevelId: '',
           specification: ''
         },
-        countMsg: {}
+        countMsg: {},
+        // 模具信息
+        moduleMsg: {
+          code: '',
+          name: '',
+          path: '',
+          model: '',
+          rootCategoryLevelId: '',
+          specification: '',
+          extraField: {
+            stampingTimes: ''
+          }
+        },
+        // 舟皿信息
+        boatMsg: {
+          code: '',
+          name: '',
+          path: '',
+          model: '',
+          rootCategoryLevelId: '',
+          specification: '',
+          extraField: {
+            num: ''
+          }
+        },
+        batchList: []
       };
     },
     watch: {
@@ -163,13 +331,35 @@
       }
     },
     methods: {
-      async getReportCount () {
-        const res = await reportCount({
-          taskCode: this.taskInfo.code,
-          workOrderId: this.infoData.id
+      getCategory (id, memo) {
+        this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
+          this[memo].rootCategoryLevelId = res.categoryLevelId;
+          this[memo].code = res.code;
+          this[memo].name = res.name;
+          this[memo].specification = res.specification;
+          this[memo].sourceInstanceId = res.id;
+          if (memo === 'moduleMsg') {
+            this[memo].model = res.modelType;
+            this[memo].extraField.stampingTimes = '';
+          } else {
+            this[memo].extraField.num = '';
+          }
         });
+      },
+      getMaterial () {
+        this.$refs.materialRef.open(this.categoryMsg, (res) => {
+          this.categoryMsg.name = res.categoryName;
+          this.categoryMsg.code = res.categoryCode;
+          this.categoryMsg.sourceCategoryId = res.id;
+          this.categoryMsg.brandNum = res.brandNum;
 
-        this.countMsg = res;
+          realTimeStorage({
+            categoryCode: res.categoryCode,
+            factoryCode: this.infoData.werks || '14T1'
+          }).then((res) => {
+            this.batchList = res;
+          });
+        });
       },
       getEquip () {
         this.$refs.equipmentRef.openSingle(
@@ -177,21 +367,43 @@
           (res) => {
             this.workReportDeviceList.code = res.code;
             this.workReportDeviceList.name = res.name;
-            this.workReportDeviceList.path = res.id;
+            this.workReportDeviceList.model = res.modelType;
+            this.workReportDeviceList.specification = res.specification;
+            this.workReportDeviceList.sourceInstanceId = res.id;
+            this.workReportDeviceList.rootCategoryLevelId =
+              res.rootCategoryLevelId;
+            this.workReportDeviceList.path = res.positionList[0]?.pathName;
           }
         );
       },
-      getMsg () {},
+      async getReportCount () {
+        const res = await reportCount({
+          taskCode: this.taskInfo.code,
+          workOrderId: this.infoData.id
+        });
+
+        this.countMsg = res;
+      },
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
+            const workReportDeviceList = [];
+            if (this.workReportDeviceList.code) {
+              workReportDeviceList.push(this.workReportDeviceList);
+            }
+            if (this.moduleMsg.code) {
+              workReportDeviceList.push(this.moduleMsg);
+            }
+            if (this.boatMsg.code) {
+              workReportDeviceList.push(this.boatMsg);
+            }
             fun({
               checkState: 1,
               workReport: this.workReport,
-              workReportDeviceList: [this.workReportDeviceList]
-            }).then((res) => {
-              console.log(res);
-              this.getMsg();
+              workReportCategoryList: [this.categoryMsg],
+              workReportDeviceList
+            }).then(() => {
+              this.getReportCount();
             });
           }
         });
@@ -205,6 +417,9 @@
     display: flex;
     justify-content: space-between;
     align-items: center;
+    .label {
+      margin-right: 5px;
+    }
     ul {
       list-style: none;
       display: flex;

+ 21 - 14
src/views/produceOrder/report.vue

@@ -102,12 +102,12 @@
       <el-tabs v-model="activeName" type="card">
         <el-tab-pane
           :label="item.name"
-          :name="item.name"
-          v-for="item in tabList"
+          :name="index + ''"
+          v-for="(item, index) in tabList"
           :key="item.id"
         ></el-tab-pane>
-        <el-tab-pane label="挤压成型" name="挤压成型"></el-tab-pane>
-        <!--<el-tab-pane label="自然干燥" name="自然干燥"></el-tab-pane>
+        <!--<el-tab-pane label="挤压成型" name="挤压成型"></el-tab-pane>
+        <el-tab-pane label="自然干燥" name="自然干燥"></el-tab-pane>
         <el-tab-pane label="升温干燥" name="升温干燥"></el-tab-pane>
         <el-tab-pane label="半加定长" name="半加定长"></el-tab-pane>
         <el-tab-pane label="备炉" name="备炉"></el-tab-pane>
@@ -117,11 +117,12 @@
         <el-tab-pane label="入库" name="入库"></el-tab-pane> -->
       </el-tabs>
       <components
+        v-if="tabList.length"
         ref="reportRef"
-        :is="componentsList[activeName] || 'Common'"
+        :is="componentsList[tabList[activeName].name] || 'Common'"
         :key="activeName"
         :infoData="infoData"
-        :taskInfo="tabList.find((item) => item.name === activeName)"
+        :taskInfo="tabList[activeName]"
       ></components>
       <div class="footer">
         <el-button type="primary" @click="handleReport">一键报工</el-button>
@@ -158,7 +159,7 @@
       return {
         infoData: {},
         descriptionsShow: true,
-        activeName: '',
+        activeName: '0',
         tabList: [],
         componentsList: {
           挤压成型: 'Extrusion',
@@ -179,21 +180,28 @@
     methods: {
       handleReport () {
         this.$refs.reportRef.report(async (data) => {
-          const curIndex = this.tabList.findIndex(
-            (item) => item.name === this.activeName
-          );
-
           data.workReportCategoryList = data.workReportCategoryList || [
             {
               code: this.infoData.productCode,
               name: this.infoData.productName,
+              rootCategoryLevelId: '1',
               batchNo: '',
               brandNum: this.infoData.brandNo
             }
           ];
+          if (data.workReport) {
+            data.workReport.taskCode = this.tabList[this.activeName].code;
+            data.workReport.taskName = this.tabList[this.activeName].name;
+            data.workReport.taskSort = this.tabList[this.activeName].sortNum;
+            data.workReport.workOrderId = this.infoData.id;
+          }
+
           const params = {
+            isSapReportState: 0,
             lastTaskCode:
-              this.tabList[curIndex > 0 ? curIndex - 1 : curIndex].code,
+              this.tabList[
+                this.activeName > 0 ? this.activeName - 1 : this.activeName
+              ].code,
             ...data
           };
           await report(params);
@@ -207,8 +215,7 @@
         const res1 = await getTaskListById(res.produceVersionId);
 
         this.tabList = res1;
-        console.log(this.tabList);
-        this.activeName = res1[0]?.name || '';
+        this.activeName = '0';
       }
     }
   };

+ 2 - 2
vue.config.js

@@ -33,10 +33,10 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.3.51:18086', // 测试
 
-        // target: 'http://192.168.3.35:8080', // kang杨威
+        target: 'http://192.168.3.35:8080', // kang杨威
         // target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
-        target: 'http://192.168.3.33:8080', // 谢一平
+        // target: 'http://192.168.3.33:8080', // 谢一平
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {