From b51361558da5e1763bc37a0ca7195ce7bc5eb251 Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期一, 22 一月 2024 18:39:05 +0800
Subject: [PATCH] add生产报表-拧紧数据

---
 jcdm-ui/src/views/main/om/productionOrde/index.vue |  152 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 109 insertions(+), 43 deletions(-)

diff --git a/jcdm-ui/src/views/main/om/productionOrde/index.vue b/jcdm-ui/src/views/main/om/productionOrde/index.vue
index fbc7e84..249fae6 100644
--- a/jcdm-ui/src/views/main/om/productionOrde/index.vue
+++ b/jcdm-ui/src/views/main/om/productionOrde/index.vue
@@ -21,7 +21,6 @@
         </el-select>
       </el-form-item>
       <el-form-item style="float: right">
-        <el-button type="warning" icon="el-icon-download" size="mini" @click="getProductionNotice">鎺ユ敹</el-button>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
         <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">楂樼骇鏌ヨ</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
@@ -31,23 +30,20 @@
       <el-form-item style="margin-left: 14px" label="浜у搧缂栧彿" prop="productCode">
         <el-input v-model="queryParams.productCode" placeholder="璇疯緭鍏ヤ骇鍝佺紪鍙�" clearable @keyup.enter.native="handleQuery"/>
       </el-form-item>
-      <el-form-item label="璁㈠崟缂栧彿" prop="salesOrderCode">
-        <el-input v-model="queryParams.salesOrderCode" placeholder="璇疯緭鍏ヨ鍗曠紪鍙�" clearable @keyup.enter.native="handleQuery"/>
+      <el-form-item label="鏈哄瀷" prop="typeZ">
+        <el-input v-model="queryParams.typeZ" placeholder="璇疯緭鍏ユ満鍨�" clearable @keyup.enter.native="handleQuery"/>
       </el-form-item>
-      <el-form-item label="杞﹂棿缂栧彿" prop="workshopCode">
-        <el-input v-model="queryParams.workshopCode" placeholder="璇疯緭鍏ヨ溅闂寸紪鍙�" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item label="浜х嚎缂栧彿" prop="lineCode">
-        <el-input v-model="queryParams.lineCode" placeholder="璇疯緭鍏ヤ骇绾跨紪鍙�" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item style="margin-left: 7px" label-width="80" label="浜у搧BOM" prop="bomCode">
-        <el-input v-model="queryParams.bomCode" placeholder="璇疯緭鍏ヤ骇鍝丅OM" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item label="宸ヨ壓娴佺▼" prop="routeCode">
-        <el-input v-model="queryParams.routeCode" placeholder="璇疯緭鍏ュ伐鑹烘祦绋�" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item label="宸ヨ壓閰嶆柟" prop="recipeCode">
-        <el-input v-model="queryParams.recipeCode" placeholder="璇疯緭鍏ュ伐鑹洪厤鏂�" clearable @keyup.enter.native="handleQuery"/>
+      <el-form-item label-width="130" label="閫氱煡鍗曠敓鎴愭棩鏈�" prop="dateConditions">
+        <el-date-picker
+          v-model="queryParams.dateConditions"
+          type="datetimerange"
+          :picker-options="pickerOptions"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          range-separator="鑷�"
+          start-placeholder="寮�濮嬫棩鏈�"
+          end-placeholder="缁撴潫鏃ユ湡"
+          align="right">
+        </el-date-picker>
       </el-form-item>
     </el-form>
     </el-card>
@@ -96,31 +92,41 @@
           v-hasPermi="['om:productionOrde:export']"
         >瀵煎嚭</el-button>
       </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          plain-->
+<!--          icon="el-icon-upload2"-->
+<!--          :disabled="move"-->
+<!--          size="mini"-->
+<!--          @click="moveUp(val => val, 'up')"-->
+<!--        >涓婄Щ</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          plain-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          :disabled="move"-->
+<!--          @click="moveUp(val => val, 'down')"-->
+<!--        >涓嬬Щ</el-button>-->
+<!--      </el-col>-->
       <el-col :span="1.5">
         <el-button
-          type="warning"
+          type="success"
           plain
-          icon="el-icon-upload2"
-          :disabled="move"
+          icon="el-icon-wind-power"
           size="mini"
-          @click="moveUp(val => val, 'up')"
-        >涓婄Щ</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          :disabled="move"
-          @click="moveUp(val => val, 'down')"
-        >涓嬬Щ</el-button>
+          @click="getProductionNotice"
+          v-hasPermi="['om:productionOrde:receive']"
+        >鎺ユ敹</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
           type="primary"
           plain
-          icon="el-icon-createUpdate"
+          icon="el-icon-edit"
           size="mini"
           :disabled="single"
           @click="CreatehandleUpdate"
@@ -137,7 +143,7 @@
         </el-table-column>
         <el-table-column label="鐢熶骇璁㈠崟" width="160" align="center">
           <template slot-scope="scope">
-            <router-link :to="{path: '/main/workReport-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
+            <router-link :to="{path: '/main/orderScheduling-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
               <span>{{ scope.row.workOrderNo }}</span>
             </router-link>
           </template>
@@ -146,7 +152,7 @@
         </el-table-column>
         <el-table-column label="闇�姹傛暟閲�" align="center" prop="planQty">
         </el-table-column>
-        <el-table-column label="浜у搧缂栧彿" width="140" align="center" prop="productCode">
+        <el-table-column label="浜у搧缂栧彿" width="150" align="center" prop="productCode">
         </el-table-column>
 <!--        <el-table-column label="瀹為檯鏁伴噺" width="160" align="center" prop="actualQty">-->
 <!--        </el-table-column>-->
@@ -341,9 +347,9 @@
         <i class="el-icon-s-order"></i>
         {{titleName}}
       </span>
-      <el-form ref="form" inline  :model="form" :rules="CreateRules" label-width="80px">
-        <el-form-item   label="绉嶇被" prop="typeZ">
-          <el-input disabled v-model="form.typeZ"  placeholder="璇疯緭鍏ョ绫�" />
+      <el-form ref="form" inline  :model="form" :rules="CreateRules" label-width="100px">
+        <el-form-item   label="鏈哄瀷" prop="typeZ">
+          <el-input disabled v-model="form.typeZ"  placeholder="璇疯緭鍏ユ満鍨�" />
         </el-form-item>
         <el-form-item  label="鏃ユ湡" prop="dateTime">
           <el-date-picker clearable
@@ -357,10 +363,10 @@
           <el-input v-model="form.dateTimeRule"/>
         </el-form-item>
         <el-form-item   label="璧峰缂栧彿" prop="startCode">
-          <el-input type="number" v-model="form.startCode"  placeholder="璇疯緭鍏ヨ捣濮嬬紪鍙�" @input="handleCodeChange"/>
+          <el-input type="number"   :maxlength="3"  :pattern="'[0-9]{3}'" v-model="form.startCode"  placeholder="璇疯緭鍏ヨ捣濮嬬紪鍙�" @input="handleCodeChange"/>
         </el-form-item>
         <el-form-item   label="璧锋缂栧彿" prop="startEndCode">
-          <el-input disabled v-model="form.startEndCode"/>
+          <el-input type="textarea" disabled v-model="form.startEndCode"/>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -388,6 +394,7 @@
   generateNumbers
 } from "@/api/main/bs/orderScheduling/orderScheduling";
 import {listMaterial} from "@/api/main/bs/material/material";
+import {listModelNumber} from "@/api/main/bs/modelNumber/modelNumber";
 
 export default {
   name: "ProductionOrde",
@@ -451,6 +458,7 @@
         flag: null,
         adds:null,
         productionNotice: null,
+        dateConditions: [],
       },
       materialQueryParams: {
         pageNum: 1,
@@ -493,6 +501,33 @@
         year: '',
       },
       markNo: '',
+      pickerOptions: {
+        shortcuts: [{
+          text: '鏈�杩戜竴鍛�',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '鏈�杩戜竴涓湀',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '鏈�杩戜笁涓湀',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+            picker.$emit('pick', [start, end]);
+          }
+        }]
+      },
     };
   },
   created() {
@@ -532,15 +567,18 @@
         //鏃�
         dateTimeRule = dateTimeRule + day;
         dateTimeRule = dateTimeRule + this.markNo;
-        this.form.dateTimeRule = dateTimeRule;
+        this.form.dateTimeRule = dateTimeRule;//姝ゅ璧嬪�间笉鍔犳満鍨�
+        dateTimeRule = dateTimeRule + this.form.typeZ;//姝ゅ鍔犳満鍨嬶紝椤哄簭涓嶈兘棰犲��
+
         //璧嬪�艰捣濮嬬紪鐮�
-        this.form.startEndCode = dateTimeRule +  startCode + "----" + dateTimeRule + String(parseInt(startCode) + parseInt(planQty)-1).padStart(3, '0') ;
+        this.form.startEndCode = dateTimeRule +  String(parseInt(startCode)).padStart(3, '0') + "         " + dateTimeRule + String(parseInt(startCode) + parseInt(planQty)-1).padStart(3, '0') ;
       }
     },
 
     getProductionNotice(){
       getProductionNotice(this.queryParams).then(response => {
-        this.$modal.msgSuccess("鎺ユ敹鎴愬姛");
+
+        this.$modal.msgSuccess(response.msg);
         this.queryParams = {}
         this.getList();
       });
@@ -720,6 +758,7 @@
         this.materialQueryParams.materialCode = response.data.productCode;
         listMaterial(this.materialQueryParams).then(response => {
           this.markNo = response.rows[0].mark
+          this.form.typeL = response.rows[0].typeL;
         });
         this.form = response.data;
         this.Createopen = true;
@@ -762,6 +801,33 @@
 
     /** 鐢熸垚绠变綋鏉$爜鎻愪氦鎸夐挳 */
     submitFormForBoxCode() {
+      let startCode = parseInt(this.form.startCode);
+      let queryParams = {
+        model: this.form.typeZ,
+        modelDate: this.form.dateTimeRule,
+      }
+      if(startCode>999){
+        this.$message.error('璧峰缂栧彿瓒呭嚭鏈�澶ц寖鍥达紝璇疯緭鍏�1-999鐨勬暟瀛楋紒');
+        return;
+      }else if(startCode<1){
+        this.$message.error('璧峰缂栧彿瓒呭嚭鏈�灏忚寖鍥达紝璇疯緭鍏�1-999鐨勬暟瀛楋紒');
+        return;
+      }
+      listModelNumber(queryParams).then(response => {
+        if(response.rows.length === 0){
+          this.saveBoxCode()
+        }else {
+          let maxNumValue = response.rows[0].maxnumValue;
+          if(startCode<=maxNumValue){
+            this.$message.error('绠变綋鏉$爜閲嶅锛岃閲嶆柊杈撳叆璧峰缂栧彿锛�');
+          }else {
+            this.saveBoxCode()
+          }
+        }
+      });
+    },
+
+    saveBoxCode(){
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {

--
Gitblit v1.9.3