From 914b02b10644ae73acdc2edfccc985f0ee5896cc Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期五, 17 十一月 2023 17:46:18 +0800
Subject: [PATCH] 2023-11-17 车间订单中工单添加

---
 src/views/plan/manufacturingorder/index.vue         |   13 +
 src/views/plan/operationtask/operationtask-form.vue |  490 ++++++++++++++++-------------------------------------
 2 files changed, 160 insertions(+), 343 deletions(-)

diff --git a/src/views/plan/manufacturingorder/index.vue b/src/views/plan/manufacturingorder/index.vue
index 568bf63..7d24f78 100644
--- a/src/views/plan/manufacturingorder/index.vue
+++ b/src/views/plan/manufacturingorder/index.vue
@@ -48,7 +48,7 @@
             </el-dropdown-menu>
           </el-dropdown>
 
-          <el-dropdown
+          <!-- <el-dropdown
             v-if="permissions.manufacturingorder_issue_material"
             @command="issueMaterialHandleCommand"
             style="margin-left:10px;"
@@ -64,7 +64,7 @@
                 >{{ item.label }}</el-dropdown-item
               >
             </el-dropdown-menu>
-          </el-dropdown>
+          </el-dropdown> -->
           <!-- <el-button
             v-if="permissions.manufacturingorder_orderto_ifs"
             @click="commitOrderIfs()"
@@ -110,8 +110,8 @@
             @click="updateOrderNo"
             type="primary"
             style="margin-left:10px;"
-            >鏇存柊璁㈠崟鍙� -->
-          </el-button>
+            >鏇存柊璁㈠崟鍙� 
+          </el-button>-->
         </template>
       </ttable>
       <customerorder
@@ -1658,3 +1658,8 @@
   }
 }
 </script>
+<style lang="scss">
+.gantt-info {
+  display: none !important;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/plan/operationtask/operationtask-form.vue b/src/views/plan/operationtask/operationtask-form.vue
index 1b441e0..50f0caa 100644
--- a/src/views/plan/operationtask/operationtask-form.vue
+++ b/src/views/plan/operationtask/operationtask-form.vue
@@ -1,223 +1,125 @@
 <template>
-  <el-dialog
-    :title="!dataForm.id ? '鏂板' : '淇敼'"
-    :fullscreen="isFullScreen"
-    :close-on-click-modal="false"
-    :visible.sync="visible"
-  >
+  <el-dialog :title="!dataForm.id ? '鏂板' : '淇敼'" :fullscreen="isFullScreen" :close-on-click-modal="false"
+    :visible.sync="visible">
     <el-tabs type="border-card" ref="resource">
       <el-tab-pane label="宸ュ崟">
         <el-row>
           <el-col :span="12">
             <div class="mod-config">
               <basic-container>
-                <el-form
-                  :model="dataForm"
-                  :rules="dataRule"
-                  ref="dataForm"
-                  label-width="100px"
-                  class="l-mes"
-                  :disabled="!editable"
-                >
+                <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="100px" class="l-mes"
+                  :disabled="!editable">
                   <el-row>
                     <el-row :gutter="10">
                       <el-col :span="8">
                         <el-form-item label="宸ュ崟缂栧彿" prop="optaskNo">
-                          <el-input
-                            v-model="dataForm.optaskNo"
-                            placeholder="宸ュ崟缂栧彿"
-                            disabled
-                          ></el-input>
+                          <el-input v-model="dataForm.optaskNo" placeholder="宸ュ崟缂栧彿" disabled></el-input>
                         </el-form-item>
                       </el-col>
                       <el-col :span="8">
                         <el-form-item label="宸ヨ壓" prop="routingNo">
-                          <el-input
-                            v-model="dataForm.routingNo"
-                            placeholder="宸ヨ壓"
-                            disabled
-                          >
-                            <el-button
-                              disabled
-                              slot="append"
-                              icon="el-icon-search"
-                              @click="openRoutingDialog()"
-                            ></el-button>
+                          <el-input v-model="dataForm.routingNo" placeholder="宸ヨ壓" disabled>
+                            <!-- <el-button slot="append" icon="el-icon-search" disabled @click="openRoutingDialog"></el-button> -->
                           </el-input>
                         </el-form-item>
                       </el-col>
                       <el-col :span="8">
                         <el-form-item label="绫诲瀷" prop="operationTaskType">
-                          <el-select
-                            v-model="dataForm.operationTaskType"
-                            placeholder="璇烽�夋嫨绫诲瀷"
-                            style="width:100%"
-                          >
-                            <el-option
-                              v-for="(item, index) in workshopTypeOptions"
-                              :label="item.label"
-                              :value="item.value"
-                              :key="index"
-                            >
+                          <el-select v-model="dataForm.operationTaskType" placeholder="璇烽�夋嫨绫诲瀷" style="width:100%">
+                            <el-option v-for="(item, index) in workshopTypeOptions" :label="item.label"
+                              :value="item.value" :key="index">
                             </el-option>
                           </el-select>
                         </el-form-item>
                       </el-col>
                     </el-row>
                     <el-row :gutter="10">
-                      <el-col :span="8">
+                      <!-- <el-col :span="8">
                         <el-form-item label="搴撲綅" prop="locationId">
-                          <el-select
-                            v-model="dataForm.locationId"
-                            filterable
-                            placeholder="璇烽�夋嫨搴撲綅"
-                            style="width:100%"
-                            clearable
-                          >
-                            <el-option
-                              v-for="(item, index) in locationOptions"
-                              :label="item.locName"
-                              :value="item.id"
-                              :key="index"
-                            >
+                          <el-select v-model="dataForm.locationId" filterable placeholder="璇烽�夋嫨搴撲綅" style="width:100%"
+                            clearable>
+                            <el-option v-for="(item, index) in locationOptions" :label="item.locName" :value="item.id"
+                              :key="index">
                             </el-option>
                           </el-select>
                         </el-form-item>
-                      </el-col>
+                      </el-col> -->
                       <el-col :span="8">
                         <el-form-item label="瀹屾垚鏁伴噺" prop="completedQuantity">
-                          <el-input
-                            v-model="dataForm.completedQuantity"
-                            placeholder="瀹屾垚鏁伴噺"
-                          ></el-input>
+                          <el-input v-model="dataForm.completedQuantity" placeholder="瀹屾垚鏁伴噺"></el-input>
                         </el-form-item>
                       </el-col>
                       <el-col :span="8">
-                        <el-form-item
-                          label="瀹為檯寮�濮嬫椂闂�"
-                          prop="actualStartDate"
-                        >
-                          <el-date-picker
-                            v-model="dataForm.actualStartDate"
-                            style="width: 100%; color: red"
-                            type="datetime"
-                            placeholder="瀹為檯寮�濮嬫椂闂�"
-                            value-format="yyyy-MM-dd HH:mm:ss"
-                          >
+                        <el-form-item label="瀹為檯寮�濮嬫椂闂�" prop="actualStartDate">
+                          <el-date-picker v-model="dataForm.actualStartDate" style="width: 100%; color: red"
+                            type="datetime" placeholder="瀹為檯寮�濮嬫椂闂�" value-format="yyyy-MM-dd HH:mm:ss">
                           </el-date-picker>
                         </el-form-item>
                       </el-col>
                     </el-row>
                     <el-row :gutter="10">
                       <el-col :span="8">
-                        <el-form-item
-                          label="瀹為檯瀹屾垚鏃堕棿"
-                          prop="actualFinishDate"
-                        >
-                          <el-date-picker
-                            v-model="dataForm.actualFinishDate"
-                            style="width: 100%"
-                            type="datetime"
-                            placeholder="瀹為檯瀹屾垚鏃堕棿"
-                            value-format="yyyy-MM-dd HH:mm:ss"
-                          >
+                        <el-form-item label="瀹為檯瀹屾垚鏃堕棿" prop="actualFinishDate">
+                          <el-date-picker v-model="dataForm.actualFinishDate" style="width: 100%" type="datetime"
+                            placeholder="瀹為檯瀹屾垚鏃堕棿" value-format="yyyy-MM-dd HH:mm:ss">
                           </el-date-picker>
                         </el-form-item>
                       </el-col>
                       <el-col :span="8">
                         <el-form-item label="宸ュ崟绫诲瀷" prop="combineState">
-                          <el-select
-                            v-model="dataForm.combineState"
-                            filterable
-                            placeholder="璇烽�夋嫨宸ュ崟绫诲瀷"
-                            style="width:100%"
-                            clearable
-                          >
-                            <el-option
-                              v-for="(item, index) in combineStateOptions"
-                              :label="item.label"
-                              :value="item.value"
-                              :key="index"
-                            >
+                          <el-select v-model="dataForm.combineState" filterable placeholder="璇烽�夋嫨宸ュ崟绫诲瀷" style="width:100%"
+                            clearable>
+                            <el-option v-for="(item, index) in combineStateOptions" :label="item.label"
+                              :value="item.value" :key="index">
                             </el-option>
                           </el-select>
                         </el-form-item>
                       </el-col>
                       <el-col :span="8">
                         <el-form-item label="浼樺厛绾�" prop="priority">
-                          <el-input
-                            v-model="dataForm.priority"
-                            placeholder="浼樺厛绾�"
-                          ></el-input>
+                          <el-input v-model="dataForm.priority" placeholder="浼樺厛绾�"></el-input>
                         </el-form-item>
                       </el-col>
                     </el-row>
                     <el-row :gutter="10">
-                      <el-col :span="8">
+                      <!-- <el-col :span="8">
                         <el-form-item label="璁″垝鏁伴噺2" prop="splannedQuantity">
-                          <el-input
-                            v-model="dataForm.splannedQuantity"
-                            placeholder="璁″垝鏁伴噺2"
-                            style="width:calc(100% - 20px)"
-                          ></el-input>
+                          <el-input v-model="dataForm.splannedQuantity" placeholder="璁″垝鏁伴噺2"
+                            style="width:calc(100% - 20px)"></el-input>
                           <span>{{ dataForm.sunit }}</span>
                         </el-form-item>
                       </el-col>
                       <el-col :span="8">
                         <el-form-item label="鐩樻暟" prop="discNum">
-                          <el-input
-                            v-model="dataForm.discNum"
-                            placeholder="鐩樻暟"
-                            disabled
-                          ></el-input>
+                          <el-input v-model="dataForm.discNum" placeholder="鐩樻暟"></el-input>
                         </el-form-item>
                       </el-col>
                       <el-col :span="8">
                         <el-form-item label="鐢熶骇宸ユ椂瀹氶" prop="hourQuota">
-                          <el-input
-                            v-model="dataForm.hourQuota"
-                            placeholder="鐢熶骇宸ユ椂瀹氶"
-                          ></el-input>
+                          <el-input v-model="dataForm.hourQuota" placeholder="鐢熶骇宸ユ椂瀹氶"></el-input>
                         </el-form-item>
-                      </el-col>
+                      </el-col> -->
                     </el-row>
                     <el-row :gutter="10">
-                      <el-col :span="8">
+                      <!-- <el-col :span="8">
                         <el-form-item label="杞藉叿瑙勬牸" prop="reelSpec">
-                          <el-input
-                            v-model="dataForm.reelSpec"
-                            placeholder="杞藉叿瑙勬牸"
-                          ></el-input>
+                          <el-input v-model="dataForm.reelSpec" placeholder="杞藉叿瑙勬牸"></el-input>
                         </el-form-item>
-                      </el-col>
-                      <el-col :span="8">
+                      </el-col> -->
+                      <!-- <el-col :span="8">
                         <el-form-item label="鍒堕�犲睘鎬�" prop="manufactureAttr">
-                          <el-select
-                            v-model="dataForm.manufactureAttr"
-                            filterable
-                            placeholder="璇烽�夋嫨鍒堕�犲睘鎬�"
-                            style="width:100%"
-                            disabled
-                          >
-                            <el-option
-                              v-for="(item, index) in manufactureAttrs"
-                              :label="item.label"
-                              :value="item.value"
-                              :key="index"
-                            >
+                          <el-select v-model="dataForm.manufactureAttr" filterable placeholder="璇烽�夋嫨鍒堕�犲睘鎬�"
+                            style="width:100%">
+                            <el-option v-for="(item, index) in manufactureAttrs" :label="item.label" :value="item.value"
+                              :key="index">
                             </el-option>
                           </el-select>
                         </el-form-item>
-                      </el-col>
+                      </el-col> -->
                       <el-col :span="8">
                         <el-form-item label="澶囨敞" prop="remark">
-                          <el-input
-                            type="textarea"
-                            :rows="2"
-                            autosize
-                            v-model="dataForm.remark"
-                            placeholder="澶囨敞"
-                          ></el-input>
+                          <el-input type="textarea" :rows="2" autosize v-model="dataForm.remark"
+                            placeholder="澶囨敞"></el-input>
                         </el-form-item>
                       </el-col>
                     </el-row>
@@ -229,75 +131,36 @@
           <el-col :span="12">
             <div class="mod-config">
               <basic-container>
-                <el-form
-                  :model="dataForm"
-                  :rules="dataRule"
-                  ref="dataForm"
-                  label-width="100px"
-                  class="l-mes"
-                >
+                <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="100px" class="l-mes">
                   <el-row>
                     <el-row :gutter="10">
                       <el-col :span="11">
                         <el-form-item label="宸ュ簭" prop="moRoutingOperationId">
-                          <el-select
-                            v-model="dataForm.moRoutingOperationId"
-                            :disabled="!editable"
-                            filterable
-                            placeholder="璇烽�夋嫨宸ュ簭"
-                            style="width:100%"
-                            @change="selectChangedRoutingOperation"
-                          >
-                            <el-option
-                              v-for="(item, index) in routingOptions"
-                              :label="
-                                item.operationName +
-                                  (item.partName ? ' + ' + item.partName : '')
-                              "
-                              :value="item.id"
-                              :key="index"
-                            >
+                          <el-select v-model="dataForm.moRoutingOperationId" :disabled="!editable" filterable
+                            placeholder="璇烽�夋嫨宸ュ簭" style="width:100%" @change="selectChangedRoutingOperation">
+                            <el-option v-for="(item, index) in routingOptions" :label="item.operationName +
+                              (item.partName ? ' + ' + item.partName : '')
+                              " :value="item.id" :key="index">
                             </el-option>
                           </el-select>
                         </el-form-item>
                       </el-col>
                       <el-col :span="7">
                         <el-form-item label="宸ヤ綔涓績" prop="workCenter">
-                          <el-select
-                            v-model="dataForm.workCenter"
-                            :disabled="!editable"
-                            filterable
-                            placeholder="璇烽�夋嫨宸ヤ綔涓績"
-                            style="width:100%"
-                            @change="changeWorkCenter"
-                          >
-                            <el-option
-                              v-for="(item, index) in workCenterOptions"
-                              :label="item.label"
-                              :value="item.value"
-                              :key="index"
-                            >
+                          <el-select v-model="dataForm.workCenter" :disabled="!editable" filterable placeholder="璇烽�夋嫨宸ヤ綔涓績"
+                            style="width:100%" @change="changeWorkCenter">
+                            <el-option v-for="(item, index) in workCenterOptions" :label="item.label" :value="item.value"
+                              :key="index">
                             </el-option>
                           </el-select>
                         </el-form-item>
                       </el-col>
                       <el-col :span="6">
                         <el-form-item label="宸ヤ綔绔�" prop="workstationId">
-                          <el-select
-                            v-model="dataForm.workstationId"
-                            :disabled="!editable"
-                            filterable
-                            placeholder="璇烽�夋嫨宸ヤ綔绔�"
-                            style="width:100%"
-                            clearable
-                            @change="selectLocationByWorkstation"
-                          >
-                            <el-option
-                              v-for="(item, index) in workstations"
-                              :label="item.name"
-                              :value="item.id"
-                              :key="index"
-                            >
+                          <el-select v-model="dataForm.workstationId" :disabled="!editable" filterable
+                            placeholder="璇烽�夋嫨宸ヤ綔绔�" style="width:100%" clearable @change="selectLocationByWorkstation">
+                            <el-option v-for="(item, index) in workstations" :label="item.name" :value="item.id"
+                              :key="index">
                             </el-option>
                           </el-select>
                         </el-form-item>
@@ -306,79 +169,42 @@
                     <el-row :gutter="10">
                       <el-col :span="14">
                         <el-form-item label="璁″垝鏃堕棿" prop="localDateTimes">
-                          <el-date-picker
-                            :class="tattimest ? 'sed' : ''"
-                            v-model="dataForm.localDateTimes"
-                            readonly
-                            type="datetimerange"
-                            range-separator="鑷�"
-                            start-placeholder="寮�濮�"
-                            end-placeholder="缁撴潫"
-                            value-format="yyyy-MM-dd HH:mm:ss"
-                            @change="selectChangedplannedDate"
-                          >
+                          <el-date-picker :class="tattimest ? 'sed' : ''" v-model="dataForm.localDateTimes"
+                            type="datetimerange" range-separator="鑷�" start-placeholder="寮�濮�" end-placeholder="缁撴潫"
+                            value-format="yyyy-MM-dd HH:mm:ss" @change="selectChangedplannedDate">
                           </el-date-picker>
                         </el-form-item>
                       </el-col>
                       <el-col :span="10">
                         <el-form-item label="璁″垝鏁伴噺" prop="plannedQuantity">
-                          <el-input
-                            v-model="dataForm.plannedQuantity"
-                            :disabled="!editable"
-                            placeholder="璁″垝鏁伴噺"
-                            style="width:calc(100% - 30px)"
-                            @change="automaticScheduling()"
-                          ></el-input>
+                          <el-input v-model="dataForm.plannedQuantity" :disabled="!editable" placeholder="璁″垝鏁伴噺"
+                            style="width:calc(100% - 30px)"></el-input>
                           <span>{{ dataForm.unit }}</span>
                         </el-form-item>
-                      </el-col></el-row
-                    >
+                      </el-col></el-row>
                     <el-row :gutter="10">
                       <el-col :span="12">
                         <el-form-item label="闆朵欢" prop="partName">
-                          <el-input
-                            v-model="dataForm.partName"
-                            placeholder="闆朵欢"
-                            disabled
-                          ></el-input>
+                          <el-input v-model="dataForm.partName" placeholder="闆朵欢" disabled></el-input>
                         </el-form-item>
                       </el-col>
                       <el-col :span="6">
                         <el-form-item label="闆朵欢鍙�" prop="partNo">
-                          <el-input
-                            v-model="dataForm.partNo"
-                            placeholder="闆朵欢鍙�"
-                            disabled
-                          ></el-input>
+                          <el-input v-model="dataForm.partNo" placeholder="闆朵欢鍙�" disabled></el-input>
                         </el-form-item>
                       </el-col>
                       <el-col :span="6">
-                        <el-form-item
-                          label="宸ュ崟鎵�闇�鏃堕棿"
-                          prop="taskTheoreticalTime"
-                        >
-                          <el-input
-                            v-model="dataForm.taskTheoreticalTime"
-                            placeholder="宸ュ崟鎵�闇�鏃堕棿"
-                            style="width:calc(100% - 30px)"
-                            disabled
-                          ></el-input>
+                        <el-form-item label="宸ュ崟鎵�闇�鏃堕棿" prop="taskTheoreticalTime">
+                          <el-input v-model="dataForm.taskTheoreticalTime" placeholder="宸ュ崟鎵�闇�鏃堕棿"
+                            style="width:calc(100% - 30px)"></el-input>
                           <span>min</span>
                         </el-form-item>
                       </el-col>
                     </el-row>
                     <el-row :gutter="10">
-                      <span
-                        style="float:right; margin-right:30px; margin-top: 55px"
-                      >
-                        <el-button
-                          type="primary"
-                          :disabled="!editable"
-                          style="margin-left: 12px;  margin-bottom:10px"
-                          @click="automaticScheduling"
-                          >鑷姩鎺掔▼</el-button
-                        ></span
-                      >
+                      <span style="float:right; margin-right:30px; margin-top: 55px">
+                        <el-button type="primary" :disabled="!editable" style="margin-left: 12px;  margin-bottom:10px"
+                          @click="automaticScheduling">鑷姩鎺掔▼</el-button></span>
                     </el-row>
                   </el-row>
                 </el-form>
@@ -415,11 +241,7 @@
               </div>
             </div>
             <div style="margin-top:40px">
-              <gantt-index
-                v-if="isshow"
-                ref="ganttIndex"
-                :dataForm="dataForm"
-              ></gantt-index>
+              <gantt-index v-if="isshow" ref="ganttIndex" :dataForm="dataForm"></gantt-index>
             </div>
           </basic-container>
         </div>
@@ -570,28 +392,17 @@
       <!--          </el-card>-->
       <!--        </el-tab-pane>-->
       <el-tab-pane label="宸ュ崟渚涘簲琛�" v-if="this.dataForm.id">
-        <manufacturing-order
-          :operationId="this.dataForm.id"
-          ref="manufacturing"
-        ></manufacturing-order>
+        <manufacturing-order :operationId="this.dataForm.id" ref="manufacturing"></manufacturing-order>
       </el-tab-pane>
       <el-tab-pane label="宸ュ崟鎵�闇�鐗╂枡" v-if="this.dataForm.id">
-        <operation-supply
-          :operationId="this.dataForm.id"
-          :routingOperationId="this.dataForm.moRoutingOperationId"
-          ref="manufacturing"
-        ></operation-supply>
+        <operation-supply :operationId="this.dataForm.id" :routingOperationId="this.dataForm.moRoutingOperationId"
+          ref="manufacturing"></operation-supply>
       </el-tab-pane>
     </el-tabs>
 
     <span slot="footer" class="dialog-footer">
       <el-button @click="visible = false">鍙栨秷</el-button>
-      <el-button
-        type="primary"
-        :disabled="isSubmit"
-        v-thinclick="`dataFormSubmit`"
-        >纭畾</el-button
-      >
+      <el-button type="primary" :disabled="isSubmit" v-thinclick="`dataFormSubmit`">纭畾</el-button>
       <!--<el-button
         type="primary"
         :disabled="isSubmit"
@@ -600,33 +411,16 @@
         >纭畾骞剁墿鏂欓鐣�</el-button
       >-->
     </span>
-    <routingDialog
-      :currshowlist.sync="showRouting"
-      :mutiSelect="false"
-      :queryParam="queryParam"
-      @listenToRoutingEvent="selectRouting"
-    />
-    <workstationDialog
-      :currshowlist.sync="showWorkstation"
-      @listenToWorkStationEvent="selectWorkstation"
-    />
-    <locationDialog
-      :currshowlist.sync="showLocation"
-      @listenToLocationEvent="selectLocation"
-      :queryParam="queryParamLocation"
-    />
+    <routingDialog :currshowlist.sync="showRouting" :mutiSelect="false" :queryParam="queryParam"
+      @listenToRoutingEvent="selectRouting" />
+    <workstationDialog :currshowlist.sync="showWorkstation" @listenToWorkStationEvent="selectWorkstation" />
+    <locationDialog :currshowlist.sync="showLocation" @listenToLocationEvent="selectLocation"
+      :queryParam="queryParamLocation" />
 
-    <ParamTemplateDialog
-      :currshowlist.sync="showOperationTemplate"
-      @handleSelectionParamTemplateChange="selectOperationTemplate"
-      :paramTemplateObj="templateDefaultObj"
-    />
-    <ParamDialog
-      :currshowlist.sync="showTemplateParam"
-      @handleSelectionChange="selectTemplateParam"
-      :paramSelArr="paramSelArr"
-      :paramSelCol="paramSelCol"
-    />
+    <ParamTemplateDialog :currshowlist.sync="showOperationTemplate"
+      @handleSelectionParamTemplateChange="selectOperationTemplate" :paramTemplateObj="templateDefaultObj" />
+    <ParamDialog :currshowlist.sync="showTemplateParam" @handleSelectionChange="selectTemplateParam"
+      :paramSelArr="paramSelArr" :paramSelCol="paramSelCol" />
   </el-dialog>
 </template>
 
@@ -635,9 +429,11 @@
   border: none;
   border-bottom: 1px solid gainsboro;
 }
+
 /deep/ .sed .el-range-input {
   color: red !important;
 }
+
 .no-padding-top .el-card__body {
   padding: 0px 0px 5px;
 }
@@ -650,6 +446,7 @@
   justify-content: space-between;
   align-items: center;
 }
+
 .status label {
   font-size: 12px;
   font-weight: 500;
@@ -677,7 +474,7 @@
 </style>
 <script>
 import { fetchListExt } from '@/api/warehouse/location'
-import { addObj, getObj, putObj } from '@/api/plan/operationtask'
+import { addObj, getObj, putObj, getTechnologyRouting } from '@/api/plan/operationtask'
 import { getAllWorkstationList, loadWorkstation } from '@/api/basic/workstation'
 import { getOperationParam } from '@/api/basic/template'
 import { getQpaNumber } from '@/api/plan/manufacturingorder'
@@ -691,7 +488,7 @@
   validateSixDecimalNotNull,
   validateSixDecimal
 } from '../../../util/validate'
-import { getObj as getRout } from '@/api/technology/routing'
+import { getObjCopy as getRout } from '@/api/technology/routing'
 import ManufacturingOrder from './manufacturingorder'
 import ganttIndex from './gantt-index'
 import OperationSupply from './operationMaterial'
@@ -734,9 +531,11 @@
       tattimest: false,
       tableData: [],
       dataForm: {
+        ifsOrderNo: '',
         id: 0,
         optaskNo: '',
         routingId: '',
+        moRoutingId: '',
         priority: '',
         routingOperationId: null,
         state: '',
@@ -812,11 +611,11 @@
     }
   },
   computed: {
-    editable: function() {
+    editable: function () {
       if (!this.dataForm.id) {
         return true
       }
-      if (this.dataForm.id && this.dataForm.state == '01pending') {
+      if (this.dataForm.id && this.dataForm.state == '07unsubmit') {
         return true
       }
       return false
@@ -828,11 +627,12 @@
     this.getWrkshopTypeOptions()
     this.getWorkCenterOptions()
     this.getManufactureAttrs('manufacture_attr_type')
+
   },
   mounted() {
     window.addEventListener(
       'popstate',
-      function(e) {
+      function (e) {
         this.visible = false
       }.bind(this),
       false
@@ -844,7 +644,6 @@
         if (newValue) {
           getMoRouting(this.dataForm.moId).then((response) => {
             this.routingList = response.data.data
-            this.routingOptions = this.routingList.moRoutingOperationDTOList
           })
         }
       }
@@ -855,6 +654,7 @@
     // fullscreen() {
     //   this.isFullScreen = !this.isFullScreen
     // },
+    // 鏍规嵁杞﹂棿璁㈠崟鐨処d鏌ヨ宸ヨ壓璺嚎鍙傛暟
     getManufactureAttrs(type) {
       remote(type).then((response) => {
         const code = response.data.code
@@ -894,7 +694,6 @@
       remote('work_center_type').then((response) => {
         if (response.data.code === 0) {
           this.workCenterOptions = response.data.data
-          console.log(this.workCenterOptions)
           this.workCenterOptions.forEach((item) => {
             item.label = '(' + item.value + ') ' + item.label
           })
@@ -927,9 +726,9 @@
       this.dataForm.routingId = routing.id
       this.dataForm.routingNo = routing.routingNo
       this.dataForm.moRoutingOperationId = null
-      //        this.dataForm.partName = routing.partName
-      //        this.dataForm.partId = routing.partId
-      this.$refs.dataForm.validateField('routingNo', (valid) => {})
+      this.routingOptions = routing.operations
+
+      this.$refs.dataForm.validateField('routingNo', (valid) => { })
     },
     openWorkstationDialog() {
       this.showWorkstation = true
@@ -948,7 +747,6 @@
     //   this.showLocation = true
     // },
     selectWorkstation(workstation) {
-      console.log(workstation)
       if (workstation) {
         this.dataForm.workstationId = workstation.id
         this.dataForm.workstationName = workstation.name
@@ -965,7 +763,8 @@
 
     init(id, param, outPutBatchList, qtyPlaned) {
       if (param) {
-        console.log(param)
+				console.log(param);
+        this.dataForm.ifsOrderNo = param.ifsOrderNo
         this.qtyRequired = param.qtyRequired
         this.dataForm.moId = param.id
         this.dataForm.moNo = param.moNo
@@ -974,9 +773,9 @@
         if (param.technologyRoutingId) {
           getMoRouting(this.dataForm.moId).then((response) => {
             this.routingList = response.data.data
-            this.routingOptions = this.routingList.moRoutingOperationDTOList
-            this.dataForm.routingId = this.routingList.technologyRoutingId
+            this.dataForm.routingId = this.routingList.moRoutingId
             this.dataForm.routingNo = this.routingList.routingNo
+            this.routingOptions = this.routingList.moRoutingOperationDTOList
             //              this.dataForm.partName = this.routingList.partName
             //              this.dataForm.partId = this.routingList.partId
             // 鍒堕�犺鍗昮orm鍒涘缓鐨勶紝鑷姩甯﹀嚭宸ュ簭
@@ -1011,6 +810,10 @@
             this.$nextTick(() => {
               this.$refs.ganttIndex.init(this.dataForm.workCenter)
             })
+            getTechnologyRouting(id).then(res => {
+              this.routingOptions = res.data.data.operations
+              this.dataForm.routingNo = res.data.data.routing_no
+            })
           })
         } else {
           this.dataForm.plannedQuantity = qtyPlaned
@@ -1028,7 +831,7 @@
             this.$refs.ganttIndex.init(this.dataForm.workCenter, 1)
           })
         }
-      })
+      }) 
     },
     // 琛ㄥ崟鎻愪氦
     dataFormSubmit() {
@@ -1036,33 +839,43 @@
       this.dataForm.plannedStartDate = this.dataForm.localDateTimes[0]
       this.dataForm.plannedFinishDate = this.dataForm.localDateTimes[1]
       this.$refs.dataForm.validate((valid) => {
-        if (valid) {
-          if (this.dataForm.id) {
-            putObj(this.dataForm)
-              .then((data) => {
-                this.$message.success('淇敼鎴愬姛')
-                this.visible = false
-                this.isSubmit = false
-                this.$emit('refreshDataList')
-              })
-              .catch(() => {
-                this.isSubmit = false
-              })
-          } else {
-            addObj(this.dataForm)
-              .then((data) => {
-                this.$message.success('娣诲姞鎴愬姛')
-                this.visible = false
-                this.isSubmit = false
-                this.$emit('refreshDataList')
-              })
-              .catch(() => {
-                this.isSubmit = false
-              })
-          }
+        // if (valid) {
+        if (this.dataForm.id) {
+					if(this.dataForm.plannedQuantity==0){
+						this.$message.error('璁″垝鏁伴噺涓嶈兘涓�0')
+						this.isSubmit = false
+						return
+					}
+          putObj(this.dataForm)
+            .then((data) => {
+              this.$message.success('淇敼鎴愬姛')
+              this.visible = false
+              this.isSubmit = false
+              this.$emit('refreshDataList')
+            })
+            .catch(() => {
+              this.isSubmit = false
+            })
         } else {
-          this.isSubmit = false
+					if(this.dataForm.plannedQuantity==0){
+						this.$message.error('璁″垝鏁伴噺涓嶈兘涓�0')
+						this.isSubmit = false
+						return
+					}
+          addObj(this.dataForm)
+            .then((data) => {
+              this.$message.success('娣诲姞鎴愬姛')
+              this.visible = false
+              this.isSubmit = false
+              this.$emit('refreshDataList')
+            })
+            .catch(() => {
+              this.isSubmit = false
+            })
         }
+        // } else {
+        //   this.isSubmit = false
+        // }
       })
     },
     // 纭畾骞剁墿鏂欓鐣�
@@ -1075,7 +888,6 @@
           if (this.dataForm.id) {
             putObj(this.dataForm)
               .then((data) => {
-                console.log(data)
                 this.$message.success('淇敼鎴愬姛')
                 this.$router.push({
                   path: '../operationtaskreserved/index',
@@ -1091,7 +903,6 @@
           } else {
             addObj(this.dataForm)
               .then((data) => {
-                console.log(data)
                 this.$message.success('娣诲姞鎴愬姛')
                 this.$router.push({
                   path: '../operationtaskreserved/index',
@@ -1115,9 +926,12 @@
       const routingOperation = this.routingOptions.find(
         (item) => item.id == moRoutingOperationId
       )
-      console.log(routingOperation)
       this.dataForm.partName = routingOperation.partName
       this.dataForm.partNo = routingOperation.partNo
+      // getRout(routingOperation.partId).then(res => {
+      //   this.dataForm.partNo = res.data.data.partNo
+      // })
+
       this.dataForm.partId = routingOperation.partId
       this.dataForm.unit = routingOperation.unit
       this.dataForm.sunit = routingOperation.sunit
@@ -1193,7 +1007,6 @@
 
         this.$nextTick(() => {
           this.$refs.ganttIndex.show(this.operationTasks)
-          console.log(this.operationTasks)
         })
       })
     },
@@ -1215,7 +1028,6 @@
         this.dataForm.workCenter,
         this.dataForm.plannedQuantity
       ).then((res) => {
-        console.log(res)
         this.dataForm.localDateTimes = [
           res.data.data.plannedStartDate,
           res.data.data.plannedFinishDate
@@ -1334,7 +1146,7 @@
           )
         })
 
-        Promise.all(promiseList).then((res) => {})
+        Promise.all(promiseList).then((res) => { })
       }
     },
     // 寮瑰嚭鍩虹鍙傛暟闆嗘ā鏉垮璇濇

--
Gitblit v1.9.3