yijing пре 1 година
родитељ
комит
dc78f3d5e9

+ 20 - 16
src/api/saleOrder/index.js

@@ -94,6 +94,14 @@ export async function releaseSave(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+// 销售订单生产生产计划
+export async function getGeneratePlan(data) {
+  const res = await request.post(`/aps/productionplan/getGeneratePlan`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 // 销售订单转生产计划保存
 export async function saveSaleToPlan(data) {
   const res = await request.post(`/aps/productionplan/save`, data);
@@ -203,40 +211,31 @@ export async function getInventory(materialCode, planType) {
 
 // 修改优先级
 export async function updatePriority(data) {
-  const res = await request.post(`/aps/salesorder/updatePriority`,  data);
+  const res = await request.post(`/aps/salesorder/updatePriority`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 动态表头
 export async function fieldModel(params) {
-  const res = await request.get(
-    `/main/fieldmodel/list`, { params }
-  );
+  const res = await request.get(`/main/fieldmodel/list`, { params });
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // aps生产计划获取产品的多个bom版本
 export async function bomListByPlan(params) {
-  const res = await request.get(
-    `/main/bomCategory/bomListByPlan`, { params }
-  );
+  const res = await request.get(`/main/bomCategory/bomListByPlan`, { params });
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
-
 // 根据bom 获取工艺路线
 
 export async function bomRoutingList(id) {
@@ -260,7 +259,10 @@ export async function temporarilyUpdate(data) {
 // 同步数据
 
 export async function synchronousDataByJDY(data) {
-  const res = await request.post(`/main/externalinterface/synchronousDataByJDY`, data);
+  const res = await request.post(
+    `/main/externalinterface/synchronousDataByJDY`,
+    data
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -268,17 +270,19 @@ export async function synchronousDataByJDY(data) {
 }
 // 齐套性检查
 export async function orderHomogeneityInspect(data) {
-  const res = await request.post(`/aps/salesorder/orderHomogeneityInspect`,  data);
+  const res = await request.post(
+    `/aps/salesorder/orderHomogeneityInspect`,
+    data
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 export async function getFactoryList(params) {
-  const res = await request.get(`/main/factoryarea/getFactoryList`,  { params });
+  const res = await request.get(`/main/factoryarea/getFactoryList`, { params });
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
-

+ 1 - 1
src/views/materialPlan/index.vue

@@ -37,7 +37,7 @@
           <span>
             {{
               row.orderType == 1
-                ? '销售计划'
+                ? '销售订单'
                 : row.orderType == 2
                 ? '生产计划'
                 : ''

+ 56 - 25
src/views/productionPlan/index.vue

@@ -10,12 +10,12 @@
       >
       </productionPlan-search>
       <div class="statistics">
-        <el-row :gutter="15">
+        <el-row :gutter="24">
           <el-col :span="cardSpan">
             <el-card shadow="hover" class="cardItem">
               <div>
                 <div class="cardText">待排产计划数量</div>
-                <div class="cardNum">{{planStatistics.waitPlanNum}}</div>
+                <div class="cardNum">{{ planStatistics.waitPlanNum }}</div>
               </div>
             </el-card>
           </el-col>
@@ -23,7 +23,7 @@
             <el-card shadow="hover" class="cardItem">
               <div>
                 <div class="cardText">计划生产数量</div>
-                <div class="cardNum">{{planStatistics.planNum}}</div>
+                <div class="cardNum">{{ planStatistics.planNum }}</div>
               </div>
             </el-card>
           </el-col>
@@ -31,7 +31,7 @@
             <el-card shadow="hover" class="cardItem">
               <div>
                 <div class="cardText">已下发生产数量</div>
-                <div class="cardNum">{{planStatistics.issueNum}}</div>
+                <div class="cardNum">{{ planStatistics.issueNum }}</div>
               </div>
             </el-card>
           </el-col>
@@ -47,7 +47,7 @@
             <el-card shadow="hover" class="cardItem">
               <div>
                 <div class="cardText">待完工生产数量</div>
-                <div class="cardNum">{{planStatistics.waitFinishNum}}</div>
+                <div class="cardNum">{{ planStatistics.waitFinishNum }}</div>
               </div>
             </el-card>
           </el-col>
@@ -63,7 +63,7 @@
             <el-card shadow="hover" class="cardItem">
               <div>
                 <div class="cardText">已完工数量</div>
-                <div class="cardNum">{{planStatistics.finishNum}}</div>
+                <div class="cardNum">{{ planStatistics.finishNum }}</div>
               </div>
             </el-card>
           </el-col>
@@ -71,14 +71,16 @@
             <el-card shadow="hover" class="cardItem">
               <div>
                 <div class="cardText">已入库数量</div>
-                <div class="cardNum">{{planStatistics.stockNum}}</div>
+                <div class="cardNum">{{ planStatistics.stockNum }}</div>
               </div>
             </el-card>
           </el-col>
         </el-row>
       </div>
       <div class="btn_box">
-        <el-button type="success" size="mini" @click="homogeneityInspect">齐套性检查</el-button>
+        <el-button type="success" size="mini" @click="homogeneityInspect"
+          >齐套性检查</el-button
+        >
         <el-button type="primary" size="mini" @click="disassemblePlan"
           >计划分解</el-button
         >
@@ -271,8 +273,14 @@
 
     <unpackDetails ref="DetailsRef"></unpackDetails>
 
-    <homogeneityInspectDialog ref="homogeneityInspectDialog" @success="reload" />
-    <homogeneityInspectInstallDialog ref="homogeneityInspectInstallDialog" @success="reload" />
+    <homogeneityInspectDialog
+      ref="homogeneityInspectDialog"
+      @success="reload"
+    />
+    <homogeneityInspectInstallDialog
+      ref="homogeneityInspectInstallDialog"
+      @success="reload"
+    />
 
     <disassemblePlanPop
       ref="disassemblePlanRef"
@@ -289,7 +297,12 @@
 </template>
 
 <script>
-  import { getList, del, updatePriority, getPlanStatistics } from '@/api/productionPlan/index.js';
+  import {
+    getList,
+    del,
+    updatePriority,
+    getPlanStatistics
+  } from '@/api/productionPlan/index.js';
   import productionPlanSearch from './components/productionPlan-search.vue';
   import unpackDialog from './components/unpackDialog.vue';
   import mergeDialog from './components/mergeDialog.vue';
@@ -311,7 +324,7 @@
       disassemblePlanPop,
       factoryAdd,
       homogeneityInspectDialog,
-      homogeneityInspectInstallDialog,
+      homogeneityInspectInstallDialog
     },
     props: {
       timeDimensionPlanType: { type: Number, default: 1 }
@@ -324,7 +337,7 @@
           issueNum: 0,
           waitFinishNum: 0,
           finishNum: 0,
-          stockNum: 0,
+          stockNum: 0
         },
         activeName: 'first',
 
@@ -362,7 +375,7 @@
         factoryShow: false,
         factoryType: 1,
         factoryObj: {},
-        cardSpan: 3,
+        cardSpan: 3
       };
     },
     computed: {
@@ -639,8 +652,6 @@
             showOverflowTooltip: true
           },
 
-
-
           {
             prop: 'orderType',
             label: '计划类型',
@@ -687,35 +698,35 @@
       this.getPlanStatistics();
     },
     methods: {
-      async getPlanStatistics(){
+      async getPlanStatistics() {
         let res = await getPlanStatistics();
         console.log(res);
         this.planStatistics = res;
       },
-      homogeneityInspect(){
-        if(this.selection.length == 0){
+      homogeneityInspect() {
+        if (this.selection.length == 0) {
           this.$message.warning('请至少选择一条计划!');
           return;
         }
         let flag = false;
         let type = 0;
-        for(let item of this.selection){
+        for (let item of this.selection) {
           type = item.produceType;
-          for(let ele of this.selection){
-            if(item.produceType != ele.produceType){
+          for (let ele of this.selection) {
+            if (item.produceType != ele.produceType) {
               flag = true;
               break;
             }
           }
         }
-        if(flag){
+        if (flag) {
           this.$message.warning('请选择加工方式相同的计划!');
           return;
         }
         console.log(type);
-        if(type == 2){
+        if (type == 2) {
           this.$refs.homogeneityInspectDialog.open(this.selection);
-        } else if(type == 3){
+        } else if (type == 3) {
           this.$refs.homogeneityInspectInstallDialog.open(this.selection);
         } else {
           this.$message.warning('请确认加工方式!');
@@ -1038,12 +1049,32 @@
     text-align: center;
     color: white;
     background-color: rgba(24, 144, 255, 0.8);
+    overflow: hidden;
+    padding: 10px;
   }
   .cardText {
     font-size: 16px;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
   }
   .cardNum {
     font-size: 32px;
     font-style: italic;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+  }
+  @media (max-width: 768px) {
+    .cardText {
+      font-size: 14px;
+    }
+
+    .cardNum {
+      font-size: 24px;
+    }
+  }
+  ::v-deep .el-card__body {
+    padding: 17px 12px !important;
   }
 </style>

+ 8 - 5
src/views/saleOrder/components/plan-submit.vue

@@ -47,7 +47,7 @@
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 订单重量 </template>
-          {{ info.sumOrderWeight }} {{  info.newWeightUnit }}
+          {{ info.sumOrderWeight }} {{ info.newWeightUnit }}
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 要求生产数量 </template>
@@ -55,7 +55,7 @@
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 要求生产重量 </template>
-          {{ info.newSumOrderWeight }} {{  info.newWeightUnit }}
+          {{ info.newSumOrderWeight }} {{ info.newWeightUnit }}
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 要求完成日期 </template>
@@ -68,15 +68,18 @@
         </el-descriptions-item>
 
         <el-descriptions-item :span="3">
-          <template slot="label">  </template>
-         
+          <template slot="label"> </template>
         </el-descriptions-item>
       </el-descriptions>
     </div>
     <div slot="footer" class="footer">
       <div>
         <el-button @click="cancel">取消</el-button>
-        <el-button @click="submit(2)" type="primary" :loading="loading" v-if="type != 'edit'"
+        <el-button
+          @click="submit(2)"
+          type="primary"
+          :loading="loading"
+          v-if="type != 'edit'"
           >提交并发布</el-button
         >
         <el-button type="primary" @click="submit(1)" :loading="loading"

+ 404 - 55
src/views/saleOrder/salesToProduction.vue

@@ -7,7 +7,9 @@
         }}</div>
         <div class="title-right">
           <el-button @click="cancel">取消</el-button>
-          <el-button type="primary"> 生成生产计划 </el-button>
+          <el-button type="primary" @click="productionPlan">
+            生成生产计划
+          </el-button>
         </div>
       </div>
       <el-form
@@ -30,7 +32,7 @@
             </el-form-item>
           </el-col>
 
-          <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
+          <!-- <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
             <el-form-item label="加工方式:" prop="produceType">
               <el-select
                 v-model="form.produceType"
@@ -65,7 +67,7 @@
                 ></el-option>
               </el-select>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
             <el-form-item label="余量系数:" prop="marginCoefficient">
               <el-select
@@ -83,7 +85,26 @@
               </el-select>
             </el-form-item>
           </el-col>
-
+          <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
+            <el-form-item label="批次号:" prop="batchNo">
+              <el-input
+                placeholder="请输入批次号"
+                v-model="form.batchNo"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
+            <el-form-item label="所属工厂:" prop="factoriesId">
+              <el-select v-model="form.factoriesId" style="width: 100%">
+                <el-option
+                  v-for="item of factoryList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
           <!-- <el-col
             v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }"
             v-if="clientEnvironmentId != 4"
@@ -105,7 +126,7 @@
           </el-col> -->
 
           <el-col
-            v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }"
+            v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }"
             v-if="clientEnvironmentId == 4"
           >
             <el-form-item label="工艺路线:" prop="produceRoutingId">
@@ -127,16 +148,7 @@
             </el-form-item>
           </el-col> -->
         </el-row>
-        <el-row :gutter="24">
-          <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
-            <el-form-item label="批次号:" prop="batchNo">
-              <el-input
-                placeholder="请输入批次号"
-                v-model="form.batchNo"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <!-- 
+        <!-- 
           <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
             <el-form-item label="计划开始日期:" prop="startTime">
               <el-date-picker
@@ -155,7 +167,7 @@
             </el-form-item>
           </el-col> -->
 
-          <!-- <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
+        <!-- <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
             <el-form-item label="计划结束日期:" prop="endTime">
               <el-date-picker
                 style="width: 100%"
@@ -173,20 +185,6 @@
             </el-form-item>
           </el-col> -->
 
-          <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
-            <el-form-item label="所属工厂:" prop="factoriesId">
-              <el-select v-model="form.factoriesId" style="width: 100%">
-                <el-option
-                  v-for="item of factoryList"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.id"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-
         <el-row :gutter="24" class="row-intro">
           <el-col v-bind="styleResponsive ? { lg: 3, md: 12 } : { span: 3 }">
             <el-form-item label="销售单数量:">{{ form.codeNum }}</el-form-item>
@@ -564,10 +562,344 @@
           </el-table-column>
         </el-table>
 
-        <el-row>
-          <div class="title-left">生产计划列表</div>
+        <el-row style="margin-top: 24px">
+          <el-table :data="form.productPlanList" border>
+            <el-table-column label="序号" align="center" width="60">
+              <template slot-scope="scope">
+                <span>{{ scope.$index + 1 }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="销售订单号"
+              align="center"
+              prop="code"
+              width="120"
+              sortable
+            >
+            </el-table-column>
+            <el-table-column
+              label="产品名称"
+              align="center"
+              prop="productName"
+              width="120"
+            >
+            </el-table-column>
+            <!-- <el-table-column
+              :label="'订单数量' + (clientEnvironmentId == '4' ? '(方)' : '')"
+              align="center"
+              prop="contractNum"
+              width="120"
+            >
+              <template slot-scope="scope">
+                {{ scope.row.contractNum }} {{ scope.row.measuringUnit }}
+              </template>
+            </el-table-column> -->
+            <el-table-column
+              label="订单重量"
+              align="center"
+              prop="productWeight"
+              width="120"
+            >
+              <template slot-scope="scope">
+                {{ scope.row.productWeight }} {{ form.weightUnit }}
+              </template>
+            </el-table-column>
+            <el-table-column label="规格" align="center" prop="specification">
+            </el-table-column>
+            <!-- <el-table-column
+              :label="'欠交数量' + (clientEnvironmentId == '4' ? '(方)' : '')"
+              align="center"
+              prop="lackNum"
+            >
+            </el-table-column> -->
+            <!-- <el-table-column
+              :label="
+                '计划生产数量' + (clientEnvironmentId == '4' ? '(方)' : '')
+              "
+              align="center"
+              prop="planProductNum"
+              width="140"
+            >
+              <template slot-scope="scope">
+                <el-form-item
+                  label-width="0px"
+                  :prop="'productPlanList.' + scope.$index + '.planProductNum'"
+                  :rules="{
+                    required: true,
+                    message: '请输入计划生产数量',
+                    trigger: 'blur'
+                  }"
+                  class="table-item"
+                >
+                  <el-input
+                    v-model.number="scope.row.planProductNum"
+                    size="small"
+                    type="number"
+                    style="width: 100%"
+                    @input="
+                      tableHandleKeyUp(scope.row, scope.$index, $event, 'sum')
+                    "
+                    placeholder="输入数量"
+                  ></el-input>
+                </el-form-item>
+              </template>
+            </el-table-column> -->
+            <el-table-column
+              :label="
+                '要求生产数量' + (clientEnvironmentId == '4' ? '(方)' : '')
+              "
+              align="center"
+              prop="requiredFormingNum"
+              width="120"
+            >
+              <!-- <template slot-scope="scope">
+                <el-form-item
+                  label-width="0px"
+                  :prop="
+                    'productPlanList.' + scope.$index + '.requiredFormingNum'
+                  "
+                  :rules="{
+                    required: true,
+                    message: '请输入要求生产数量',
+                    trigger: 'blur'
+                  }"
+                  class="table-item"
+                >
+                  <el-input
+                    v-model.number="scope.row.requiredFormingNum"
+                    size="small"
+                    disabled
+                    oninput="value=value.replace(/[^\d]/g,'')"
+                    style="width: 100%"
+                    placeholder="输入数量"
+                  ></el-input>
+                </el-form-item>
+              </template> -->
+            </el-table-column>
+            <el-table-column
+              label="模数"
+              align="center"
+              width="100"
+              v-if="clientEnvironmentId == '4'"
+            >
+              <template slot-scope="scope">
+                <div>
+                  <el-input
+                    style="width: 100%"
+                    size="small"
+                    v-model="scope.row.moCount"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
+                    @input="
+                      tableHandleKeyUp(
+                        scope.row,
+                        scope.$index,
+                        $event,
+                        'moCount'
+                      )
+                    "
+                    placeholder="请输入"
+                  >
+                  </el-input>
+                </div>
+              </template>
+            </el-table-column>
+
+            <el-table-column
+              align="center"
+              width="100"
+              v-if="clientEnvironmentId == '4'"
+            >
+              <template slot="header">
+                <span style="color: red">*</span>
+                <span>块数</span>
+              </template>
+              <template slot-scope="scope">
+                <div>
+                  <el-input
+                    size="small"
+                    style="width: 100%"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
+                    @input="
+                      tableHandleKeyUp(
+                        scope.row,
+                        scope.$index,
+                        $event,
+                        'blockCount'
+                      )
+                    "
+                    v-model="scope.row.blockCount"
+                    placeholder="请输入"
+                  ></el-input>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="权重等级"
+              align="center"
+              width="120"
+              v-if="clientEnvironmentId == '4'"
+            >
+              <template slot-scope="scope">
+                <div>
+                  <el-select v-model="scope.row.weight" style="width: 100%">
+                    <el-option
+                      v-for="item of weightList"
+                      :key="item.code"
+                      :label="item.name"
+                      :value="item.code"
+                    ></el-option>
+                  </el-select>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column
+              align="center"
+              width="120"
+              label="是否开槽"
+              v-if="clientEnvironmentId == '4'"
+            >
+              <template slot-scope="scope">
+                <div>
+                  <el-select
+                    style="width: 100%"
+                    v-model="scope.row.isSlotting"
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item of isSlotting"
+                      :key="item.code"
+                      :label="item.name"
+                      :value="item.code"
+                    />
+                  </el-select>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column
+              align="center"
+              width="120"
+              label="开槽类型"
+              v-if="clientEnvironmentId == '4'"
+            >
+              <template slot-scope="scope">
+                <DictSelection
+                  dictName="开槽类型"
+                  v-model="scope.row.slottingType"
+                  v-if="scope.row.isSlotting == 1"
+                >
+                </DictSelection>
+              </template>
+            </el-table-column>
+            <!-- <el-table-column
+              label="按单按库"
+              align="center"
+              prop="orderLibraryType"
+            >
+              <template slot-scope="{ row }">
+                {{ getDictValue('按单按库', row.orderLibraryType) }}
+              </template>
+            </el-table-column> -->
+            <!-- <el-table-column label="订单类型" align="center" prop="orderType">
+              <template slot-scope="{ row }">
+                {{ getDictValue('订单类型', row.orderType) }}
+              </template>
+            </el-table-column> -->
+            <el-table-column
+              label="交付日期"
+              align="center"
+              prop="deliveryTime"
+              width="160"
+            >
+            </el-table-column>
+            <el-table-column
+              label="要求完成日期"
+              align="center"
+              prop="reqMoldTime"
+              width="180"
+            >
+              <template slot-scope="scope">
+                <el-form-item
+                  label-width="0px"
+                  :prop="'productPlanList.' + scope.$index + '.reqMoldTime'"
+                  :rules="{
+                    required: true,
+                    message: '请选择要求完成日期',
+                    trigger: 'blur'
+                  }"
+                  class="table-item"
+                >
+                  <el-date-picker
+                    style="width: 100%"
+                    v-model="scope.row.reqMoldTime"
+                    :pickerOptions="{
+                      disabledDate: (time) =>
+                        time.getTime() <
+                        new Date(new Date().setHours(0, 0, 0, 0)).getTime()
+                    }"
+                    type="date"
+                    placeholder="选择日期"
+                    value-format="yyyy-MM-dd"
+                  >
+                  </el-date-picker>
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <!-- <el-table-column
+              label="客户名称"
+              align="center"
+              prop="customerName"
+            >
+            </el-table-column> -->
+            <!-- <el-table-column label="业务员" align="center" prop="salesman">
+            </el-table-column> -->
+            <!-- <el-table-column
+              label="交付要求"
+              align="center"
+              prop="deliveryRequirements"
+            >
+              <template slot-scope="{ row }">
+                {{ getDictValue('交付要求', row.deliveryRequirements) }}
+              </template>
+            </el-table-column> -->
+            <el-table-column
+              prop="priority"
+              label="优先级"
+              width="100"
+              align="center"
+            >
+              <template slot-scope="{ row, $index }">
+                <div style="display: flex">
+                  <el-input
+                    v-if="$index == 0"
+                    v-model="row.priority"
+                    type="number"
+                    size="mini"
+                    :min="0"
+                    :max="10"
+                    @change="priorityChange(row)"
+                    style="width: 80px"
+                  ></el-input>
+                  <el-popover
+                    v-if="$index == 0"
+                    placement="right"
+                    width="200"
+                    trigger="hover"
+                    content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
+                  >
+                    <div class="sort-wrap" slot="reference">
+                      <i class="el-icon-caret-top" @click="sortTop(row)"></i>
+                      <i
+                        class="el-icon-caret-bottom"
+                        @click="sortBottom(row)"
+                      ></i>
+                    </div>
+                  </el-popover>
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
         </el-row>
-        <el-row :gutter="24">
+        <el-row :gutter="24" style="margin-top: 24px">
           <el-col v-bind="styleResponsive ? { lg: 24, md: 24 } : { span: 24 }">
             <el-form-item label="计划备注:">
               <el-input
@@ -616,9 +948,10 @@
     releaseSave,
     getInventory,
     getUpdateInfoById,
-    bomRoutingList,
+    // bomRoutingList,
     bomListByPlan,
-    getFactoryList
+    getFactoryList,
+    getGeneratePlan
   } from '@/api/saleOrder';
 
   import { getByCode } from '@/api/system/dictionary-data';
@@ -666,7 +999,8 @@
           batchNo: null,
           produceType: 1,
           bomCategoryId: '',
-          factoriesId: ''
+          factoriesId: '',
+          productPlanList: []
         },
 
         marginList: [],
@@ -681,12 +1015,6 @@
             { required: true, message: '请选择工艺路线', trigger: 'blur' }
           ],
 
-          produceType: [
-            { required: true, message: '请选择加工方式', trigger: 'blur' }
-          ],
-          bomCategoryId: [
-            { required: true, message: '请选择BOM版本', trigger: 'blur' }
-          ],
           factoriesId: [
             { required: true, message: '请选择所属工厂', trigger: 'blur' }
           ]
@@ -752,15 +1080,15 @@
       },
 
       getPlanRouting() {
-        bomRoutingList(this.form.bomCategoryId).then((res) => {
-          this.routingList = res || [];
-        });
+        // bomRoutingList(this.form.bomCategoryId).then((res) => {
+        //   this.routingList = res || [];
+        // });
       },
 
       bomListVersion() {
         let param = {
           bomType: this.form.produceType,
-          categoryId: this.form.salesOrders[0].categoryId
+          categoryId: this.form.salesOrders[0]?.categoryId
         };
         bomListByPlan(param).then((res) => {
           this.bomVersionList = res || [];
@@ -800,19 +1128,19 @@
         this.getPlanRouting();
       },
 
-      changeRoute() {
-        this.routingList.forEach((f) => {
-          if (f.id == this.form.produceRoutingId) {
-            this.$set(this.form, 'produceRoutingName', f.name);
-            this.$set(this.form, 'produceVersionName', f.version);
-          }
-        });
-      },
+      // changeRoute() {
+      //   this.routingList.forEach((f) => {
+      //     if (f.id == this.form.produceRoutingId) {
+      //       this.$set(this.form, 'produceRoutingName', f.name);
+      //       this.$set(this.form, 'produceVersionName', f.version);
+      //     }
+      //   });
+      // },
 
       getSaleInfo() {
         let params = JSON.parse(this.$route.query.selection);
         productionToPlan(params).then((res) => {
-          console.log(res);
+          res.productPlanList = res.productPlanList || [];
           this.form = deepClone(res);
           if (!this.form.produceType) {
             this.form.produceType = 1;
@@ -1220,6 +1548,27 @@
               this.$message.error('提交失败,请重新提交!');
             });
         }
+      },
+      preparePlanParams() {
+        const params = deepClone(this.form);
+        params.categoryId = params.salesOrders[0]?.categoryId;
+        if (this.$route.query.type != 'edit') {
+          delete params.id;
+        }
+        return params;
+      },
+      //生产生产计划
+      productionPlan() {
+        const params = this.preparePlanParams();
+        getGeneratePlan(params)
+          .then((res) => {
+            this.form.productPlanList = res;
+            console.log(this.form.productPlanList);
+          })
+          .catch((error) => {
+            console.error('生成生产计划失败:', error);
+            this.$message.error('生成失败,请重新生成!');
+          });
       }
     }
   };