From 8eca2d5429fdb219fa6358c5cbd2348ec571a512 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 09:40:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=93=E4=BD=8D=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/System/Employee/Employee.jsx | 1 + src/components/System/Ware/AddPosition.jsx | 4 +- src/components/System/Ware/Position.jsx | 3 +- src/components/System/Ware/PositionDetail.jsx | 144 +++++++++++++++--- src/components/System/Ware/PositionItem.jsx | 2 +- 5 files changed, 131 insertions(+), 23 deletions(-) diff --git a/src/components/System/Employee/Employee.jsx b/src/components/System/Employee/Employee.jsx index 6dd3d02..8ceec21 100644 --- a/src/components/System/Employee/Employee.jsx +++ b/src/components/System/Employee/Employee.jsx @@ -81,6 +81,7 @@ const Employee = () => { } }) .catch((err) => { + message.error(err); console.log(err); }); }; diff --git a/src/components/System/Ware/AddPosition.jsx b/src/components/System/Ware/AddPosition.jsx index d7b6c10..0eb0108 100644 --- a/src/components/System/Ware/AddPosition.jsx +++ b/src/components/System/Ware/AddPosition.jsx @@ -54,7 +54,7 @@ const AddPosition = ({ id, updateAddInfo, addStatus }) => { value={0} onChange={handleStatusChange} /> - +
{ defaultChecked={true} onChange={handleStatusChange} /> - +
diff --git a/src/components/System/Ware/Position.jsx b/src/components/System/Ware/Position.jsx index a7e3ddf..68265f2 100644 --- a/src/components/System/Ware/Position.jsx +++ b/src/components/System/Ware/Position.jsx @@ -126,7 +126,7 @@ const Position = ({ repo, update }) => {
- + {"使用中"}
@@ -148,6 +148,7 @@ const Position = ({ repo, update }) => { setIsPositionDetailVisible(false)} + update={update} /> )} diff --git a/src/components/System/Ware/PositionDetail.jsx b/src/components/System/Ware/PositionDetail.jsx index 478432f..b1a4c8b 100644 --- a/src/components/System/Ware/PositionDetail.jsx +++ b/src/components/System/Ware/PositionDetail.jsx @@ -1,29 +1,75 @@ -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import axios from "axios"; import { AiOutlineEdit } from "react-icons/ai"; import { BsFillTrashFill } from "react-icons/bs"; import { GrClose } from "react-icons/gr"; +import { Modal, message } from "antd"; //仓位详情(下半部分右 -const PositionDetail = ({ curPos, handleCloseDetail }) => { +const PositionDetail = ({ curPos, handleCloseDetail, update }) => { console.log(curPos); + + const [status, setStatus] = useState(curPos.positionStatus); + const [isEditing, setIsEditing] = useState(false); + const [isDeleteModalVisible, setIsDeleteModalVisible] = useState(false); const startEditing = () => { setIsEditing(true); }; - useEffect(() => { + const showDeleteModal = () => { + setIsDeleteModalVisible(true); + }; + + const deleteHandleOk = () => { axios - .get("http://127.0.0.1:8088/admin/system/ware-manage/queryPosition", { + .get("http://127.0.0.1:8088/admin/system/ware-manage/deletePosition", { params: { id: curPos.positionId }, }) .then((res) => { - //todo 货物 编号 名称 类型 时间 - console.log(res.data); + if (res.data.code === 10000) { + message.success("删除成功"); + setIsDeleteModalVisible(false); + handleCloseDetail(); + update(); + } else { + message.error(res.data.message); + } + }) + .catch((err) => { + message.error(err); + console.log(err); + }); + }; + + const deleteHandleCancel = () => { + setIsDeleteModalVisible(false); + }; + + const handleSubmit = () => { + axios + .post( + "http://127.0.0.1:8088/admin/system/ware-manage/updatePosition", + {}, + { + params: { ...curPos, positionStatus: status }, + } + ) + .then((res) => { + if (res.data.code === 10000) { + message.success(res.data.message); + handleCloseDetail(); + update(); + } else { + message.error(res.data.message); + } }) - .catch((err) => console.log(err)); - }, []); + .catch((err) => { + message.error(err); + console.log(err); + }); + }; return (
@@ -31,28 +77,71 @@ const PositionDetail = ({ curPos, handleCloseDetail }) => { 仓位详情
-
+ +
-

仓位

-

货物编号:

-

货物名称:

-

货物类型:

-

货物数量:

-

仓位状态:

+

+ 仓位 +

+ {curPos.productVOList && + curPos.productVOList.map((item) => ( + <> +

货物编号:{item.productId}

+

货物名称:{item.productName}

+

货物类型:{item.productType}

+

货物数量:{item.productNum}

+ + ))} +

+ 仓位状态: + {isEditing ? ( +

+ + + +
+ ) : ( + + )} +

-
+
{isEditing ? ( <> - @@ -62,11 +151,28 @@ const PositionDetail = ({ curPos, handleCloseDetail }) => { onClick={startEditing} className="text-xl hover:cursor-pointer" /> - + )}
+ + {/* 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 (