Browse Source

产品组合完成

cz 2 years ago
parent
commit
b01ba31c2a

+ 42 - 0
src/api/inventory-management/combination.js

@@ -0,0 +1,42 @@
+import request from '@/router/axios'
+
+// 产品组合列表
+export function getCombinationList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/stockCombination/page',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+
+// 产品组合添加
+export function addCombination(data = {}) {
+  return request({
+    url: '/api/victoriatourist/stockCombination/add',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 获取可组合数量
+export function getCanQuantity(data = {}) {
+  return request({
+    url: '/api/victoriatourist/stockCombination/getQuantityByWarehouseId',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 获取可组合数量
+export function getCombinationNameList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/stockCombination/getCombinationList',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+

+ 6 - 5
src/views/inbound-outbound/arrivalInspection/index.vue

@@ -38,9 +38,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
         keyword: "",
-        outWarehouseId: "",
-        inWarehouseId: "",
-        inStatus: "",
+        status: "",
       },
       selectConfig: [
         {
@@ -49,7 +47,7 @@ export default {
           data: [],
         },
       ],
-      tableList: [{}],
+      tableList: [],
       total: 0,
       loading: false,
       titleText: "到货质检",
@@ -224,7 +222,10 @@ export default {
         />
         <el-table-column label="操作" align="center" width="120">
           <template slot-scope="scope">
-            <el-button type="text" @click="handleReceive(scope.row)"
+            <el-button
+              type="text"
+              @click="handleReceive(scope.row)"
+              v-if="scope.row.status < 3"
               >质检
             </el-button>
           </template>

+ 2 - 1
src/views/inbound-outbound/inbound/cgInbound/index.vue

@@ -112,7 +112,8 @@ export default {
             let list = res.data.data;
             list = list.map((x) => ({
               ...x,
-              changeQuantity: x.shipmentQuantity,
+              changeQuantity:
+                Number(x.shipmentQuantity) - Number(x.receiptQuantity),
             }));
             this.form = {
               id: row.id,

+ 71 - 92
src/views/inventory-management/combination/addCombination.vue

@@ -9,19 +9,32 @@
         label-width="100px"
       >
         <el-row>
-          <el-form-item label="组合名称">
-            <el-input v-model="form.sum" placeholder="请输入"> </el-input>
+          <el-form-item label="组合名称" prop="productId">
+            <el-select
+              v-model="form.productId"
+              placeholder="请选择"
+              style="width: 100%"
+              @change="handleGetCanQuantity"
+            >
+              <el-option
+                v-for="item in combinationNameList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
           </el-form-item>
         </el-row>
-        <el-row> 规格:xxxxxxxx </el-row>
-        <el-form-item label="组合后放置仓库" prop="supplieId">
+        <!-- <el-row> 规格:xxxxxxxx </el-row> -->
+        <el-form-item label="组合后放置仓库" prop="combinationWarehouseId">
           <el-select
-            v-model="form.supplieId"
+            v-model="form.combinationWarehouseId"
             placeholder="请选择"
             style="width: 100%"
           >
             <el-option
-              v-for="item in supplySelectList"
+              v-for="item in warehouseSelectList"
               :key="item.id"
               :label="item.name"
               :value="item.id"
@@ -29,14 +42,15 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="半成品所在仓库" prop="supplieId">
+        <el-form-item label="半成品所在仓库" prop="sourceWarehouseId">
           <el-select
-            v-model="form.supplieId"
+            v-model="form.sourceWarehouseId"
             placeholder="请选择"
             style="width: 100%"
+            @change="handleGetCanQuantity"
           >
             <el-option
-              v-for="item in supplySelectList"
+              v-for="item in warehouseSelectList"
               :key="item.id"
               :label="item.name"
               :value="item.id"
@@ -47,20 +61,23 @@
 
         <el-row>
           <el-col :span="8">
-            <el-form-item label="组合数量">
-              <el-input v-model="form.sum" placeholder="请输入"> </el-input>
+            <el-form-item label="组合数量" prop="combinationQuantity">
+              <el-input
+                v-model="form.combinationQuantity"
+                :disabled="canQuantity === 0"
+                placeholder="请输入"
+              >
+              </el-input>
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row> 可组合数量:3000 </el-row>
+        <div style="color: #999999">可组合数量:{{ canQuantity }}</div>
       </el-form>
     </div>
     <div style="text-align: center; margin-top: 15px">
-      <el-button size="small" @click="handleCancel"
-        >{{ $t("cancel") }}
-      </el-button>
+      <el-button size="small" @click="handleCancel">取消 </el-button>
       <el-button type="primary" size="small" @click="handleSubmit">
-        {{ $t("submit") }}</el-button
+        确定</el-button
       >
     </div>
   </div>
@@ -68,8 +85,13 @@
 
 <script>
 import labelTitle from "@/components/label-title/index.vue";
-
 import { getToken } from "@/util/auth";
+import {
+  getCombinationNameList,
+  getCanQuantity,
+} from "@/api/inventory-management/combination.js";
+
+import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
 
 export default {
   name: "addReturnsGoods",
@@ -79,18 +101,6 @@ export default {
       type: Object,
       default: () => {},
     },
-    supplySelectList: {
-      type: Array,
-      default: () => [],
-    },
-    supplyTypeList: {
-      type: Array,
-      default: () => [],
-    },
-    productTypeList: {
-      type: Array,
-      default: () => [],
-    },
   },
   data() {
     return {
@@ -98,95 +108,64 @@ export default {
         Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
         "Blade-Auth": "bearer " + getToken(),
       },
-
       loading: false,
+      warehouseSelectList: [],
+      combinationNameList: [],
+      canQuantity: 0,
       formRules: {
-        supplieId: [
+        productId: [
           {
             required: true,
-            message:
-              this.$t("pleaseSelect") +
-              this.$t("purchase_management.purchase.selectSupply"),
+            message: "请选择组合名称",
             trigger: "change",
           },
         ],
-        planArrivalTime: [
+        combinationWarehouseId: [
           {
             required: true,
-            message:
-              this.$t("pleaseSelect") +
-              this.$t("purchase_management.purchase.askArrivalTime"),
+            message: "请选择组合后放置仓库",
             trigger: "change",
           },
         ],
-        countryId: [
+        sourceWarehouseId: [
           {
             required: true,
-            message:
-              this.$t("pleaseSelect") +
-              this.$t("purchase_management.purchase.country"),
+            message: "请选择半成品所在仓库",
             trigger: "change",
           },
         ],
-        provinceId: [
+        combinationQuantity: [
           {
             required: true,
-            message:
-              this.$t("pleaseSelect") +
-              this.$t("purchase_management.purchase.province"),
-            trigger: "change",
-          },
-        ],
-        cityId: [
-          {
-            required: true,
-            message:
-              this.$t("pleaseSelect") +
-              this.$t("purchase_management.purchase.city"),
-            trigger: "change",
-          },
-        ],
-        type: [
-          {
-            required: true,
-            message:
-              this.$t("pleaseSelect") +
-              this.$t("purchase_management.purchase.purchaseType"),
-            trigger: "change",
-          },
-        ],
-        name: [
-          {
-            required: true,
-            message:
-              this.$t("pleaseInput") +
-              this.$t("purchase_management.purchase.purchaseName"),
-            trigger: "blur",
-          },
-        ],
-        contacts: [
-          {
-            required: true,
-            message:
-              this.$t("pleaseInput") +
-              this.$t("purchase_management.purchase.contacts"),
-            trigger: "blur",
-          },
-        ],
-        phone: [
-          {
-            required: true,
-            message:
-              this.$t("pleaseInput") +
-              this.$t("purchase_management.purchase.contactNumber"),
+            message: "请输入组合数量",
             trigger: "blur",
           },
         ],
       },
     };
   },
-  created() {},
+  created() {
+    this.getData();
+  },
   methods: {
+    getData() {
+      getCombinationNameList().then((res) => {
+        this.combinationNameList = res.data.data;
+      });
+      warehouseSelectList().then((res) => {
+        this.warehouseSelectList = res.data.data;
+      });
+    },
+    handleGetCanQuantity() {
+      if (this.form.productId && this.form.sourceWarehouseId) {
+        getCanQuantity({
+          productId: this.form.productId,
+          sourceWarehouseId: this.form.sourceWarehouseId,
+        }).then((res) => {
+          this.canQuantity = res.data.data;
+        });
+      }
+    },
     handleSubmit() {
       this.$refs.form.validate((valid) => {
         if (valid) {

+ 44 - 117
src/views/inventory-management/combination/index.vue

@@ -3,10 +3,9 @@
 <script>
 import test from "@/components/form-test/index.vue";
 import query from "@/components/query/index.vue";
-
 import byTable from "@/components/by-table/index.js";
 import addCombination from "./addCombination.vue";
-import { supplySelect } from "@/api/product-material/supply/index.js";
+import * as API from "@/api/inventory-management/combination.js";
 
 export default {
   components: {
@@ -17,8 +16,6 @@ export default {
   },
   data() {
     return {
-      supplyTypeList: [],
-      supplySelectList: [],
       btnForm: {
         otherButton: {
           list: [
@@ -37,14 +34,6 @@ export default {
         pageNum: 1,
         pageSize: 10,
         keyword: "",
-        warehouseId: "",
-        status: "",
-        code: "",
-        goodsCode: "",
-        goodsName: "",
-        applyUserId: "",
-        startTime: "",
-        endTime: "",
       },
       selectConfig: [
         // {
@@ -57,40 +46,26 @@ export default {
       loading: false,
       titleText: "组合操作",
       open: false,
-      form: {
-        id: "",
-        receiptWarehouseId: "",
-        planArrivalTime: "",
-        cause: "",
-        goodsId: [{}],
-      },
+      form: {},
     };
   },
   created() {
     const businessDictData = JSON.parse(
       window.localStorage.getItem("businessDict")
     );
-
-    this.supplyTypeList = businessDictData.find(
-      (item) => item.code === "supplyType"
-    ).children;
-
-    supplySelect({ name: "", code: "", type: "" }).then((res) => {
-      this.supplySelectList = res.data.data;
-    });
-    // this.getList();
+    this.getList();
   },
   methods: {
     getList() {
       this.loading = true;
-      API.outboundList(this.queryParams).then(
+      API.getCombinationList(this.queryParams).then(
         (res) => {
           this.tableList = res.data.data.records;
           this.total = res.data.data.total;
           this.loading = false;
         },
         (err) => {
-          console.log("outboundList: " + err);
+          console.log("getCombinationList: " + err);
           this.loading = false;
         }
       );
@@ -100,84 +75,29 @@ export default {
     },
     handleAdd() {
       this.form = {
-        id: "",
-        receiptWarehouseId: "",
-        planArrivalTime: "",
-        cause: "",
-        goodsId: [],
+        productId: "",
+        combinationWarehouseId: "",
+        sourceWarehouseId: "",
+        combinationQuantity: "",
       };
       this.open = true;
     },
     handleCancel() {
-      this.form = {
-        id: "",
-        receiptWarehouseId: "",
-        planArrivalTime: "",
-        cause: "",
-        goodsId: [],
-      };
       this.open = false;
     },
-    handleEdit(row) {
-      this.form = row;
-      this.open = true;
-      if (this.form.fileInfoList === "") {
-        this.form.fileInfoList = [];
-      }
-      this.$nextTick(() => {
-        this.$refs.addCustomer.loading = true;
-        this.$refs.addCustomer.countryChange(this.form.countryId);
-        this.$refs.addCustomer.provinceChange(this.form.provinceId);
-        this.$refs.addCustomer.loading = false;
-      });
-    },
+    handleEdit(row) {},
     handleSubmit() {
-      if (!this.form.id) {
-        API.outboundAdd(this.form).then(
-          () => {
-            this.msgSuccess(this.$t("addSuccess"));
-            this.$refs.addCustomer.loading = false;
-            this.open = false;
-            this.getList();
-          },
-          (err) => {
-            console.log("outboundAdd: " + err);
-            this.$refs.addCustomer.loading = false;
-          }
-        );
-      } else {
-        API.outboundEdit(this.form).then(
-          () => {
-            this.msgSuccess(this.$t("editSuccess"));
-            this.open = false;
-            this.$refs.addCustomer.loading = false;
-            this.getList();
-          },
-          (err) => {
-            console.log("outboundEdit: " + err);
-            this.$refs.addCustomer.loading = false;
-          }
-        );
-      }
-    },
-
-    handleDelete(row) {
-      this.$confirm(this.$t("askDeleteData"), {
-        confirmButtonText: this.$t("submitText"),
-        cancelButtonText: this.$t("cancelText"),
-        type: "warning",
-      }).then(() => {
-        API.outboundDel({ id: row.id }).then(() => {
-          this.msgSuccess(this.$t("deleteSuccess"));
+      API.addCombination(this.form).then(
+        () => {
+          this.msgSuccess("操作成功");
+          this.$refs.addCombination.loading = false;
+          this.open = false;
           this.getList();
-        });
-      });
-    },
-    showAddress(row) {
-      return (
-        <div>
-          {row.countryName} , {row.provinceName} , {row.cityName}
-        </div>
+        },
+        (err) => {
+          console.log("addCombination: " + err);
+          this.$refs.addCombination.loading = false;
+        }
       );
     },
   },
@@ -194,7 +114,7 @@ export default {
       <query
         :selectConfig="selectConfig"
         :req="queryParams"
-        :isShowMore="true"
+        :isShowMore="false"
         @handleQuery="handleQuery"
         @handleMore="
           () => {
@@ -203,24 +123,34 @@ export default {
         "
       ></query>
       <el-table :data="tableList" v-loading="loading">
-        <el-table-column label="产品组合编码" align="left" prop="code" />
-
-        <el-table-column label="产品组合名称" align="left" prop="code" />
-        <el-table-column label="规格" align="left" prop="name" />
-        <el-table-column label="单位" align="left" :formatter="showAddress" />
-        <el-table-column label="组合后放置仓库" align="left" prop="contacts" />
-        <el-table-column label="半成品所在仓库" align="left" prop="phone" />
-        <el-table-column label="组合数量" align="left" prop="phone" />
-        <el-table-column label="操作人" align="left" prop="phone" />
-        <el-table-column label="操作时间" align="left" prop="phone" />
-
-        <el-table-column label="操作" align="left" width="120">
+        <el-table-column label="产品组合编码" align="left" prop="productCode" />
+        <el-table-column label="产品组合名称" align="left" prop="productName" />
+        <el-table-column label="规格" align="left" prop="productSpecs" />
+        <el-table-column label="单位" align="left" prop="productUnit" />
+        <el-table-column
+          label="组合后放置仓库"
+          align="left"
+          prop="sourceWarehouseName"
+        />
+        <el-table-column
+          label="半成品所在仓库"
+          align="left"
+          prop="combinationWarehouseName"
+        />
+        <el-table-column
+          label="组合数量"
+          align="left"
+          prop="combinationQuantity"
+        />
+        <el-table-column label="操作人" align="left" prop="createUserName" />
+        <el-table-column label="操作时间" align="left" prop="createTime" />
+        <!-- <el-table-column label="操作" align="left" width="120">
           <template slot-scope="scope">
             <el-button type="text" @click="handleEdit(scope.row)"
               >查看
             </el-button>
           </template>
-        </el-table-column>
+        </el-table-column> -->
       </el-table>
     </el-card>
 
@@ -233,9 +163,6 @@ export default {
     >
       <add-combination
         :form="form"
-        :supplyTypeList="supplyTypeList"
-        :supplySelectList="supplySelectList"
-        :productTypeList="productTypeList"
         @submit="handleSubmit"
         @cancel="handleCancel"
         ref="addCombination"