sakura 1 an în urmă
părinte
comite
3f893f50ca

+ 2 - 2
manager-admin/src/api/goodsExchange.js

@@ -183,9 +183,9 @@ export function warehouseOut(parmas) {
 
 // 获取商品档案/admin/erp/goods
 
-export function getGoodsInfo(params) {
+export function getGoodsInfo(params,id) {
   return request({
-    url: '/admin/erp/goods/getSkuByWarehouse',
+    url: `/admin/erp/goods/getSkuByWarehouse/${id}`,
     method: 'get',
     loaidng: false,
     params

+ 29 - 9
manager-admin/src/components/SkuEditor/src/main.vue

@@ -134,17 +134,17 @@
           </template>
         </el-table-column>
         <!--  -->
-        <el-table-column label="序列号" align="center" v-if="haveSn">
-          <template v-slot="{ row }">
-           <!--  <el-input
+          <!--<el-table-column label="序列号" align="center" v-if="haveSn">
+        <template v-slot="{ row }">
+             <el-input
               onKeyUp="value=value.replace(/[\W]/g,'')"
               v-model="row.sn_code"
               :controls="false"
               :max="99999999"
               style="width: 95%"
-            /> -->
+            />
           </template>
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column
           v-for="item in tableColumns"
           :key="item.key"
@@ -276,7 +276,7 @@
 
 <script>
 import * as Helper from "./helper";
-
+import { mapState } from 'vuex';
 export default {
   name: "SkuEditor",
   props: {
@@ -349,6 +349,9 @@ export default {
     skuRules() {
       return Helper.computedSkuRules(this.skuForm, this.params);
     },
+    ...mapState({
+      basicInfoData: state => state.basicInfoData
+    })
   },
   mounted() {
     this.init();
@@ -362,9 +365,14 @@ export default {
     haveSpec: {
       handler(val) {
         if(val){
-          //this.skuForm.skuList = [{}]
+          this.skuForm.skuList = [{}]
+          console.log(this.skuForm.skuList);
         }else{
-          //this.skuForm.skuList = [{sku:sessionStorage.getItem('sn')+'0000'}];
+          this.$nextTick(() => {
+            this.skuForm.skuList = [{sku:this.basicInfoData+'0000'}];
+          })
+
+          console.log(this.skuForm.skuList);
         }
         this.skuForm.selectedSpecs = [];
         this.skuForm.skuList = [];
@@ -388,11 +396,23 @@ export default {
     },
     sku_sn:{
       handler(val) {
-          //this.skuForm.skuList = [{sku:sessionStorage.getItem('sn')+'0000'}];
+          //this.skuForm.skuList = [{sku:this.basicInfoData+'0000'}];
+      },
+    },
+    basicInfoData: {
+      handler(newVal) {
+        this.updateInternalStateBasedOnBasicInfo(newVal);
       },
+      immediate: true // 立即以当前值触发回调
     }
   },
   methods: {
+    updateInternalStateBasedOnBasicInfo(data) {
+      // 假设 basicInfoData 包含 'haveSpec' 和 'haveSn' 字段
+      if (data) {
+        this.skuForm.skuList = [{sku:this.basicInfoData+'0000'}]
+      }
+    },
     // 初始化数据
     async init() {
       try {

+ 1 - 1
manager-admin/src/lang/zh.js

@@ -64,7 +64,7 @@ export default {
     warehouseList:'仓库列表',
     warehouseLocation:'库位区域',
     inventoryItem:'库位商品',
-
+    goodsUnderstockDetail:'调拨查看',
     sales: '销售管理',
     order: '订单列表',
     orderAdd: '创建订单',

+ 13 - 0
manager-admin/src/store/index.js

@@ -15,6 +15,19 @@ const store = new Vuex.Store({
     tagsView,
     user
   },
+  state: {
+    basicInfoData: ''
+  },
+  mutations: {
+    updateBasicInfoData(state, payload) {
+      state.basicInfoData = payload;
+    }
+  },
+  actions: {
+    setBasicInfoData({ commit }, data) {
+      commit('updateBasicInfoData', data);
+    }
+  },
   getters
 })
 

+ 4 - 1
manager-admin/src/styles/element-ui.scss

@@ -75,4 +75,7 @@
  .el-button--danger:focus {
    background-color: #F56C6C;
    border-color: #F56C6C;
- }
+ }
+  .el-table{
+  min-height: 530px !important;
+ }

+ 4 - 2
manager-admin/src/views/basicSetting/goods/editForm/BasicInfo.vue

@@ -220,8 +220,10 @@ export default {
   },
   methods: {
     snBlur(){
-      this.$emit('update-data', this.formData.sn);
-      sessionStorage.setItem("sn",this.formData.sn)
+      // 假设 localFormData 是你需要更新的数据
+      this.$store.dispatch('setBasicInfoData', this.formData.sn);
+     /*  this.$emit('update-data', this.formData.sn);
+      sessionStorage.setItem("sn",this.formData.sn) */
     },
     /** 获取分类 */
     getCategoryAllChildren() {

+ 6 - 1
manager-admin/src/views/basicSetting/goods/editForm/Sku.vue

@@ -40,6 +40,7 @@
 </template>
 <script>
 import SkuEditor from '@/components/SkuEditor'
+import { mapState } from 'vuex';
 export default {
   name: 'goodsEditFormSku',
   components: {
@@ -76,8 +77,12 @@ export default {
       skuDisabled:false
     }
   },
+  computed: {
+    ...mapState({
+      basicInfoData: state => state.basicInfoData
+    })
+  },
   mounted() {
-    console.log(this.basicInfoData);
     if(this.$route.params.id){
       this.skuDisabled=true
     }

+ 80 - 2
manager-admin/src/views/setting/serialList.vue

@@ -1,10 +1,47 @@
 <template>
   <div>
+    <div class="search">
+      <el-form ref="advancedForm" :model="advancedForm" label-width="160px">
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="商品条码">
+              <el-input
+                v-model="advancedForm.sn"
+                placeholder="请输入内容"
+                clearable
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="状态">
+              <el-select v-model="advancedForm.status" clearable>
+                <el-option
+                  v-for="item in statusList"
+                  :key="item.id"
+                  :label="item.label"
+                  :value="item.value"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <!-- <el-form-item label="出入库">
+              <el-select v-model="advancedForm.status">
+                <el-option key="WAIT" label="出库" value="WAIT" />
+                <el-option key="NEW" label="入库" value="NEW" />
+              </el-select>
+            </el-form-item> -->
+          </el-col>
+        </el-row>
+      </el-form>
+      <el-button @click="searchEvent"> 搜索 </el-button>
+    </div>
     <en-table-layout
       :tableData="tableData.data"
       :loading="loading"
       @selection-change="handleSelectionChange"
     >
+
       <div slot="toolbar" class="inner-toolbar">
         <div class="toolbar-btns">
           <el-button
@@ -29,13 +66,15 @@
             >批量打印</el-button
           >
         </div>
+<!--
         <div class="toolbar-search" style="display: flex; align-items: center">
+
           <span>商品编号/条码:</span>
           <en-table-search
             @search="searchEvent"
             placeholder="请输入关键字搜索"
           />
-        </div>
+        </div> -->
       </div>
 
       <template slot="table-columns">
@@ -43,7 +82,13 @@
         <el-table-column prop="goods_vo.sn" label="商品编号" />
         <el-table-column prop="goods_vo.name" label="商品名称" />
         <el-table-column prop="product_vo.spec_name" label="规格型号" />
+        <el-table-column prop="sku" label="sku" />
         <el-table-column prop="sn_code" label="序列号" />
+        <el-table-column prop="status" label="状态">
+          <template slot-scope="scope">
+            {{ typeName(scope.row.status) }}
+          </template>
+        </el-table-column>
         <el-table-column prop="out_house_id" label="出库单编号" />
         <el-table-column prop="entry_house_id" label="入库单编号" />
         <el-table-column label="操作" width="260">
@@ -231,6 +276,9 @@ export default {
       // 新增窗口选中的值
       snMultipleSelection: [],
       title: "",
+      statusList:[],
+      // 高级搜索数据
+      advancedForm: {},
     };
   },
   mounted() {
@@ -243,6 +291,15 @@ export default {
     ...mapGetters(["user"]),
   },
   methods: {
+    typeName(val) {
+      let name = "";
+      this.statusList.map((el) => {
+        if (el.value == val) {
+          return (name = el.label);
+        }
+      });
+      return name;
+    },
     close() {
       this.dialogVisible = false;
       this.snTableData = [];
@@ -416,7 +473,7 @@ export default {
     searchEvent(data) {
       this.params = {
         ...this.params,
-        keyword: data,
+        ...this.advancedForm
       };
       this.params.page_no = 1;
       this.GET_WarehouseList();
@@ -433,6 +490,9 @@ export default {
         .catch(() => {
           this.loading = false;
         });
+        API_Setting.getPage({ dictType: "sn_code_status" }).then((res) => {
+        this.statusList = res.data;
+      });
     },
   },
 };
@@ -475,4 +535,22 @@ export default {
   text-align: center;
   color: #aaaaaa;
 }
+.search {
+  display: flex;
+  align-items: center;
+  background: #fff;
+  overflow: hidden;
+  padding: 30px 10px 10px 10px;
+  /deep/ .el-form-item {
+    .el-form-item__content {
+      .el-input {
+        width: 200px;
+      }
+    }
+  }
+  .el-button {
+    margin-top: -19px;
+    margin-left: 20px;
+  }
+}
 </style>

+ 124 - 57
manager-admin/src/views/stock/goodsExchange/addInventory.vue

@@ -113,30 +113,42 @@
             <el-table-column label="条码">
               <template slot-scope="scope">
                 <span v-if="id">{{ scope.row.product_vo.bar_code }}</span>
-                <span v-else>{{ scope.row.bar_code }}</span>
+                <span v-else>{{ scope.row.product_vo.bar_code }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="序列号" >
+            <el-table-column label="序列号">
               <template slot-scope="scope">
-                <span >{{scope.row}}</span>
+                <div class="sn-code-container">
+                  <span v-for="item in scope.row.sn_code_list" :key="item.id">
+                    {{ item.sn_code }},
+                  </span>
+                </div>
                 <!-- <span v-if="id">{{ scope.row.product_vo.sn_code }}</span>
                 <span v-else>{{ scope.row.sn_code }}</span> -->
               </template>
             </el-table-column>
-            <el-table-column prop="product_vo.spec_name" label="规格型号" v-if="id">
+            <el-table-column
+              prop="product_vo.spec_name"
+              label="规格型号"
+              v-if="id"
+            >
               <!-- <template slot-scope="scope">
                 {{ scope.row.product_vo.spec_name }}
               </template> -->
             </el-table-column>
-            <el-table-column prop="spec_name" label="规格型号" v-else>
-             <!--  <template slot-scope="scope">
+            <el-table-column
+              prop="product_vo.spec_name"
+              label="规格型号"
+              v-else
+            >
+              <!--  <template slot-scope="scope">
                 {{ scope.row.spec_name }}
               </template> -->
             </el-table-column>
             <el-table-column label="单位">
               <template slot-scope="scope">
                 <span v-if="id">{{ scope.row.product_vo.unit }}</span>
-                <span v-else>{{ scope.row.unit }}</span>
+                <span v-else>{{ scope.row.product_vo.unit }}</span>
               </template>
             </el-table-column>
             <!--  <el-table-column label="订单数量">
@@ -153,25 +165,27 @@
                 ></el-input-number>
               </template>
             </el-table-column>
-           <!--  <el-table-column label="库存数量">
+            <!--  <el-table-column label="库存数量">
               <template slot-scope="scope">
                 {{ scope.row.usable_stock }}
               </template>
             </el-table-column>-->
             <el-table-column label="差异">
               <template slot-scope="scope">
-                {{ scope.row.num - sn_code_list.length || 0 }}
+                <span v-if="scope.row.sn_code_list">{{
+                  scope.row.num - scope.row.sn_code_list.length || 0
+                }}</span>
               </template>
             </el-table-column>
             <el-table-column
-            width="200"
+              width="200"
               label="操作"
               v-if="type !== 'detail' && type !== 'audit'"
             >
               <template slot-scope="scope">
                 <el-button
                   size="mini"
-                  @click="addSnCode(scope.row,scope.$index)"
+                  @click="addSnCode(scope.row, scope.$index)"
                   >添加序列号</el-button
                 >
                 <el-button
@@ -182,7 +196,6 @@
                   "
                   >删除</el-button
                 >
-
               </template>
             </el-table-column>
           </el-table>
@@ -207,7 +220,7 @@
         >入库
       </el-button>
       <el-button @click="printIng" v-if="type == 'audit'">打印</el-button>
-      <el-button @click="$router.back()">返回</el-button>
+      <el-button @click="toBack()">返回</el-button>
     </div>
 
     <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
@@ -234,7 +247,13 @@
         >
       </span>
     </el-dialog>
-    <el-dialog title="扫码入库" :visible.sync="scanDialogVisible" width="30%" :close-on-press-escape="false" :close-on-click-modal="false">
+    <el-dialog
+      title="扫码入库"
+      :visible.sync="scanDialogVisible"
+      width="30%"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+    >
       <el-form
         ref="scanGoodsForm"
         :model="scanGoodsForm"
@@ -278,19 +297,20 @@
             {{ scope.row.goods_vo.sn }}
           </template>
         </el-table-column>
-        <el-table-column prop="bar_code" label="商品条码"> </el-table-column>
-        <el-table-column prop="bar_code" label="序列号"></el-table-column>
+        <el-table-column prop="product_vo.bar_code" label="商品条码">
+        </el-table-column>
+        <!-- <el-table-column prop="" label="序列号"></el-table-column> -->
         <el-table-column prop="" label="商品名称">
           <template slot-scope="scope">
             {{ scope.row.goods_vo.name }}
           </template>
         </el-table-column>
-        <el-table-column prop="spec_name" label="规格型号">
-         <!--  <template slot-scope="scope">
+        <el-table-column prop="product_vo.spec_name" label="规格型号">
+          <!--  <template slot-scope="scope">
             {{ scope.row.spec_name }}
           </template> -->
         </el-table-column>
-        <el-table-column prop="unit" label="单位"> </el-table-column>
+        <el-table-column prop="product_vo.unit" label="单位"> </el-table-column>
         <!-- <el-table-column prop="product_list.stock_num" label="库存数量"> </el-table-column> -->
       </el-table>
       <!-- <el-pagination
@@ -327,12 +347,13 @@
             {{ scope.row.sn }}
           </template>
         </el-table-column>
-<!--         <el-table-column prop="member_id" label="客户">
+        <!--         <el-table-column prop="member_id" label="客户">
           <template slot-scope="scope">{{
             memberType(scope.row.member_id)
           }}</template>
         </el-table-column>
- -->        <el-table-column prop="order_time" label="下单时间">
+ -->
+        <el-table-column prop="order_time" label="下单时间">
           <template slot-scope="scope">{{
             scope.row.order_time | unixToDate
           }}</template>
@@ -364,7 +385,6 @@
         </el-table-column> -->
       </el-table>
       <el-pagination
-
         @size-change="handlePageSizeChange"
         @current-change="handlePageCurrentChange"
         :current-page="orderList.page_no"
@@ -375,11 +395,18 @@
       >
       </el-pagination>
       <span slot="footer" class="dialog-footer">
-        <el-button  @click="closeOrder">取 消</el-button>
+        <el-button @click="closeOrder">取 消</el-button>
         <el-button type="primary">确 定</el-button>
       </span>
     </el-dialog>
-    <el-dialog title="序列号" :visible.sync="snCodeVisible" width="30%" :close-on-press-escape="false" :close-on-click-modal="false">
+    <el-dialog
+      title="序列号"
+      @close="closeSncode"
+      :visible.sync="snCodeVisible"
+      width="30%"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+    >
       <el-form
         ref="scanGoodsForm"
         :model="scanGoodsForm"
@@ -548,11 +575,11 @@ export default {
           name: "门店自提",
         },
       ],
-      snCodeVisible:false,
-      sn_code:'',
-      sku:'',
-      sn_code_list:[],
-      index:''
+      snCodeVisible: false,
+      sn_code: "",
+      sku: "",
+      sn_code_list: [],
+      index: "",
     };
   },
   mounted() {
@@ -607,19 +634,33 @@ export default {
     ...mapGetters(["user"]),
   },
   methods: {
+    /* 返回出入明细 */
+    toBack() {
+      this.$router.push({
+        name: "goodsExchange",
+        params: { type: "second" },
+      });
+    },
+    closeSncode() {
+      this.sn_code = "";
+      this.snCodeVisible = false;
+    },
     //扫序列号goodsExchangeAddForm.product_list[this.index].sn_code_list
-    toSnCode(){
-      API_GoodsExchange.getSnCode('in',this.sku,this.sn_code).then(res=>{
-        this.sn_code_list.push(res)
-        this.sn_code=''
-        this.snCodeVisible=false
-      })
-      this.goodsExchangeAddForm.product_list[this.index].sn_code_list=this.sn_code_list
+    toSnCode() {
+      API_GoodsExchange.getSnCode("in", this.sku, this.sn_code).then((res) => {
+        /*  this.sn_code_list.push(res); */
+        this.sn_code = "";
+        this.snCodeVisible = false;
+        this.goodsExchangeAddForm.product_list[this.index].sn_code_list.push(
+          res
+        );
+      });
     },
-    addSnCode(row,index){
-     this.sku=row.product_vo.sku
-     this.index=index
-      this.snCodeVisible=true
+    addSnCode(row, index) {
+      /* this.goodsExchangeAddForm.product_list[index].sn_code_list =[] */
+      this.sku = row.product_vo.sku;
+      this.index = index;
+      this.snCodeVisible = true;
     },
     orderBtn() {
       API_order.getOrderList(this.params).then((res) => {
@@ -627,20 +668,20 @@ export default {
         this.orderVisible = true;
       });
     },
-    closeOrder(){
+    closeOrder() {
       this.orderVisible = false;
     },
-     /** 分页大小发生改变 */
-     handlePageSizeChange(size) {
+    /** 分页大小发生改变 */
+    handlePageSizeChange(size) {
       this.params.page_size = size;
-     API_order.getOrderList(this.params).then((res) => {
+      API_order.getOrderList(this.params).then((res) => {
         this.orderList = res;
       });
     },
     /** 分页页数发生改变 */
     handlePageCurrentChange(page) {
       this.params.page_no = page;
-     API_order.getOrderList(this.params).then((res) => {
+      API_order.getOrderList(this.params).then((res) => {
         this.orderList = res;
       });
     },
@@ -705,7 +746,6 @@ export default {
             }
           });
         });
-
       });
     },
     // 根据条码 序列号查询商品
@@ -748,6 +788,7 @@ export default {
       this.goodsList = val.map((el) => {
         el.product_id = el.id;
         el.goods_id = el.id;
+        el.sn_code_list = [];
         return el;
       });
     },
@@ -772,8 +813,8 @@ export default {
           console.log(res);
 
          }) */
-        this.goodsExchangeAddForm.product_list = this.goodsList;
-        console.log(this.goodsExchangeAddForm.product_list);
+        this.goodsExchangeAddForm.product_list = this.goodsList; //.map(el=>{el.sn_code_list=[]})
+        console.log(this.goodsList);
         this.goodsVisible = false;
       } else {
         this.$message.error("请选择商品信息");
@@ -787,9 +828,13 @@ export default {
     printIng() {},
     /* 扫条码 */
     toSearch() {
-     API_GoodsExchange.getProduct(this.goodsExchangeAddForm.warehouse_id,this.scanGoodsForm.bar_code).then((res) => {
-        this.goodsExchangeAddForm.product_list.push(res)
-        this.scanGoodsForm.bar_code=''
+      API_GoodsExchange.getProduct(
+        this.goodsExchangeAddForm.warehouse_id,
+        this.scanGoodsForm.bar_code
+      ).then((res) => {
+        res.sn_code_list = [];
+        this.goodsExchangeAddForm.product_list.push(res);
+        this.scanGoodsForm.bar_code = "";
         this.scanDialogVisible = false;
       });
     },
@@ -929,6 +974,11 @@ export default {
             this.$message.error("请选择商品!");
             return;
           }
+          params.product_list.map((el) => {
+            el.product_stock_id = el.id;
+            el.product_id = el.product_vo.id;
+            el.id = "";
+          });
           if (this.$route.name === "editInventory") {
             API_GoodsExchange.editWarehouseEntry(id, params).then(
               (response) => {
@@ -994,6 +1044,11 @@ export default {
             this.$message.error("请选择商品!");
             return;
           }
+          params.product_list.map((el) => {
+            el.product_stock_id = el.id;
+            el.product_id = el.product_vo.id;
+            el.id = "";
+          });
           /* */ if (this.$route.name === "editInventory") {
             /* params.contract_product_list.map(el=>{
             el.product_id=el.id
@@ -1071,20 +1126,23 @@ export default {
         this.$router.push({ name: "goodsExchange" });
       });
     }, */
-    // 选择出库单
+    // 选择入库商品明细
     async handleSelectWarehouseEntryBatch() {
       if (!this.goodsExchangeAddForm.warehouse_id) {
         this.$message.error("请先选择仓库!");
         return;
       }
-      API_GoodsExchange.getGoodsInfo(this.params).then((res) => {
+      API_GoodsExchange.getGoodsInfo(
+        this.params,
+        this.goodsExchangeAddForm.warehouse_id
+      ).then((res) => {
         let item = {};
-        res.map((el) => {
+        res.records.map((el) => {
           item.sn = el.goods_vo.sn;
           item.name = el.goods_vo.name;
           return item;
         });
-        this.goodsData = res;
+        this.goodsData = res.records;
         this.goodsVisible = true;
       });
       /* if (!this.goodsExchangeAddForm.warehouse_id) {
@@ -1180,9 +1238,15 @@ export default {
           this.goodsExchangeAddForm.change_time = Math.floor(
             this.goodsExchangeAddForm.change_time * 1000
           );
+          response.product_list.map(el=>{
+            if(!el.sn_code_list){
+              el.sn_code_list=[]
+            }
+          })
           this.goodsExchangeAddForm.distribution_name = response.staff_name;
           this.goodsExchangeAddForm.product_list =
-            response.product_list; /* .map((item) => {
+            response.product_list;
+            /* .map((item) => {
               //change_list
               item.name=item.goods_do.name
               item.sn=item.goods_do.sn
@@ -1289,7 +1353,10 @@ export default {
     }
   }
 }
-
+.sn-code-container {
+  max-height: 150px; /* 设置最大高度,超过这个高度将显示滚动条 */
+  overflow-y: auto; /* 垂直方向上溢出时显示滚动条 */
+}
 /deep/ {
   .el-input--suffix .el-input__inner {
     padding-right: 10px;

+ 6 - 5
manager-admin/src/views/stock/goodsExchange/checkInventory.vue

@@ -78,11 +78,12 @@
                 </template>
               </el-table-column>
               <el-table-column label="序列号">
-                <template slot-scope="scope">
-                  <span v-if="id">{{ scope.row.product_vo.sn_code }}</span>
-                  <span v-else>{{ scope.row.sn_code }}</span>
-                </template>
-              </el-table-column>
+              <template slot-scope="scope">
+                <span v-for="item in scope.row.sn_code_list" :key="item.id">{{item.sn_code}},</span>
+                <!--<span v-if="id">{{ scope.row.product_vo.sn_code }}</span>
+                    <span v-else>{{ scope.row.sn_code }}</span> -->
+              </template>
+            </el-table-column>
               <el-table-column prop="product_vo.spec_name" label="规格型号" v-if="id">
                 <!-- <template slot-scope="scope">
                   {{ scope.row.product_vo.spec_name.join("/") }}

+ 48 - 2
manager-admin/src/views/stock/goodsExchange/goodsExchange.vue

@@ -126,7 +126,23 @@
             {{ warehouseName(scope.row.warehouse_id) }}
           </template>
         </el-table-column>
-        <el-table-column prop="order_id" label="订单编号" />
+        <el-table-column prop="memo" label="出库类型" v-if="activeName=='first'">
+          <template slot-scope="scope">
+            <span >{{  outName(scope.row.type)  }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="memo" label="入库类型" v-else>
+          <template slot-scope="scope">
+            <span >{{  entryName(scope.row.type)  }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="order_id_list" label="订单编号" />
+        <el-table-column  label="状态">
+          <template slot-scope="scope">
+            <span v-if="activeName=='first'">{{  scope.row.has_submit=='Y'?'已出库':'未出库'  }}</span>
+            <span v-else>{{  scope.row.has_submit=='Y'?'已入库':'未入库'  }}</span>
+          </template>
+        </el-table-column>
         <el-table-column prop="memo" label="备注">
           <template slot-scope="scope">
             <span v-if="activeName=='first'">{{  scope.row.notes  }}</span>
@@ -196,6 +212,8 @@ export default {
       multipleSelection: [],
       goodsExchangeForm: {},
       activeName: "second",
+      entryList:[],
+      outList:[]
     };
   },
   mounted() {
@@ -219,6 +237,26 @@ export default {
   },
   methods: {
     //获取仓库名称
+   outName(val){
+      let name=''
+      this.outList.map(el=>{
+       if(el.value==val) {
+        return name=el.label
+       }
+      })
+      return name
+    },
+    //获取仓库名称
+    entryName(val){
+      let name=''
+      this.entryList.map(el=>{
+        if(el.value==val) {
+        return name=el.label
+       }
+      })
+      return name
+    },
+    //获取仓库名称
     warehouseName(val){
       let name=''
       this.warehouseList.map(el=>{
@@ -315,8 +353,16 @@ export default {
     },
     /** 获取部门 */
     GET_DeptList() {
-      API_Setting.getDeptList().then((response) => {
+      /* API_Setting.getDeptList().then((response) => {
         this.deptList = Foundation.buildTree(response, "0");
+      }); */
+      /* 入库类型 */
+      API_Setting.getPage({ dictType: "warehouse_entry_type" }).then((res) => {
+        this.entryList = res.data;
+      });
+      /* 出库类型 */
+      API_Setting.getPage({ dictType: "out_warehouse_type" }).then((res) => {
+        this.outList = res.data;
       });
     },
     /** 打印对账详情 */

+ 126 - 24
manager-admin/src/views/stock/goodsExchange/goodsExchangeAdd.vue

@@ -40,6 +40,7 @@
             :key="item.value"
             :label="item.label"
             :value="item.value"
+            :disabled="item.value=='SALE_OUT' ||item.value=='HAIL_OUT'"
           />
         </el-select>
       </el-form-item>
@@ -170,19 +171,26 @@
                 <span v-else>{{ scope.row.product_vo.bar_code }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="序列号">
+            <el-table-column label="序列号" v-if="sn_code_list">
               <template slot-scope="scope">
-                <span v-if="id">{{ scope.row.product_vo.sn_code }}</span>
-                <span v-else>{{ scope.row.product_vo.sn_code }}</span>
+                <span v-for="item in scope.row.sn_code_list" :key="item.id">{{item.sn_code}},</span>
               </template>
             </el-table-column>
-            <el-table-column prop="product_vo.spec_name" label="规格型号" v-if="id">
-             <!--  <template slot-scope="scope">
+            <el-table-column
+              prop="product_vo.spec_name"
+              label="规格型号"
+              v-if="id"
+            >
+              <!--  <template slot-scope="scope">
                 {{ scope.row.product_vo.spec_name.join("/") }}
               </template> -->
             </el-table-column>
-            <el-table-column prop="product_vo.spec_name" label="规格型号" v-else>
-             <!--  <template slot-scope="scope">
+            <el-table-column
+              prop="product_vo.spec_name"
+              label="规格型号"
+              v-else
+            >
+              <!--  <template slot-scope="scope">
                 {{ scope.row.product_vo.spec_name.join("/") }}
               </template> -->
             </el-table-column>
@@ -215,10 +223,16 @@
               </template>
             </el-table-column>
             <el-table-column
+            width="200"
               label="操作"
               v-if="type !== 'detail' && type !== 'audit'"
             >
               <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  @click="addSnCode(scope.row,scope.$index)"
+                  >添加序列号</el-button
+                >
                 <el-button
                   size="mini"
                   type="danger"
@@ -251,7 +265,7 @@
         >出库
       </el-button>
       <el-button @click="printIng" v-if="type == 'audit'">打印</el-button>
-      <el-button @click="$router.back()">返回</el-button>
+      <el-button @click="toBack()">返回</el-button>
     </div>
 
     <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
@@ -294,19 +308,42 @@
             :maxlength="100"
           ></el-input>
         </el-form-item>
-        <el-form-item label="序列号" prop="sn_code">
+        <!-- <el-form-item label="序列号" prop="sn_code">
           <el-input
             v-model="scanGoodsForm.sn_code"
             :minlength="0"
             :maxlength="100"
           ></el-input>
-        </el-form-item>
+        </el-form-item> -->
       </el-form>
       <span slot="footer" class="dialog-footer">
         <!-- <el-button @click="dialogVisible = false">取 消</el-button>
         <el-button type="primary" @click="handleRejectGoodsExchange()">确 定</el-button> -->
       </span>
     </el-dialog>
+    <el-dialog
+      title="序列号"
+      :visible.sync="snCodeVisible"
+      width="30%"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+    >
+      <el-form
+        ref="scanGoodsForm"
+        :model="scanGoodsForm"
+        label-width="120px"
+        inline
+      >
+        <el-form-item label="序列号" prop="sn_code">
+          <el-input
+            v-model="sn_code"
+            @keyup.enter.native="toSnCode()"
+            :minlength="0"
+            :maxlength="100"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
     <!-- <el-dialog
       title="出库商品"
       :visible.sync="goodsVisible"
@@ -442,6 +479,11 @@ export default {
       // 暂存已勾选商品
       goodsList: [],
       product_list: [],
+      snCodeVisible: false,
+      sn_code: "",
+      sku: "",
+      sn_code_list: [],
+      index: "",
     };
   },
   mounted() {
@@ -494,14 +536,39 @@ export default {
     ...mapGetters(["user"]),
   },
   methods: {
+     /* 返回出入明细 */
+     toBack() {
+      this.$router.push({
+        name: "goodsExchange",
+        params: { type: "first" },
+      });
+    },
+    //扫序列号goodsExchangeAddForm.product_list[this.index].sn_code_list
+    toSnCode() {
+      API_GoodsExchange.getSnCode("out", this.sku, this.sn_code).then((res) => {
+        //this.sn_code_list.push(res);
+        this.sn_code = "";
+        this.snCodeVisible = false;
+        console.log(this.goodsExchangeAddForm.product_list);
+         this.goodsExchangeAddForm.product_list[this.index].sn_code_list.push(res);
+
+      });
+
+    },
+    addSnCode(row, index) {
+      this.sku = row.product_vo.sku;
+      this.index = index;
+      this.snCodeVisible = true;
+    },
     //获取出库类型字典
     outType() {
       API_Setting.getPage({ dictType: "out_warehouse_type" }).then((res) => {
-        this.typeList = res.data.filter((el) => {
+        this.typeList = res.data
+        /* .filter((el) => {
           if (el.value !== "SALE_OUT" && el.value !== "HAIL_OUT") {
             return el;
           }
-        });
+        }); */
       });
     },
     /*//商品对应字段
@@ -534,13 +601,25 @@ export default {
       },*/
     // 打印功能
     printIng() {},
+    /* 出库扫码 */
     toSearch() {
-      API_GoodsExchange.getGoodsInfo({
-        barcode: this.scanGoodsForm.bar_code,
-      }).then((res) => {});
+      API_GoodsExchange.getProduct(
+        this.goodsExchangeAddForm.warehouse_id,
+        this.scanGoodsForm.bar_code
+      ).then((res) => {
+        res.sn_code_list=[]
+        this.goodsExchangeAddForm.product_list.push(res);
+        console.log(this.goodsExchangeAddForm.product_list);
+        this.scanGoodsForm.bar_code = "";
+        this.scanDialogVisible = false;
+      });
     },
     // 扫码入库
     scanCode() {
+      if (!this.goodsExchangeAddForm.warehouse_id) {
+        this.$message.error("请先选择仓库!");
+        return;
+      }
       this.scanDialogVisible = true;
       this.$nextTick(() => {
         this.$refs.input.focus();
@@ -662,15 +741,22 @@ export default {
           params.change_time = Math.floor(params.change_time / 1000);
 
           if (!this.goodsExchangeAddForm.product_list.length) {
-
             return;
           }
-          params.product_list.map((el) => {
-            if(el.out_num<el.usable_stock){
+          const isStockSufficient = params.product_list.map((el) => {
+            if (el.out_num > el.usable_stock) {
               this.$message.error("该商品库存不足!");
-              return
+              return false
             }
+            return true
           });
+          if (!isStockSufficient) {
+                return;
+              }
+          params.product_list.map(el=>{
+            el.product_stock_id=el.id
+            el.id=''
+          })
           if (this.$route.name === "goodsExchangeEdit") {
             API_GoodsExchange.editWarehouseOut(id, params).then((response) => {
               this.$message.success("修改成功!");
@@ -724,11 +810,20 @@ export default {
             this.$message.error("请选择商品!");
             return;
           }
-          params.product_list.map((el) => {
-            if(el.out_num<el.usable_stock){
+           params.product_list.map(el=>{
+            el.product_stock_id=el.id
+            el.id=''
+          })
+          const isStockSufficient = params.product_list.map((el) => {
+            if (el.out_num > el.usable_stock) {
               this.$message.error("该商品库存不足!");
-              return
-            }})
+              return false
+            }
+            return true
+          });
+          if (!isStockSufficient) {
+                return;
+              }
           if (this.$route.name === "goodsExchangeEdit") {
             API_GoodsExchange.editWarehouseOut(id, params).then((response) => {
               this.$message.success("修改成功!");
@@ -778,8 +873,10 @@ export default {
           warehouse_id: this.goodsExchangeAddForm.warehouse_id,
         },
       });
+      goodsData.purchasePlans.map(el=>{el.sn_code_list=[]})
       this.goodsExchangeAddForm.warehouse_id = goodsData.warehouse_id;
-      this.goodsExchangeAddForm.product_list = goodsData.purchasePlans; /*.map(
+      this.goodsExchangeAddForm.product_list = goodsData.purchasePlans;
+      console.log(this.goodsExchangeAddForm.product_list);/*.map(
         (item) => {
           //
            item.amount = item.entry_price;
@@ -857,6 +954,11 @@ export default {
           this.goodsExchangeAddForm.change_time = Math.floor(
             this.goodsExchangeAddForm.change_time * 1000
           );
+          response.product_list.map(el=>{
+            if(!el.sn_code_list){
+              el.sn_code_list=[]
+            }
+          })
           this.goodsExchangeAddForm.distribution_name = response.staff_name;
           this.goodsExchangeAddForm.product_list =
             response.product_list; /*.map((item) => {

+ 2 - 1
manager-admin/src/views/stock/goodsInventory/goodsInventoryAdd.vue

@@ -307,7 +307,8 @@ export default {
               product_id:item.product_id,
               specification: item.product_specification,
               unit: item.product_unit,
-              remark: item.remark
+              remark: item.remark,
+              product_stock_id:item.id
             }
             return query
           })

+ 1 - 0
manager-admin/src/views/stock/goodsInventoryLoss/goodsInventoryLossAdd.vue

@@ -307,6 +307,7 @@ export default {
             const query = {
               report_num:item.report_num,
               product_id: item.product_id,
+              product_stock_id:item.id
             }
             return query
           })

+ 1 - 0
manager-admin/src/views/stock/goodsUnderstockAdd.vue

@@ -335,6 +335,7 @@ export default {
               num: item.num,
               use_able_num: Number(item.usable_stock),
               product_id: item.product_id,
+              product_stock_id:item.id
             };
             return query;
           });

+ 5 - 2
manager-admin/src/views/stock/orderAdd.vue

@@ -1079,11 +1079,14 @@ export default {
       //设置时间
       delete this.OrderForm.start_time;
       delete this.OrderForm.end_time;
-      if (this.time) {
+      if (this.time && this.time.length >= 2) {
         this.OrderForm.start_time = this.time[0];
         this.OrderForm.end_time = this.time[1];
+      } else {
+          console.error("时间数组不完整:", this.time);
+          // 可以设置一些默认值或进行错误处理
       }
-      delete this.time;
+
       var loc = "";
       for (let i = 0; i < this.selectedOptions.length; i++) {
         loc += codeToText[this.selectedOptions[i]] + ",";