ysy 1 year ago
parent
commit
0bf821d939

+ 9 - 0
src/api/produce/workOrder.js

@@ -2,6 +2,15 @@ import request from '@/utils/request';
 
 
 
 
 
 
+// 生成编码
+export async function getCode(code) {
+  const res = await request.get(`/main/codemanage/getCode/` + code, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // 工单列表
 // 工单列表
 export async function workorderPage(data) {
 export async function workorderPage(data) {
   const res = await request.post('/pda/mes/workorder/page', data);
   const res = await request.post('/pda/mes/workorder/page', data);

+ 124 - 53
src/views/produce/components/picking/index.vue

@@ -9,40 +9,60 @@
     width="80%"
     width="80%"
   >
   >
     <div v-for="(item, idx) in workList" :key="idx">
     <div v-for="(item, idx) in workList" :key="idx">
-      <div class="table_box">
-        <div class="row">
-          <div class="col">
-            <div class="name">生产工单号</div>
-            <div class="content">{{ item.code }}</div>
-          </div>
-          <div class="col">
-            <div class="name">产品编码</div>
-            <div class="content">{{ item.productCode }}</div>
-          </div>
-          <div class="col">
-            <div class="name">产品名称</div>
-            <div class="content">{{ item.productName }}</div>
-          </div>
-          <div class="col">
-            <div class="name">批号</div>
-            <div class="content">{{ item.batchNo }}</div>
-          </div>
-          <div class="col pd6">
-            <el-button
-              type="primary"
-              size="mini"
-              @click="openPicking(item.id, item)"
-              >新增</el-button
-            >
+      <el-form
+        :ref="`formRef${idx}`"
+        :model="{ pickList: item }"
+        :rules="tableRules"
+        size="mini"
+        label-position="left"
+      >
+        <el-row :gutter="24">
+          <el-col :span="6">
+            <el-form-item label="领料单编号" prop="pickCode" label-width="90px">
+              <el-input v-model="item.pickCode" disabled=""></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="6">
+            <el-form-item label="领料单" prop="pickName" label-width="90px">
+              <el-input v-model="item.pickName"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <div class="table_box">
+          <div class="row">
+            <div class="col">
+              <div class="name">生产工单号</div>
+              <div class="content">{{ item.code }}</div>
+            </div>
+            <div class="col">
+              <div class="name">产品编码</div>
+              <div class="content">{{ item.productCode }}</div>
+            </div>
+            <div class="col">
+              <div class="name">产品名称</div>
+              <div class="content">{{ item.productName }}</div>
+            </div>
+            <div class="col">
+              <div class="name">批号</div>
+              <div class="content">{{ item.batchNo }}</div>
+            </div>
+            <div class="col pd6">
+              <el-button
+                type="primary"
+                size="mini"
+                @click="openPicking(item.id, item)"
+                >新增</el-button
+              >
+            </div>
           </div>
           </div>
         </div>
         </div>
-      </div>
 
 
-      <div>
-        <el-form :ref="`tableRef${item.code}`" :model="{ pickList : item}" :rules="tableRules">
+        <div>
           <el-table
           <el-table
-            ref="table"
-            :ref="`tableRef${item.code}`"
+            :ref="`tableRef${idx}`"
+            class="table_content"
             :max-height="300"
             :max-height="300"
             :data="item.pickList"
             :data="item.pickList"
             tooltip-effect="dark"
             tooltip-effect="dark"
@@ -66,9 +86,7 @@
 
 
             <el-table-column label="数量" prop="demandQuantity">
             <el-table-column label="数量" prop="demandQuantity">
               <template slot-scope="{ row, $index }">
               <template slot-scope="{ row, $index }">
-                <el-form-item :prop="`pickList[${$index}].demandQuantity`"    :rules="{
-                  required: true, message: '请选择押金支付方式', trigger: 'blur'
-                }">
+                <el-form-item>
                   <el-input v-model="row.demandQuantity" size="mini">
                   <el-input v-model="row.demandQuantity" size="mini">
                     <template slot="append">{{ row.unit }}</template>
                     <template slot="append">{{ row.unit }}</template>
                   </el-input>
                   </el-input>
@@ -76,7 +94,7 @@
               </template>
               </template>
             </el-table-column>
             </el-table-column>
 
 
-            <!-- <el-table-column label="领料仓库" prop="warehouseId">
+            <el-table-column label="领料仓库" prop="warehouseId">
               <template slot-scope="{ row, $index }">
               <template slot-scope="{ row, $index }">
                 <div v-if="row.warehouseList">
                 <div v-if="row.warehouseList">
                   <el-select></el-select>
                   <el-select></el-select>
@@ -86,10 +104,18 @@
                   {{ row.pathName }}
                   {{ row.pathName }}
                 </div>
                 </div>
               </template>
               </template>
-            </el-table-column> -->
+            </el-table-column>
+
+            <el-table-column label="操作" fixed="right" width="100px">
+              <template slot-scope="{ $index, row }">
+                <el-link type="danger" @click="removeItem(idx, $index)"
+                  >删除</el-link
+                >
+              </template>
+            </el-table-column>
           </el-table>
           </el-table>
-        </el-form>
-      </div>
+        </div>
+      </el-form>
     </div>
     </div>
 
 
     <template slot="footer">
     <template slot="footer">
@@ -107,7 +133,7 @@
 
 
 <script>
 <script>
   import pickingList from './pickingList.vue';
   import pickingList from './pickingList.vue';
-  import { workorderList } from '@/api/produce/workOrder';
+  import { workorderList, getCode } from '@/api/produce/workOrder';
 
 
   export default {
   export default {
     components: {
     components: {
@@ -145,10 +171,22 @@
         };
         };
         workorderList(param).then((res) => {
         workorderList(param).then((res) => {
           this.workList = res;
           this.workList = res;
-
+          this.getOrderCode();
           this.$forceUpdate();
           this.$forceUpdate();
         });
         });
       },
       },
+
+      getOrderCode() {
+        this.workList.forEach(async (e) => {
+          const data = await getCode('pick_order_code');
+          this.$set(e, 'pickCode', data);
+        });
+      },
+
+      removeItem(idx, index) {
+        this.workList[idx].pickList.splice(index, 1);
+      },
+
       handleClose() {
       handleClose() {
         this.$emit('close', false);
         this.$emit('close', false);
       },
       },
@@ -167,16 +205,45 @@
       },
       },
 
 
       save() {
       save() {
-        let promises = this.workList.map((item) => {
-    
-          return this.$refs[`tableRef${item.code}`][0].validate();
-        });
-        Promise.all(promises).then((results) => {
-          if (results.every((valid) => valid)) {
-            alert('submit1');
-            // 执行提交操作
+        if (this.workList.length > 0) {
+          let bol;
+          let _i;
+          bol = this.workList.every((e, i) => {
+            _i = i;
+            return (
+              Object.prototype.hasOwnProperty.call(e, 'pickList') &&
+              e.pickList.length > 0
+            );
+          });
+
+          if (!bol) {
+            this.$message.warning(
+              `生成工单${this.workList[_i].code}领料不能为空`
+            );
+            return false;
           }
           }
-        });
+        }
+
+        if (this.workList.length > 0) {
+          let name;
+          let bol2;
+          let _i;
+
+          this.workList.forEach((e, i) => {
+            _i = i;
+            bol2 = e.pickList.every((y) => {
+              name = y.name;
+              return Number(y.demandQuantity) > 0;
+            });
+          });
+
+          if (!bol2) {
+            this.$message.warning(
+              `${this.workList[_i].code}的${name}数量不能为空`
+            );
+            return false;
+          }
+        }
       }
       }
     },
     },
 
 
@@ -188,7 +255,7 @@
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   .table_box {
   .table_box {
-    border: 1px solid #acd4b5;
+    border: 1px solid #69c0ff;
     margin: 6px 0;
     margin: 6px 0;
 
 
     &:last-child {
     &:last-child {
@@ -206,8 +273,8 @@
       align-items: center;
       align-items: center;
       min-width: 200px;
       min-width: 200px;
       min-height: 32px;
       min-height: 32px;
-      border-bottom: 1px solid #acd4b5;
-      border-right: 1px solid #acd4b5;
+      border-bottom: 1px solid #69c0ff;
+      border-right: 1px solid #69c0ff;
 
 
       &:last-child {
       &:last-child {
         border-right: none;
         border-right: none;
@@ -219,8 +286,8 @@
         padding: 4px;
         padding: 4px;
         width: 80px;
         width: 80px;
         height: 100%;
         height: 100%;
-        background-color: #fafafa;
-        color: #909399;
+        background-color: #bae7ff;
+        color: #000;
       }
       }
 
 
       .content {
       .content {
@@ -233,6 +300,10 @@
       padding: 0 6px;
       padding: 0 6px;
     }
     }
   }
   }
+
+  .table_content {
+    margin-bottom: 10px;
+  }
 </style>
 </style>
 
 
 <style>
 <style>

+ 19 - 13
src/views/produce/components/picking/pickingList.vue

@@ -26,6 +26,7 @@
           />
           />
         </div>
         </div>
         <!-- 表格 -->
         <!-- 表格 -->
+
         <template v-slot:content>
         <template v-slot:content>
           <ele-pro-table
           <ele-pro-table
             :initLoad="false"
             :initLoad="false"
@@ -36,13 +37,11 @@
             row-key="id"
             row-key="id"
             height="calc(100vh - 350px)"
             height="calc(100vh - 350px)"
             class="dict-table"
             class="dict-table"
-            :key="tableKey"
             :cache-key="tableKey"
             :cache-key="tableKey"
             :row-style="rowStyle"
             :row-style="rowStyle"
             :row-click-checked="true"
             :row-click-checked="true"
             :row-click-checked-intelligent="false"
             :row-click-checked-intelligent="false"
             @update:selection="handleSelectionChange"
             @update:selection="handleSelectionChange"
-            @done="onDone"
           >
           >
             <template v-slot:toolbar>
             <template v-slot:toolbar>
               <el-alert
               <el-alert
@@ -133,6 +132,7 @@
         </template>
         </template>
       </ele-split-layout>
       </ele-split-layout>
     </el-card>
     </el-card>
+
     <div class="btns">
     <div class="btns">
       <el-button type="primary" size="small" @click="selected">选择</el-button>
       <el-button type="primary" size="small" @click="selected">选择</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
@@ -176,6 +176,7 @@
         ],
         ],
 
 
         selection: [],
         selection: [],
+
         allSelection: []
         allSelection: []
       };
       };
     },
     },
@@ -399,18 +400,9 @@
           });
           });
         }
         }
       },
       },
-      handleSelectionChange(data) {
-        this.allSelection = this.allSelection.filter(
-          (f) => f.rootCategoryLevelId != this.rootCategoryLevelId
-        );
-        this.allSelection = [...this.allSelection, ...data];
-      },
 
 
-      onDone() {
-        this.$nextTick(() => {
-          const ids = this.allSelection.map((item) => item.id);
-          this.$refs.table.setSelectedRowKeys(ids);
-        });
+      handleSelectionChange(data) {
+        this.allSelection = data;
       },
       },
 
 
       /* 清空选择 */
       /* 清空选择 */
@@ -441,9 +433,23 @@
           this.$refs.table.reload({ pageNum: 1, where: where });
           this.$refs.table.reload({ pageNum: 1, where: where });
         });
         });
       },
       },
+
+      onDone() {
+        this.$nextTick(() => {
+          this.allSelection.forEach((item) => {
+            this.$refs.table.toggleRowSelection(item, true);
+          });
+        });
+      },
       open(id, item) {
       open(id, item) {
         this.id = id;
         this.id = id;
+        this.allSelection = item.pickList || [];
         this.visible = true;
         this.visible = true;
+        this.$nextTick(() => {
+          this.allSelection.forEach((item) => {
+            this.$refs.table.toggleRowSelection(item, true);
+          });
+        });
       },
       },
 
 
       handleClose() {
       handleClose() {

+ 48 - 45
src/views/produceOrder/components/progressBox.vue

@@ -7,9 +7,14 @@
           :key="index"
           :key="index"
           :class="{ active: active >= index }"
           :class="{ active: active >= index }"
         >
         >
-		   <el-tooltip class="item" effect="dark" :content="item.taskTypeName" placement="top">
-			  <p>{{ item.taskTypeName }}</p>
-		   </el-tooltip>
+          <el-tooltip
+            class="item"
+            effect="dark"
+            :content="item.taskTypeName"
+            placement="top"
+          >
+            <p>{{ item.taskTypeName }}</p>
+          </el-tooltip>
           <div
           <div
             class="progress-box"
             class="progress-box"
             :style="`backgroundImage:linear-gradient(to top, var(--color-primary), var(--color-primary) ${item.percent},#fff ${item.percent}, #fff);`"
             :style="`backgroundImage:linear-gradient(to top, var(--color-primary), var(--color-primary) ${item.percent},#fff ${item.percent}, #fff);`"
@@ -28,50 +33,48 @@
       //   type: [Number, String],
       //   type: [Number, String],
       //   default: 3
       //   default: 3
       // },
       // },
-		list:{
-			type: Array,
-			default: []
-		},
-		total:{
-			type:Number,
-			default:1
-		}
+      list: {
+        type: Array,
+        default: []
+      },
+      total: {
+        type: Number,
+        default: 1
+      }
     },
     },
-    data () {
+    data() {
       return {
       return {
         stepList: [],
         stepList: [],
-		    active:-1
+        active: -1
       };
       };
     },
     },
-	watch: {
-	  list: {
-	    handler () {
-	      if (this.list.length) {
-	        this.stepList = this.list
-	        this.stepList.map((item,index)=>{
-				item.percent = ( item.number / this.total)*100  + '%'
-			})
-			const active = this.stepList.findIndex((item) => item.number === 0)
-			if(active==-1){
-				this.active = this.stepList.length-1
-			}else{
-				this.active = active - 1
-			}
-	      }
-	    },
-	    immediate: true
-	  }
-	},
-	methods:{
-		
-	}
+    watch: {
+      list: {
+        handler() {
+          if (this.list.length) {
+            this.stepList = this.list;
+            this.stepList.map((item, index) => {
+              item.percent = (item.number / this.total) * 100 + '%';
+            });
+            const active = this.stepList.findIndex((item) => item.number === 0);
+            if (active == -1) {
+              this.active = this.stepList.length - 1;
+            } else {
+              this.active = active - 1;
+            }
+          }
+        },
+        immediate: true
+      }
+    },
+    methods: {}
   };
   };
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   .progress-container {
   .progress-container {
-	  width: 100%;
-	  overflow-x: auto;
+    width: 100%;
+    overflow-x: auto;
     ul {
     ul {
       list-style: none;
       list-style: none;
       display: flex;
       display: flex;
@@ -83,7 +86,7 @@
         justify-content: center;
         justify-content: center;
         flex: 1;
         flex: 1;
         position: relative;
         position: relative;
-		min-width: 110px;
+        min-width: 110px;
         &::after {
         &::after {
           content: '';
           content: '';
           position: absolute;
           position: absolute;
@@ -108,13 +111,13 @@
             border-color: var(--color-primary);
             border-color: var(--color-primary);
           }
           }
         }
         }
-		.el-tooltip{
-		  width: 100%;
-		  text-align: center;
-		  white-space: nowrap; /* 不换行 */
-		  overflow: hidden; /* 超出部分隐藏 */
-		  text-overflow: ellipsis; /* 显示省略号 */
-		}
+        .el-tooltip {
+          width: 100%;
+          text-align: center;
+          white-space: nowrap; /* 不换行 */
+          overflow: hidden; /* 超出部分隐藏 */
+          text-overflow: ellipsis; /* 显示省略号 */
+        }
         .num,
         .num,
         .text {
         .text {
           width: 100%;
           width: 100%;