Commit 85ecd57b authored by krysent's avatar krysent

出库

parent 9335a317
import { useState, useCallback } from "react"; import { useState, useCallback } from "react";
export default function useGlobal() { export default function useGlobal() {
const [alive, setAlive] = useState(false), const [alive, setAlive] = useState(false),
[newMenus, setMenu] = useState({}); [newMenus, setMenu] = useState({}),
[storeId, setStoreId] = useState("");
const changealive = useCallback((parser) => { const changealive = useCallback((parser) => {
setAlive(parser); setAlive(parser);
...@@ -11,10 +12,16 @@ export default function useGlobal() { ...@@ -11,10 +12,16 @@ export default function useGlobal() {
setMenu(val); setMenu(val);
}, []); }, []);
const setStoreIdFn = useCallback((val) => {
setStoreId(val);
}, []);
return { return {
alive, alive,
changealive, changealive,
newMenus, newMenus,
setMenuFn, setMenuFn,
setStoreIdFn,
storeId,
}; };
} }
...@@ -42,8 +42,9 @@ const keytoval = { ...@@ -42,8 +42,9 @@ const keytoval = {
four: "其他出库", four: "其他出库",
}; };
const MySelect = ({ storeId, record, value, onChange }) => { const MySelect = ({ record, value, onChange }) => {
console.log(storeId, record); const { storeId } = useModel("useGlobal");
console.log(storeId);
const [inputValue, setInputValue] = useState(""); const [inputValue, setInputValue] = useState("");
const [options, setoptions] = useState([]); const [options, setoptions] = useState([]);
const rref = useRef(); const rref = useRef();
...@@ -513,11 +514,11 @@ function Outstore(props) { ...@@ -513,11 +514,11 @@ function Outstore(props) {
actionRef = useRef(), actionRef = useRef(),
ChildRef = null, ChildRef = null,
printRef = useRef(), printRef = useRef(),
mutiPrintRef = useRef(), mutiPrintRef = useRef();
[storeId, setstoreId] = useState();
const { storeId, setStoreIdFn } = useModel("useGlobal");
const outStoreFields = useMemo(() => { const outStoreFields = useMemo(() => {
console.log(storeId); const mystoreId = storeId;
return { return {
materieOutstoreNo: { materieOutstoreNo: {
value: null, value: null,
...@@ -573,16 +574,11 @@ function Outstore(props) { ...@@ -573,16 +574,11 @@ function Outstore(props) {
}), }),
params: { materieControlNo: "linked" }, params: { materieControlNo: "linked" },
effectresult: { effectresult: {
productionUnitName: "productionUnitName", usableNum: "usableNum",
materieCode: "materieCode", length: "length",
supplierId: "supplierId",
supplierName: "supplierName",
width: "width", width: "width",
ironLoss: "ironLoss",
sheetThickness: "sheetThickness",
shopSign: "shopSign",
weight: "weight", weight: "weight",
specificationModel: "specificationModel", holdNum: "holdNum",
}, },
}, },
}, },
...@@ -628,24 +624,23 @@ function Outstore(props) { ...@@ -628,24 +624,23 @@ function Outstore(props) {
}; };
}, },
renderFormItem: ({ entry }) => { renderFormItem: ({ entry }) => {
console.log("renderFormItem", storeId); return <MySelect record={entry} />;
return <MySelect storeId={storeId} record={entry} />;
// return storeId; // return storeId;
}, },
}, },
{ {
title: "规格型号", title: "库位名称",
dataIndex: "specificationModel", dataIndex: "storePositionName",
key: "specificationModel", key: "storePositionName",
readonly: true, readonly: true,
}, },
{ {
title: "供应商", title: "米数",
dataIndex: "supplierName", dataIndex: "length",
key: "supplierName", key: "length",
readonly: "supplierName", readonly: "length",
}, },
{ {
title: "宽度", title: "宽度",
...@@ -654,28 +649,22 @@ function Outstore(props) { ...@@ -654,28 +649,22 @@ function Outstore(props) {
readonly: "width", readonly: "width",
}, },
{ {
title: "铁损", title: "下架数量",
dataIndex: "ironLoss", dataIndex: "usableNum",
key: "ironLoss", key: "usableNum",
readonly: "ironLoss", readonly: "usableNum",
}, },
{ {
title: "片厚", title: "出库数量",
dataIndex: "sheetThickness", dataIndex: "outstroeNum",
key: "sheetThickness", key: "outstroeNum",
readonly: "sheetThickness", readonly: "outstroeNum",
}, },
{ {
title: "牌号", title: "可用库存",
dataIndex: "shopSign", dataIndex: "holdNum",
key: "shopSign", key: "holdNum",
readonly: "shopSign", readonly: "holdNum",
},
{
title: "入库数量",
dataIndex: "weight",
key: "weight",
readonly: "weight",
}, },
{ {
title: "库存单位", title: "库存单位",
...@@ -687,7 +676,7 @@ function Outstore(props) { ...@@ -687,7 +676,7 @@ function Outstore(props) {
rowKey: "id", rowKey: "id",
}, },
}; };
}, [drawprops, storeId]); }, [drawprops]);
//操作完成后刷新 //操作完成后刷新
function reload() { function reload() {
...@@ -845,8 +834,8 @@ function Outstore(props) { ...@@ -845,8 +834,8 @@ function Outstore(props) {
outStoreFields[i].value = detailData[i]; outStoreFields[i].value = detailData[i];
} }
} }
console.log("storeId", detailData?.storeId); setStoreIdFn(detailData?.storeId);
setstoreId(detailData?.storeId);
setdrawprops((s) => ({ setdrawprops((s) => ({
...s, ...s,
visible: true, visible: true,
...@@ -854,6 +843,7 @@ function Outstore(props) { ...@@ -854,6 +843,7 @@ function Outstore(props) {
val: "edit", val: "edit",
title: `下架采集`, title: `下架采集`,
fields: outStoreFields, fields: outStoreFields,
id: record?.id,
})); }));
setInitialState((s) => { setInitialState((s) => {
return { return {
...@@ -1006,9 +996,7 @@ function Outstore(props) { ...@@ -1006,9 +996,7 @@ function Outstore(props) {
]; ];
} }
}, [activeTabKey]); }, [activeTabKey]);
useEffect(() => {
console.log("123123", storeId);
}, [storeId]);
const handlePrint = useReactToPrint({ const handlePrint = useReactToPrint({
content: () => printRef.current.dom.current, content: () => printRef.current.dom.current,
}); });
...@@ -1109,7 +1097,21 @@ function Outstore(props) { ...@@ -1109,7 +1097,21 @@ function Outstore(props) {
reload(); reload();
} }
} else if (drawprops.val == "edit") { } else if (drawprops.val == "edit") {
console.log(value); let newfileds = JSON.parse(JSON.stringify(value));
const materialList = newfileds?.materialList?.map((it) => {
return {
id: it?.id,
materieId: it?.materieId,
materieControlNo: it?.materieControlNo,
};
});
let res = await doFetch({
url: "/ngic-workmanship/wmsMaterieOutstore/download",
params: { id: drawprops.id, materialList },
});
if (res.code == "0000") {
reload();
}
} }
}} }}
onChange={async (changedValues, allValues) => { onChange={async (changedValues, allValues) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment