@@ -31,28 +77,71 @@ const PositionDetail = ({ curPos, handleCloseDetail }) => {
仓位详情
-
+
+
-
仓位
-
货物编号:
-
货物名称:
-
货物类型:
-
货物数量:
-
仓位状态:
+
+ 仓位
+
+ {curPos.productVOList &&
+ curPos.productVOList.map((item) => (
+ <>
+
货物编号:{item.productId}
+
货物名称:{item.productName}
+
货物类型:{item.productType}
+
货物数量:{item.productNum}
+ >
+ ))}
+
+ 仓位状态:
+ {isEditing ? (
+
+
+
+
+
+ ) : (
+
+ )}
+
-
+
{isEditing ? (
<>
-
+
+ {/* Delete Modal */}
+ {isDeleteModalVisible && (
+
+ ⚠️ 确定删除该仓位吗?
+
+ )}
);
};
diff --git a/src/components/System/Ware/PositionItem.jsx b/src/components/System/Ware/PositionItem.jsx
index a691adf..dd3e7dd 100644
--- a/src/components/System/Ware/PositionItem.jsx
+++ b/src/components/System/Ware/PositionItem.jsx
@@ -9,7 +9,7 @@ const PositionItem = ({ item, onClick }) => {
whileTap={{ scale: 0.75 }}
onClick={onClick}
className={`${
- item.positionStatus ? "bg-[#2BA80A] text-white" : "bg-[B22222]"
+ item.positionStatus ? "bg-[#2BA80A] text-white" : "bg-[#dbdbdb]"
} w-[100px] h-[40px] text-center py-2 hover:cursor-pointer`}
>
{item.positionNum}
--
Gitee
From 09a90d5db019d0f38d4114504f755c78b9b70e55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8C=83=E7=8E=89=E7=90=B3?= <1584592841@qq.com>
Date: Mon, 18 Jul 2022 21:13:01 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=93=E7=AE=A1=E5=91=98=20=E5=87=BA?=
=?UTF-8?q?=E5=85=A5=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/WareClerk/GoodsIn.jsx | 252 ++++++++++++++++++++++----
src/components/WareClerk/GoodsOut.jsx | 60 ++++--
2 files changed, 259 insertions(+), 53 deletions(-)
diff --git a/src/components/WareClerk/GoodsIn.jsx b/src/components/WareClerk/GoodsIn.jsx
index 1324702..241012d 100644
--- a/src/components/WareClerk/GoodsIn.jsx
+++ b/src/components/WareClerk/GoodsIn.jsx
@@ -1,30 +1,101 @@
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
import { useLocation } from "react-router-dom";
-import { Table, Modal } from "antd";
+import { Table, Modal, Button, message } from "antd";
+import axios from "axios";
+import InputArea from "../InputArea";
import Selector from "../Selector";
-import { goods } from "../../utils/data";
+
+const editCSS =
+ "pl-0 mt-1 w-20 rounded border-2 border-b-blue-200 outline-none focus:ring focus:ring-blue-300 focus:border-white duration-150 ease-in";
const GoodsIn = () => {
const location = useLocation();
- console.log(location.state);
- let orderlist = location.state.record.orderdetailsList;
+ const ownerIC = location.state.record.orderOwner;
+
+ const [repositoryRaw, setRepositoryRaw] = useState([]);
+ const [repositoryList, setRepositoryList] = useState([]);
+ const [orderList, setOrderList] = useState(
+ location.state.record.orderdetailsList
+ );
+ const [posList, setPosList] = useState([]);
+
+ //当前选中的货物信息
+ const [curGoods, setCurGoods] = useState("");
+ const [curIndex, setCurIndex] = useState(0);
+ //仓库 仓位 入库数量
+ const [repoSelected, setRepoSelected] = useState("");
+ const [posSelected, setPosSelected] = useState("");
+ const [inAmount, setInAmount] = useState(0);
+
+ const [inventoryList, setInventoryList] = useState([]);
+
+ const [loading, setLoading] = useState(false);
+ const [isInfoCompleted, setIsInfoCompleted] = useState(false);
const [isModalVisible, setIsModalVisible] = useState(false);
const [isCancelModalVisible, setIsCancelModalVisible] = useState(false);
const [isRightModalVisible, setIsRightModalVisible] = useState(false);
- const showModal = (item) => {
- // setCurData(item);
+ const showModal = (item, index) => {
+ setCurGoods(item);
+ setCurIndex(index);
setIsModalVisible(true);
};
- const showRightModal = () => {
+ const showRightModal = (record) => {
+ // console.log(record);
setIsRightModalVisible(true);
};
const handleOk = () => {
+ let list = [...inventoryList];
+ let singleGoods = {
+ inventoryOwner: ownerIC,
+ inventoryProduct: curGoods.productId,
+ inventoryProductName: curGoods.productName,
+ inventoryRepository: repoSelected,
+ inventoryPosition: posSelected,
+ inventoryNum: inAmount,
+ };
+ list.push(singleGoods);
+ setInventoryList([...list]);
+
+ let goodsList = [...orderList];
+ singleGoods = {
+ ...curGoods,
+ amount: curGoods.amount - inAmount,
+ };
+
+ if (singleGoods.amount === 0) {
+ goodsList.splice(curIndex, 1);
+ } else {
+ goodsList.splice(curIndex, 1, singleGoods);
+ }
+ setOrderList(goodsList);
+
+ setRepoSelected("");
+ setPosSelected("");
+ setInAmount(0);
setIsModalVisible(false);
+ // axios
+ // .post("http://127.0.0.1:8088/admin/ware-clerk/tasks/goods-in/goods", {
+ // ...singleGoods
+ // })
+ // .then((res) => {
+ // if (res.data.code === 10000) {
+ // message.success(res.data.message);
+ // list.push(singleGoods);
+ // setInventoryList([...list]);
+ // setIsModalVisible(false);
+ // } else {
+ // message.error(res.data.message);
+ // }
+ // })
+ // .catch((err) => {
+ // console.log(err);
+ // message.error(err);
+ // });
};
const handleCancel = () => {
@@ -32,6 +103,9 @@ const GoodsIn = () => {
};
const secondHandleOk = () => {
+ setRepoSelected("");
+ setPosSelected("");
+ setInAmount(0);
setIsCancelModalVisible(false);
setIsModalVisible(false);
};
@@ -41,10 +115,35 @@ const GoodsIn = () => {
setIsRightModalVisible(false);
};
+ const rightHandleOk = () => {
+ setIsRightModalVisible(false);
+ };
+
+ const rightHandleCancel = () => {};
+
+ const goodsInSubmit = () => {
+ axios
+ .post(
+ "http://127.0.0.1:8088/admin/ware-clerk/tasks/goods-in/order",
+ inventoryList
+ )
+ .then((res) => {
+ if (res.data.code === 10000) {
+ message.success(res.data.message);
+ } else {
+ message.error(res.data.message);
+ }
+ })
+ .catch((err) => {
+ console.log(err);
+ message.error(err);
+ });
+ };
+
const goodsColumns = [
{
title: "货品编号",
- dataIndex: "orderId",
+ dataIndex: "productId",
},
{
title: "货品名称",
@@ -57,10 +156,10 @@ const GoodsIn = () => {
{
title: "操作",
key: "action",
- render: (record) => {
+ render: (text, record, index) => {
return (
showModal(record)}
+ onClick={() => showModal(record, index)}
className="pr-2 text-blue-500 hover:underline"
>
入库
@@ -73,19 +172,23 @@ const GoodsIn = () => {
const inColumns = [
{
title: "货品编号",
- dataIndex: "id",
+ dataIndex: "inventoryProduct",
},
{
title: "货品名称",
- dataIndex: "name",
+ dataIndex: "inventoryProductName",
},
{
title: "仓库号",
- dataIndex: "in",
+ dataIndex: "inventoryRepository",
},
{
title: "仓位号",
- dataIndex: "in",
+ dataIndex: "inventoryPosition",
+ },
+ {
+ title: "入库件数",
+ dataIndex: "inventoryNum",
},
{
title: "操作",
@@ -103,6 +206,55 @@ const GoodsIn = () => {
},
];
+ //所有仓库
+ useEffect(() => {
+ axios
+ .get("http://127.0.0.1:8088/admin/system/ware-manage/queryAll")
+ .then((res) => {
+ if (res.data.code === 10000) {
+ setRepositoryRaw(res.data.data.repositoryList);
+ setRepositoryList(
+ res.data.data.repositoryList.map((item) => ({
+ id: item.repositoryId,
+ name: item.repositoryId,
+ }))
+ );
+ } else {
+ message.error(res.data.message);
+ }
+ })
+ .catch((err) => {
+ console.log(err);
+ message.error(err);
+ });
+ }, []);
+
+ //所有仓位
+ useEffect(() => {
+ let resObj = {};
+ for (let repo of repositoryList) {
+ Object.assign(resObj, {
+ [repo.id]: repositoryRaw
+ .filter((item) => item.repositoryId === repo.id)[0]
+ .positionVOList.filter((item) => item.positionStatus !== 0)
+ .map((item) => ({
+ id: item.positionId,
+ name: item.positionNum,
+ })),
+ });
+ }
+ setPosList(resObj);
+ }, [repositoryList]);
+
+ //检查输入完整性
+ useEffect(() => {
+ if (inAmount > curGoods.amount) {
+ setIsInfoCompleted(false);
+ } else {
+ setIsInfoCompleted(repoSelected && posSelected && inAmount);
+ }
+ }, [repoSelected, posSelected, inAmount]);
+
return (
@@ -130,9 +282,9 @@ const GoodsIn = () => {
货物明细
({
+ dataSource={orderList.map((item, index) => ({
...item,
- key: item.id,
+ key: index,
}))}
pagination={false}
scroll={{
@@ -144,9 +296,9 @@ const GoodsIn = () => {
入库详情
({
+ dataSource={inventoryList.map((item, index) => ({
...item,
- key: item.id,
+ key: index,
}))}
pagination={false}
scroll={{
@@ -156,7 +308,10 @@ const GoodsIn = () => {
-
+
入库确认
@@ -166,34 +321,55 @@ const GoodsIn = () => {
title="选择仓库"
visible={isModalVisible}
closable={false}
- onOk={handleOk}
- onCancel={handleCancel}
+ footer={[
+
+ {"取消"}
+ ,
+
+ {"确认"}
+ ,
+ ]}
>
-
+
-
+
setAdminCategory(e.target.value)}
+ value={repoSelected}
+ onChange={(e) => {
+ setRepoSelected(+e.target.value);
+ }}
className={
"w-20 pt-1 outline-none border-gray-300 border-2 rounded-lg font-medium"
}
- // categories={adminCategories.filter(
- // (cat) => cat.id !== item.priority
- // )}
+ categories={repositoryList}
/>
-
+
setAdminCategory(e.target.value)}
+ value={posSelected}
+ onChange={(e) => {
+ setPosSelected(+e.target.value);
+ }}
className={
"w-20 pt-1 outline-none border-gray-300 border-2 rounded-lg font-medium"
}
- // categories={adminCategories.filter(
- // (cat) => cat.id !== item.priority
- // )}
+ categories={posList[repoSelected]}
+ />
+
+
+
+
+ setInAmount(+e.target.value.replace(/[^\d]/, ""))
+ }
+ className={editCSS}
/>
@@ -211,12 +387,12 @@ const GoodsIn = () => {
⚠️ 确定放弃修改吗?
- {/* RightModal */}
+ {/* Right Cancel Modal */}
diff --git a/src/components/WareClerk/GoodsOut.jsx b/src/components/WareClerk/GoodsOut.jsx
index 79446be..d012db7 100644
--- a/src/components/WareClerk/GoodsOut.jsx
+++ b/src/components/WareClerk/GoodsOut.jsx
@@ -1,24 +1,51 @@
-import React from "react";
+import React, { useState } from "react";
import { useLocation } from "react-router-dom";
-import { Table, Modal } from "antd";
-import { goods } from "../../utils/data";
+import { Table, message } from "antd";
+
+import axios from "axios";
const GoodsOut = () => {
const location = useLocation();
+ // console.log(location.state.record)
+ const orderId = location.state.record.orderId;
+ const [orderList, setOrderList] = useState(
+ location.state.record.orderdetailsList
+ );
+
+ const goodsOutSubmit = () => {
+ axios
+ .post(
+ "http://127.0.0.1:8088/admin/ware-clerk/tasks/goods-out/order",
+ {},
+ { params: orderId }
+ )
+ .then((res) => {
+ if (res.data.code === 10000) {
+ message.success(res.data.message);
+ //跳转
+ } else {
+ message.error(res.data.message);
+ }
+ })
+ .catch((err) => {
+ console.log(err);
+ message.error(err);
+ });
+ };
const goodsColumns = [
{
title: "货品编号",
- dataIndex: "id",
+ dataIndex: "productId",
},
{
title: "货品名称",
- dataIndex: "name",
- },
- {
- title: "货品类型",
- dataIndex: "type",
+ dataIndex: "productName",
},
+ // {
+ // title: "货品类型",
+ // dataIndex: "type",
+ // },
{
title: "出库件数",
dataIndex: "out",
@@ -40,15 +67,15 @@ const GoodsOut = () => {
单号:
-
+
货主名称:
-
+
创建日期:
-
+
@@ -60,9 +87,9 @@ const GoodsOut = () => {
货物明细
({
+ dataSource={orderList.map((item) => ({
...item,
- key: item.id,
+ key: item.orderId,
}))}
pagination={false}
scroll={{
@@ -72,7 +99,10 @@ const GoodsOut = () => {
-
+
出库确认
--
Gitee