From 6ab47fcc9f200a78dd7fd010fc4129cd178e79b2 Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期二, 07 四月 2026 15:49:05 +0800
Subject: [PATCH] 采购入库单bug修改

---
 src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillList.vue |    2 
 src/views/purchase/cgPoInStockBill/cgPoInStockBill.vue     |   64 ++++++++++++
 src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillEdit.vue |  187 ++++++++++++++++++++++++++++---------
 3 files changed, 205 insertions(+), 48 deletions(-)

diff --git a/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillEdit.vue b/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillEdit.vue
index 5169afa..9670d4b 100644
--- a/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillEdit.vue
+++ b/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillEdit.vue
@@ -19,7 +19,7 @@
             </el-col>
             <el-col :span="6">
               <el-form-item label="鏃ユ湡" prop="HDate">
-                <el-date-picker v-model="form.HDate" type="date" placeholder="閫夋嫨鏃ユ湡" value-format="yyyy-MM-ddT">
+                <el-date-picker v-model="form.HDate" type="date" placeholder="閫夋嫨鏃ユ湡" value-format="yyyy-MM-dd">
                 </el-date-picker>
               </el-form-item>
             </el-col>
@@ -188,34 +188,34 @@
               controls-position="right"></el-input-number>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="绋庣巼" width="120">
-          <template slot-scope="scope">
+        <el-table-column align="center" label="绋庣巼" width="120" v-if="false">
+          <template slot-scope="scope" v-if="false">
             <el-input-number v-model="scope.row.HTaxRate" :min="0" style="width: 90px;"
               controls-position="right"></el-input-number>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="鍗曚环" width="120">
+        <el-table-column align="center" label="鍗曚环" width="120" v-if="false">
           <template slot-scope="scope">
             <el-input-number v-model="scope.row.HPrice" :min="0" style="width: 90px;"
               controls-position="right"></el-input-number>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="鍚◣鍗曚环" width="120">
+        <el-table-column align="center" label="鍚◣鍗曚环" width="120" v-if="false">
           <template slot-scope="scope">
             <span>{{ scope.row.HPrice * (1 + scope.row.HTaxRate*0.01) }}</span>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="閲戦" width="120">
+        <el-table-column align="center" label="閲戦" width="120"  v-if="false">
           <template slot-scope="scope">
             <span>{{ scope.row.HPrice * scope.row.HQty }}</span>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="鍚◣閲戦" width="120">
+        <el-table-column align="center" label="鍚◣閲戦" width="120" v-if="false">
           <template slot-scope="scope">
             <span>{{ (scope.row.HPrice * (1 + scope.row.HTaxRate*0.01)) * scope.row.HQty }}</span>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="閲囪喘閲戦" width="120">
+        <el-table-column align="center" label="閲囪喘閲戦" width="120"v-if="false">
           <template slot-scope="scope">
             <span>{{ scope.row.HPrice * scope.row.HQty }}</span>
           </template>
@@ -314,7 +314,7 @@
       openPageData:{},//浼犲叆寮圭獥鐨勬暟鎹�
       formShow: false,                                                           //琛ㄥ崟鏄惁鏄剧ず鏍囪
       formLoading: true,                                                         //琛ㄥ崟鍔犺浇閬僵
-      zzSelDis: false,                                                           //缁勭粐涓嬫媺鍒楄〃绂佺敤鏍囪
+      zzSelDis: false,
 
       rowHideShow: false,                                                        //鍒楄缃粍浠跺鍣ㄦ樉绀烘爣璁�
       openRowHide: false,                                                        //鍒楄缃粍浠舵樉绀烘爣璁�
@@ -334,15 +334,13 @@
       btResList: [],                                                             // 鍒楄缃�
       form: {},                                                                  // 琛ㄥ崟鍙傛暟
       rules: {                                                                   // 琛ㄥ崟鏍¢獙
-        HSupName: [
-          { required: true, message: "瀹㈡埛涓嶈兘涓虹┖", trigger: "blur" }
-        ],
         HDate: [
           { required: true, message: "鏃ユ湡涓嶈兘涓虹┖", trigger: "blur" }
         ],
-        HExRate: [
-          { required: true, message: "姹囩巼涓嶈兘涓虹┖", trigger: "blur" }
-        ]
+        鐗╂枡鍚嶇О: [
+          { required: true, message: "鐗╂枡鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+        
       },
       
       checkedSysZb: [],
@@ -486,6 +484,7 @@
                     , 'HSCWHName': ""
                     , 'HSCSPID': "0"
                     , 'HSCSPName': ""
+                    , 'HBillStatus':"0"
                     , 'HBatchNo': ""
                     , 'HPOOrderInterID': "0"
                     , 'HPOOrderEntryID': "0"
@@ -496,6 +495,7 @@
                     , 'HSecUnitName': ""
                     , 'HSecUnitRate': "0"
                     , 'HEngineNum': ""
+                    ,  'HPRDORGID' :"0"
                     , 'HUnderPanNum': ""
                     , 'HLeaveFactCard': ""
                     , 'HReqBuyQty': "0"
@@ -514,6 +514,91 @@
           });
         }
       }
+       else if (this.OperationType == 5) {
+          this.zzSelDis = true
+          this.handleAdd()
+          let pushData = this.getUrlVars_JSON();
+          let sourceList = pushData.data || [];
+          for (let item of sourceList) {
+            let hmainid = item.hmainid;
+            let hsubid = item.hsubid;
+
+            axios.get(this.$baseUrl + '/Cg_POInStockBill/cx1', {
+              params: {
+                HInterID: hmainid,
+                HSubID: hsubid   
+              }
+            }).then(res => {
+              let rows = res.data.data || [];
+              if (!rows.length) return;
+              let first = rows[0];
+              if (this.editData.length === 0) {
+                this.form.HSupID = first.HSupID;
+                this.form.HSupName = first.渚涘簲鍟�;
+                this.form.HBillType = first.HBillType;
+              }
+              this.editData.push({
+                HMaterID: first.HMaterID,
+                "鐗╂枡浠g爜": first.鐗╂枡浠g爜,
+                "鐗╂枡鍚嶇О": first.鐗╂枡鍚嶇О,
+                "瑙勬牸鍨嬪彿": first.瑙勬牸鍨嬪彿,
+                "璁¢噺鍗曚綅": first.璁¢噺鍗曚綅,
+                 HQtyMust: first.鏁伴噺,
+                 HQty: first.鏁伴噺,
+                 HPrice: first.鍗曚环,
+                HTaxRate: first.绋庣巼,
+                HRemark: first.琛ㄤ綋澶囨敞,
+                HSourceInterID: hmainid,
+                HSourceEntryID: hsubid,
+                HSourceBillNo: first.鍗曟嵁鍙�,
+                HSourceBillType: first.婧愬崟绫诲瀷,
+                HWHID: first.HWHID,
+                "鏀舵枡浠撳簱": first.鏀舵枡浠撳簱,
+                HUnitID:first.HUnitID,
+                HInvoiceBillNo:first.鍙戠エ缂栫爜,
+                HDeptID : first.HDeptID,
+                HDeptName : first.閮ㄩ棬,
+                HEmpID : first.HEmpID,
+                HEmpName : first.涓氬姟鍛�,
+                HManagerID : first.HManagerID,
+                HManagerName : first.涓荤,
+                HMainSourceBillType : first.HBillType,
+                HSupID : first.HCusID,
+                HSupName : first.瀹㈡埛,
+                HLinkMan : first.鑱旂郴浜�,
+                HLinkPhone : first.鑱旂郴鐢佃瘽,
+                HSellSID : first.HSellSID,
+                HSellSName : first.閿�鍞柟寮�,
+                HCurID : first.HCurID,
+                HCurName :first.甯佸埆,
+                HExRate : first.姹囩巼,
+                HWHID: first.涓昏〃浠撳簱ID,
+                HWHName: first.涓昏〃浠撳簱,
+                HSecManagerID: first.HSecManagerID,
+                HSecManagerName: first.楠屾敹鍛�,
+                HRemark: first.琛ㄥご澶囨敞,
+                HOrgID : first.HOrgID,
+                HSTOCKORGID : first.HOrgID,
+                HOWNERID : first.HOrgID,
+                HPieceQty: 0, HTaxPrice: 0, HMoney: 0, HTaxMoney: 0,
+                HQty_Full: 0, HQty_Empty: 0, HQty_Back: 0, HCostPrice: 0, HCostMoney: 0,
+                HSalePrice: 0, HSeOrderInterID: 0, HSeOrderEntryID: 0, HSeOrderBillNo: "",
+                HRelationQty: 0, HRelationMoney: 0, HSPID: first.HSPID, "浠撲綅鍚嶇О": first.浠撲綅鍚嶇О,
+                HSPGroupID: 0, HSPGroupName: "", HSCWHID: 0, HSCWHName: "", HSCSPID: 0, HSCSPName: "",
+                HBatchNo: "", HPOOrderInterID: 0, HPOOrderEntryID: 0, HPOOrderBillNo: "",
+                HPropertyID: 0, HPropertyName: "", HSecUnitID: 0, HSecUnitName: "", HSecUnitRate: 0,
+                HEngineNum: "", HUnderPanNum: "", HLeaveFactCard: "", HReqBuyQty: 0, HReqOutQty: 0, HCurrentInventory: 0
+              });
+
+              this.formShow = true;
+              this.formLoading = false;
+            }).catch(() => {
+              this.$modal.msgError("鎺ュ彛璇锋眰澶辫触");
+              this.formShow = true;
+              this.formLoading = false;
+            });
+          }
+        }
     },
     //#endregion
 
@@ -523,10 +608,6 @@
       HInterID: 0,
       HBillNo: " ",
       HDate: new Date(),
-      HEmpID: 1,
-      HEmpName: " ",
-      HDeptID: 1,
-      HDeptName: " ",
       HSupID: 1,
       HSupName: " ",
       HInvoiceBillNo: " ",
@@ -541,7 +622,9 @@
       HCloseMan: " ",
       HUpDater: " ",
       HDeleteMan: " ",
-      
+      HEmpName:sessionStorage["HSellMan"],
+      HEmpID:sessionStorage["HSellManID"] ,                                             
+                //缁勭粐涓嬫媺鍒楄〃绂佺敤鏍囪
       HMakeDate: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
       HCheckDate: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
       HCloseDate: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
@@ -591,6 +674,12 @@
       this.reset()
       //鏂板鑾峰彇鍗曟嵁鍙�
       this.getHBillNo()
+      this.form.HEmpName = sessionStorage.getItem("HSellMan") || ""
+      this.form.HEmpID = sessionStorage.getItem("HSellManID") || ""
+      this.form.HDeptID = sessionStorage.getItem("HDeptID") || ""
+      this.form.HDeptName = sessionStorage.getItem("HDept") || ""
+    
+      
       if (this.OperationType == 1) {
         this.handleAddSysZb()
       }
@@ -806,6 +895,12 @@
               this.form.HWHName = deptRow.浠撳簱鍚嶇О
               this.form.HWHID = deptRow.HItemID
               this.form.HWHNumber = deptRow.浠撳簱浠g爜
+              for (let i = 0; i < this.editData.length; i++) {
+              this.editData[i].HWHID = deptRow.HItemID
+              this.editData[i].HWHNumber = deptRow.浠撳簱浠g爜;
+              this.editData[i].HWHName = deptRow.浠撳簱鍚嶇О;
+              this.editData[i].鏀舵枡浠撳簱 = deptRow.浠撳簱鍚嶇О; 
+            }
               this.openData = false
             }else{
               this.editData[this.zbIndex].HWHID = deptRow.HItemID;
@@ -906,18 +1001,18 @@
             if (!fhck) {
               var sMainStr = JSON.stringify(this.form);
               var sSubStr = JSON.stringify(this.editData);
-              var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"] + ';' + this.OperationType;
+              var sMainSub = sMainStr + ';' + sSubStr + ';' + this.OperationType + ';' + sessionStorage["HUserName"]+';'+this.OperationType;
               axios({
                 method: 'post',
-                url: this.$baseUrl + "/Kf_POStockInBill/SaveSellOutBillList",
+                url: this.$baseUrl + "/Kf_POStockInBill/POStockInBillEdit",
                 data: {
-                  'msg': sMainSub
+                  'sMainSub': sMainSub
                 },
               }).then(response => {
                 if (response.data.count == 1) {
                   this.subDisabled = true//璁剧疆淇濆瓨鎸夐挳涓嶅彲鐢�
                   this.$modal.msgSuccess(response.data.Message);
-                  // this.get_MAXNum_Task(1);//璁剧疆娴佹按鍙峰鍔�
+                  this.get_MAXNum_Task(1);//璁剧疆娴佹按鍙峰鍔�
                   if (response.data.Verify == "Y") //鑷姩瀹℃牳
                   {
                     this.set_CheckBill(0, this.form); //瀹℃牳
@@ -988,7 +1083,7 @@
           瑙勬牸鍨嬪彿: '',
           HUnitID: 0,
           璁¢噺鍗曚綅: '',
-          HQtyMust: 1,
+          HQtyMust: 0,
           HQty: 1,
           HPieceQty: 0,
           HPrice: 0,
@@ -1159,27 +1254,27 @@
     },
     //#endregion
 
-    // //#region 鑾峰彇鏈�澶у崟鎹彿
-    // get_MAXNum_Task(Type) {
-    //   const formatDate = this.form.HDate
-    //  ? new Date(this.form.HDate).toISOString().split('T')[0]
-    // : new Date().toISOString().split('T')[0];
-    //  var sql = `exec h_p_Xt_GetMaxBillNo_SubType '1201','${formatDate}',0,0,0,'${Type}','${this.form.HDeptID}'`;
-    //   axios({
-    //     method: 'get',
-    //     url: this.$baseUrl + "/CommonModel/searchMethod",
-    //     params: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": "" },
-    //   }).then(response => {
-    //     if (response.data.count == 1) {
-    //       this.form.HBillNo = response.data.data[0].HBillNo;
-    //     } else {
-    //       this.$modal.msgError(response.data.code + response.data.Message);
-    //     }
-    //   }).catch(error => {
-    //     this.$modal.msgError("鎺ュ彛璇锋眰澶辫触!");
-    //   });
-    // },
-    //#endregion
+   // #region 鑾峰彇鏈�澶у崟鎹彿
+    get_MAXNum_Task(Type) {
+      const formatDate = this.form.HDate
+     ? new Date(this.form.HDate).toISOString().split('T')[0]
+    : new Date().toISOString().split('T')[0];
+     var sql = `exec h_p_Xt_GetMaxBillNo_SubType '1201','${formatDate}',0,0,0,'${Type}','${this.form.HDeptID}'`;
+      axios({
+        method: 'get',
+        url: this.$baseUrl + "/CommonModel/searchMethod",
+        params: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": "" },
+      }).then(response => {
+        if (response.data.count == 1) {
+          this.form.HBillNo = response.data.data[0].HBillNo;
+        } else {
+          this.$modal.msgError(response.data.code + response.data.Message);
+        }
+      }).catch(error => {
+        this.$modal.msgError("鎺ュ彛璇锋眰澶辫触!");
+      });
+    },
+   // #endregion
 
     //#region 鏍规嵁鐢ㄦ埛鑾峰彇瀵瑰簲鑱屽憳銆侀儴闂ㄣ�侀攢鍞富绠�
     getCzyglByUser() {
diff --git a/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillList.vue b/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillList.vue
index 6cea393..b6db68c 100644
--- a/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillList.vue
+++ b/src/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillList.vue
@@ -128,7 +128,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button type="primary" icon="el-icon-document-copy" size="mini" :disabled="single"
-          @click="handleEdit(row = rowForm, OperationType = 1, copyType = 1)">澶嶅埗</el-button>
+          @click="handleEdit(row = rowForm, OperationType = 1, copyType = 1)" v-if="false">澶嶅埗</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="single" @click="handleDelete">鍒犻櫎
diff --git a/src/views/purchase/cgPoInStockBill/cgPoInStockBill.vue b/src/views/purchase/cgPoInStockBill/cgPoInStockBill.vue
index 8bb8a14..3b250b4 100644
--- a/src/views/purchase/cgPoInStockBill/cgPoInStockBill.vue
+++ b/src/views/purchase/cgPoInStockBill/cgPoInStockBill.vue
@@ -288,6 +288,8 @@
           >鍒犻櫎
         </el-button>
       </el-col>
+      
+      
       <el-col :span="1.5">
         <el-button
           type="primary"
@@ -401,6 +403,10 @@
         >
       </el-col>
       <el-col :span="1.5">
+        <el-button type="primary" icon="el-icon-tickets" size="mini"
+          @click="handlePush(row = rowForm, OperationType = 4)">涓嬫帹锛堥噰璐叆搴撳崟锛�</el-button>
+      </el-col>
+      <el-col :span="1.5">
         <el-button
           type="primary"
           icon="el-icon-download"
@@ -409,6 +415,7 @@
           >闅愯棌鍒楄缃�</el-button
         >
       </el-col>
+      
       <el-col :span="1.5">
         <el-button type="primary" icon="el-icon-help" size="mini" @click="handleSearch"
           >鎼� 绱�</el-button
@@ -499,6 +506,10 @@
         <div style="height: 70vh" v-if="openFlag_pushBarCode">
           <iframe :src="iframeUrl" frameborder="0" width="100%" height="100%"></iframe>
         </div>
+      </el-dialog>
+       <el-dialog title="涓嬫帹瀹归噰璐叆搴撳崟" :visible.sync="openPush" width="1480px" append-to-body class="xsckdBox" @close="close">
+        <push :OperationType='5' :propsData='pushData' :HSouceBillType=BillType
+         @editClose="pushClose" v-if="pushShow" />
       </el-dialog>
       <!-- 缂栬緫 -->
       <el-dialog
@@ -616,12 +627,13 @@
 <script>
 import axios from "axios";
 import RowSettings from "@/views/component/rowSettings";
+import Push from '@/views/CaiGouGuanLi/CaiGouRuKu/Kf_POStockInBillEdit'
 import gySource from "@/views/basic/gySource";
 import dayjs from "dayjs";
 
 export default {
   name: "cgPoInStockBill",
-  components: { RowSettings, gySource },
+  components: { RowSettings, gySource ,Push},
   props: {
     openPage: { type: String },
   },
@@ -629,6 +641,7 @@
     return {
       iframeUrl: "",
       activeSeach: "",
+      pushShow: false,
       dateRange: [],
       HModName: "cgPoInStockBill",
       editShow: false,
@@ -1198,6 +1211,37 @@
         return { background: "#ecf5ff" };
       }
     },
+
+     //鎵撳紑涓嬫帹缁勪欢寮圭獥
+    handlePush() {
+      if (this.rowList && this.rowList.length > 0) {
+        var dataArray = [];
+        for (var i = 0; i < this.rowList.length; i++) {
+            if (this.rowList[i].鐘舵�� != "宸插鏍�") {
+                this.$modal.msgError("涓嬫帹澶辫触锛佹墍閫夊崟鎹��" + this.rowList[i].鍗曟嵁鍙� + "銆戜笉涓哄凡瀹℃牳鐘舵��,涓嶅厑璁镐笅鎺紒")
+                return;
+            }
+            if (this.rowList[i].HQtyMust <= 0) {
+                this.$modal.msgError("涓嬫帹澶辫触锛佹墍閫夊崟鎹��" + this.rowList[i].鍗曟嵁鍙� + "銆戝搴斿彲涓嬫帹鏁伴噺蹇呴』澶т簬 0 锛�")
+                return;
+            }
+            var temp = {
+                "hmainid": this.rowList[i].hmainid
+                , "hsubid": this.rowList[i].hsubid
+                , "HBillType": this.rowList[i].HBillType
+            }
+            dataArray.push(temp);
+        }
+        var datajson = {
+            "data": dataArray
+        };
+        this.pushData = JSON.stringify(datajson)
+        this.pushShow = true
+        this.openPush = true
+      } else {
+          this.$modal.msgError("璇烽�夋嫨鏁版嵁涓嬫帹锛�")
+      }
+    },
     //鍙屽嚮琛�
     handleDblclick(row, column, cell, event) {
       this.OperationType = 3;
@@ -1206,6 +1250,7 @@
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
       // this.rowForm = {}
+      this.rowList = selection;
       this.ids = selection.map((item) => item.hmainid);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
@@ -1369,11 +1414,28 @@
       this.resetForm("queryForm");
       this.getList();
     },
+     //鍏抽棴涓嬫帹椤甸潰
+    pushClose(val) {
+      this.open = val
+      this.pushShow = false
+      this.openPush = val
+      this.clearData()
+      this.getList()
+    },
+    //娓呴櫎閫変腑鏁版嵁鐨勭紦瀛�
+    clearData(){
+      this.ids = []
+      this.multiple = true
+      this.single = true
+      this.OperationType = 0
+      this.copyType = 0
+    },
 
     //閫�鍑�
     close() {
       this.tableShow = true;
       this.openEdit = false;
+      this.pushShow = false;
       this.openFlag_pushBarCode = false;
       this.disabledFlag_pushBarCode = true;
       this.getList();

--
Gitblit v1.9.1