Jelajahi Sumber

生产总订单-订单操作-增加修改已执行数量功能

jingbb 9 bulan lalu
induk
melakukan
3dcbc8827c

+ 42 - 6
src/views/production/productionTotalOrder/modules/material.vue

@@ -44,6 +44,18 @@
                         <a-input placeholder="请输入" v-model="record.unQuantity"  @blur="changeUQuantity(record)" @change="getQuan(record)"></a-input>
                      </a-form-model-item>
                 </template>
+                <template slot="unQuantityExecute" slot-scope="text, record, index">
+                    <a-form-model-item prop="unQuantityExecute" class='sonItem'>
+                        <a-input placeholder="请输入" v-model="record.unQuantityExecute" v-if="record.allowEditNum=='yes'" @blur="changeQuantityExecuteIn(index,record)"></a-input>
+                        <span v-else>{{ record.unQuantityExecute }}</span>
+                     </a-form-model-item>
+                </template>
+                <template slot="quantityExecute" slot-scope="text, record, index">
+                    <a-form-model-item prop="quantityExecute" class='sonItem'>
+                        <a-input placeholder="请输入" v-model="record.quantityExecute" v-if="record.allowEditNum=='yes'" @blur="changeQuantityExecuteIn(index,record)"></a-input>
+                        <span v-else>{{ record.quantityExecute }}</span>
+                     </a-form-model-item>
+                </template>
                 <template slot="model" slot-scope="text, record, index">
                     <a-form-model-item prop="model" class='sonItem'>
                         <a-input placeholder="请输入" v-model="record.model" ></a-input>
@@ -175,6 +187,7 @@
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import JEllipsis from '@/components/jeecg/JEllipsis'
   import inventoryPopup from '../../Popup/inventoryPopup.vue'
+  import { httpAction ,getAction,postAction,putAction} from '@/api/manage'
   import moment from 'moment'
   export default {
     name: 'material', //  Tabs 详情
@@ -279,18 +292,18 @@
                     ellipsis: true,
                 },
                 {
-                    title: '已执行数量',
+                    title: '已执行数量',
                     align:"center",
-                    dataIndex: 'unQuantityExecute',
+                    dataIndex: 'quantityExecute',
                     ellipsis: true,
-                    // scopedSlots: { customRender: 'unQuantityExecute' } 
+                    scopedSlots: { customRender: 'quantityExecute' } 
                 },
                 {
-                    title: '已执行数量',
+                    title: '已执行数量',
                     align:"center",
-                    dataIndex: 'quantityExecute',
+                    dataIndex: 'unQuantityExecute',
                     ellipsis: true,
-                    // scopedSlots: { customRender: 'quantityExecute' } 
+                    scopedSlots: { customRender: 'unQuantityExecute' } 
                 },
                 {
                     title: '规格',
@@ -541,6 +554,29 @@
                 this.$message.warning('辅数量不可小于已执行辅数量!')
             }
         },
+        // 修改已执行数量
+        editNum(index){
+            this.form.dataSource[index-1].allowEditNum = 'yes'
+            this.$forceUpdate();
+        },
+        changeQuantityExecuteIn(index,record){
+            this.$confirm({
+                content: `是否确认修改`,
+                onOk: () => {
+                    postAction('/productionOrder/madeProductionOrders/updateProductionNum',record).then(res=>{
+                      if(res.success){
+                        this.$message.success('修改成功')
+                        this.form.dataSource[index].allowEditNum = ''
+                        this.$forceUpdate();
+                        this.selectedRowKeys = []
+                        this.selectedRows = []
+                      }else{
+                        this.$message.error(res.message);
+                      }
+                  })
+                }
+            })
+        },
         onSearchInven(record){
             if(!this.planOrg||this.planOrg==''){
                 this.$message.warning('请选择生产组织!')

+ 27 - 2
src/views/production/productionTotalOrder/modules/productDetails.vue

@@ -66,7 +66,8 @@
                 </template>
                 <template slot="quantityExecuteIn" slot-scope="text, record, index">
                     <a-form-model-item prop="quantityExecuteIn" class='sonItem'>
-                        <a-input placeholder="请输入" v-model="record.quantityExecuteIn"></a-input>
+                        <a-input placeholder="请输入" v-model="record.quantityExecuteIn" v-if="record.allowEditNum=='yes'" @blur="changeQuantityExecuteIn(index,record)"></a-input>
+                        <span v-else>{{ record.quantityExecuteIn }}</span>
                      </a-form-model-item>
                 </template>
                 <template slot="framesCount" slot-scope="text, record, index">
@@ -218,6 +219,7 @@
   <script>
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import JEllipsis from '@/components/jeecg/JEllipsis'
+  import { httpAction ,getAction,postAction,putAction} from '@/api/manage'
   import inventoryPopup from '../../Popup/inventoryPopup.vue'
   import moment from 'moment'
   export default {
@@ -328,7 +330,7 @@
                     align:"center",
                     dataIndex: 'quantityExecuteIn',
                     ellipsis: true,
-                    // scopedSlots: { customRender: 'quantityExecuteIn' } 
+                    scopedSlots: { customRender: 'quantityExecuteIn' } 
                 },
                 {
                     // title: '框数量',
@@ -591,6 +593,29 @@
                 this.$refs.inventoryPopup.record=record
             }
         },
+        // 修改已执行数量
+        editNum(index){
+            this.form.dataSource[index-1].allowEditNum = 'yes'
+            this.$forceUpdate();
+        },
+        changeQuantityExecuteIn(index,record){
+            this.$confirm({
+                content: `是否确认修改`,
+                onOk: () => {
+                    postAction('/productionOrder/madeProductionOrders/updateFinishedNum',record).then(res=>{
+                      if(res.success){
+                        this.$message.success('修改成功')
+                        this.form.dataSource[index].allowEditNum = ''
+                        this.$forceUpdate();
+                        this.selectedRowKeys = []
+                        this.selectedRows = []
+                      }else{
+                        this.$message.error(res.message);
+                      }
+                  })
+                }
+            })
+        },
         validateList(){
             let flag = null
             this.$refs.formRef.validate(valid =>{

+ 17 - 0
src/views/production/productionTotalOrder/modules/productionTotalOrderAdd.vue

@@ -97,6 +97,7 @@
             <a-button size="small" @click="KSWarehousing" :disabled="activeKey!=='finishProduct'||defaultMethod=='add'||form.state=='开立'">框/扇入库</a-button>
             <a-button size="small" @click="KSOutbound" :disabled="activeKey!=='finishProduct'||defaultMethod=='add'||form.state=='开立'">框/扇出库</a-button>
             <a-button size="small" @click="sendOrReceive('in')" :disabled="activeKey!=='SurplusMaterials'||defaultMethod=='add'||form.state=='开立'">余料入库</a-button>
+            <a-button size="small" @click="editNum()" :disabled="defaultMethod=='add'||form.state=='开立'">修改已执行数量</a-button>
             <!-- <a-button size="small" @click="sendOrReceive('out')" :disabled="activeKey!=='SurplusMaterials'||defaultMethod=='add'||form.state=='开立'">杂发</a-button> -->
        </div>
        <a-tabs v-model="activeKey" @change="handleChangeTabs">
@@ -510,6 +511,22 @@
             sendOrReceive(data){
                  this.$refs.SurplusMaterials.sendOrReceive(data)
             },
+            //修改已执行数量
+            editNum(){
+                if(this.activeKey=='finishProduct'){
+                    if(this.$refs.productDetails.selectedRowKeys.length!==1){
+                        this.$message.warning('请勾选一条数据!')
+                    }else{
+                        this.$refs.productDetails.editNum(this.$refs.productDetails.selectedRowKeys[0])
+                    }
+                }else if(this.activeKey=='material'){
+                    if(this.$refs.material.selectedRowKeys.length!==1){
+                        this.$message.warning('请勾选一条数据!')
+                    }else{
+                        this.$refs.material.editNum(this.$refs.material.selectedRowKeys[0])
+                    }
+                }
+            },
             //材料出库后重新获取材料明细列表
             RefreshMateriaList(){
                 this.getMaterialData(this.form.id)