From 73b4032dd3616b0764bebc0f6380cf489b2b3951 Mon Sep 17 00:00:00 2001
From: krysent <10075251+krysent@user.noreply.gitee.com>
Date: Tue, 1 Aug 2023 11:17:28 +0800
Subject: [PATCH] new

---
 src/pages/historystore/Histore/index.jsx     |  48 ++++++
 src/pages/insertstore/Otherinstore/index.jsx | 168 ++++++++++++++++++-
 2 files changed, 208 insertions(+), 8 deletions(-)

diff --git a/src/pages/historystore/Histore/index.jsx b/src/pages/historystore/Histore/index.jsx
index 8a9c580..3756572 100644
--- a/src/pages/historystore/Histore/index.jsx
+++ b/src/pages/historystore/Histore/index.jsx
@@ -39,6 +39,53 @@ function Instore(props) {
       dataIndex: "materieControlNo",
       key: "materieControlNo",
     },
+    {
+      title: "规格型号",
+      dataIndex: "specificationModel",
+      key: "specificationModel",
+      search: false,
+    },
+    {
+      title: "铁损",
+      dataIndex: "ironLoss",
+      key: "ironLoss",
+      readonly: "ironLoss",
+      search: false,
+    },
+    {
+      title: "片厚",
+      dataIndex: "sheetThickness",
+      key: "sheetThickness",
+      readonly: "sheetThickness",
+      search: false,
+    },
+    {
+      title: "宽度",
+      dataIndex: "width",
+      key: "width",
+      readonly: "width",
+      search: false,
+    },
+    {
+      title: "单边厚度",
+      key: "unilateralThickness",
+      dataIndex: "unilateralThickness",
+      search: false,
+    },
+    {
+      title: "米数",
+      dataIndex: "length",
+      key: "length",
+      search: false,
+    },
+
+    {
+      title: "牌号",
+      dataIndex: "shopSign",
+      key: "shopSign",
+      readonly: "shopSign",
+      search: false,
+    },
     {
       title: "当时库存数量",
       dataIndex: "currentNum",
@@ -77,6 +124,7 @@ function Instore(props) {
       dataIndex: "stockDetailTypeName",
       key: "stockDetailTypeName",
       width: 280,
+      search: false,
     },
     {
       title: "相关单号",
diff --git a/src/pages/insertstore/Otherinstore/index.jsx b/src/pages/insertstore/Otherinstore/index.jsx
index 237a020..bd1dbc6 100644
--- a/src/pages/insertstore/Otherinstore/index.jsx
+++ b/src/pages/insertstore/Otherinstore/index.jsx
@@ -9,7 +9,7 @@ import { useReactToPrint } from "react-to-print";
 import { useModel } from "umi";
 import PrintDom from "./printdom";
 import { PrintQrCode } from "@/components/PrintCode";
-
+import { EditableProTable } from "@ant-design/pro-table";
 const keytoval = {
     one: 1,
     two: 2,
@@ -40,6 +40,147 @@ const keytoval = {
     three: "退料入库",
     four: "其他入库",
   };
+const EditUpload = ({ record, fid, storeId }) => {
+  const [value, setvalue] = useState({
+    [record.id]: record.uploadList,
+  });
+  const { initialState, setInitialState } = useModel("@@initialState");
+  useEffect(() => {
+    if (!value) {
+      return;
+    }
+    let newlist =
+      Object.keys(value)?.map?.((it) => {
+        let id = it;
+        let newArr = value[id]?.filter((it) => typeof it.id == "number") ?? [];
+        return {
+          id,
+          uploadList: newArr.map((its) => {
+            return {
+              storePositionId: its?.storePositionId,
+              instroeNum: its?.instroeNum,
+              remark: its?.remark,
+            };
+          }),
+        };
+      }) ?? [];
+    setInitialState((s) => {
+      return {
+        ...s,
+        submit: {
+          id: fid,
+          materialList:
+            s.submit && s?.submit?.materialList
+              ? s?.submit?.materialList
+                  ?.filter(
+                    (it) => newlist.map((item) => item.id).indexOf(it.id) == -1
+                  )
+                  ?.concat(newlist)
+                  ?.filter((it) => it.uploadList?.length > 0)
+              : [],
+        },
+      };
+    });
+  }, [value]);
+  return (
+    <EditableProTable
+      rowKey={"id"}
+      maxLength={1000}
+      style={{ marginLeft: 48 }}
+      columns={[
+        {
+          title: (
+            <span>
+              库位名称 <b style={{ color: "red" }}>*</b>
+            </span>
+          ),
+          dataIndex: "storePositionName",
+          key: "storePositionId",
+          search: false,
+          valueType: "select",
+          request: async (params) => {
+            let res = await doFetch({
+              url: "/ngic-auth/sysStorePosition/queryByStoreId/selection",
+              params: { storeId: params.storeId },
+            });
+            return res?.data?.dataList;
+          },
+          editable: (text, record, index) => {
+            return !record.materieOutstoreDetailId;
+          },
+          params: { storeId: storeId },
+          formItemProps: () => {
+            return {
+              rules: [{ required: true, message: "此项为必填项" }],
+            };
+          },
+        },
+        {
+          title: (
+            <span>
+              上架数量 <b style={{ color: "red" }}>*</b>
+            </span>
+          ),
+          dataIndex: "instroeNum",
+          key: "instroeNum",
+          search: false,
+          editable: (text, record, index) => {
+            return !record.materieOutstoreDetailId;
+          },
+          valueType: "digit",
+          formItemProps: () => {
+            return {
+              rules: [{ required: true, message: "此项为必填项" }],
+            };
+          },
+        },
+        {
+          title: "备注",
+          dataIndex: "remark",
+          key: "remark",
+          search: false,
+          editable: (text, record, index) => {
+            return !record.materieOutstoreDetailId;
+          },
+        },
+        {
+          title: "操作",
+          valueType: "option",
+          width: 70,
+          render: (text, record, _, action) => [
+            typeof record.id == "number" && (
+              <a key="delete" onClick={() => {}}>
+                删除
+              </a>
+            ),
+          ],
+        },
+      ]}
+      value={value[record.id]}
+      recordCreatorProps={{
+        newRecordType: "dataSource",
+        record: () => ({
+          id: Date.now(),
+        }),
+      }}
+      editable={{
+        type: "multiple",
+        actionRender: (row, config, defaultDoms) => {
+          return [defaultDoms.delete];
+        },
+        onValuesChange: async (records, recordList) => {
+          setvalue((s) => {
+            return {
+              ...s,
+              [record.id]: recordList,
+            };
+          });
+        },
+      }}
+      pagination={false}
+    />
+  );
+};
 
 const defaultFields = {
   four: {
@@ -88,7 +229,7 @@ const defaultFields = {
           //根据url接口 改变某个value
           database: (params) =>
             doFetch({
-              url: "/ngic-workmanship/wmsMaterieLabel/queryById",
+              url: "/ngic-workmanship/wmsMaterieLabel/queryByLabelId",
               params,
             }),
           params: { labelId: "linked" },
@@ -102,6 +243,7 @@ const defaultFields = {
             sheetThickness: "sheetThickness",
             shopSign: "shopSign",
             weight: "weight",
+            specificationModel: "specificationModel",
           },
         },
       },
@@ -115,7 +257,7 @@ const defaultFields = {
           dataIndex: "labelId",
           key: "labelId",
           valueType: "select",
-          width: 300,
+          width: 220,
           request: async () => {
             let res = await doFetch({
               url: "/ngic-workmanship/wmsMaterieLabel/selectionByStatus",
@@ -142,7 +284,6 @@ const defaultFields = {
           dataIndex: "materieCode",
           key: "materieCode",
           valueType: "select",
-          width: 300,
           readonly: true,
         },
         {
@@ -1005,8 +1146,8 @@ function Instore(props) {
     columns,
     path:
       activeTabKey == "1"
-        ? "/ngic-workmanship/wmsMaterieInstore/queryList"
-        : "/ngic-workmanship/wmsMaterieInstoreHis/queryList",
+        ? "/ngic-workmanship/wmsMaterieInstore/queryOtherList"
+        : "/ngic-workmanship/wmsMaterieInstoreHis/queryOtherList",
   };
 
   return (
@@ -1028,9 +1169,20 @@ function Instore(props) {
         {...drawprops}
         submitData={async (value) => {
           if (drawprops.val == "add") {
+            const data = JSON.parse(JSON.stringify(value));
+            const materialList = data?.materialList?.map((it) => {
+              return {
+                labelId: it?.labelId,
+              };
+            });
             let res = await doFetch({
-              url: "/ngic-workmanship/wmsMaterieInstore/saveInStore",
-              params: { ...value },
+              url: "/ngic-workmanship/wmsMaterieInstore/saveOtherInstore",
+              params: {
+                materieInstoreNo: data.materieInstoreNo,
+                storeId: data.storeId,
+                remark: data.remark,
+                materialList: materialList,
+              },
             });
             if (res.code == "0000") {
               reload();
-- 
2.21.0