Commit 85ecd57b authored by krysent's avatar krysent

出库

parent 9335a317
import { useState, useCallback } from "react";
export default function useGlobal() {
const [alive, setAlive] = useState(false),
[newMenus, setMenu] = useState({});
[newMenus, setMenu] = useState({}),
[storeId, setStoreId] = useState("");
const changealive = useCallback((parser) => {
setAlive(parser);
......@@ -11,10 +12,16 @@ export default function useGlobal() {
setMenu(val);
}, []);
const setStoreIdFn = useCallback((val) => {
setStoreId(val);
}, []);
return {
alive,
changealive,
newMenus,
setMenuFn,
setStoreIdFn,
storeId,
};
}
......@@ -42,8 +42,9 @@ const keytoval = {
four: "其他出库",
};
const MySelect = ({ storeId, record, value, onChange }) => {
console.log(storeId, record);
const MySelect = ({ record, value, onChange }) => {
const { storeId } = useModel("useGlobal");
console.log(storeId);
const [inputValue, setInputValue] = useState("");
const [options, setoptions] = useState([]);
const rref = useRef();
......@@ -513,11 +514,11 @@ function Outstore(props) {
actionRef = useRef(),
ChildRef = null,
printRef = useRef(),
mutiPrintRef = useRef(),
[storeId, setstoreId] = useState();
mutiPrintRef = useRef();
const { storeId, setStoreIdFn } = useModel("useGlobal");
const outStoreFields = useMemo(() => {
console.log(storeId);
const mystoreId = storeId;
return {
materieOutstoreNo: {
value: null,
......@@ -573,16 +574,11 @@ function Outstore(props) {
}),
params: { materieControlNo: "linked" },
effectresult: {
productionUnitName: "productionUnitName",
materieCode: "materieCode",
supplierId: "supplierId",
supplierName: "supplierName",
usableNum: "usableNum",
length: "length",
width: "width",
ironLoss: "ironLoss",
sheetThickness: "sheetThickness",
shopSign: "shopSign",
weight: "weight",
specificationModel: "specificationModel",
holdNum: "holdNum",
},
},
},
......@@ -628,24 +624,23 @@ function Outstore(props) {
};
},
renderFormItem: ({ entry }) => {
console.log("renderFormItem", storeId);
return <MySelect storeId={storeId} record={entry} />;
return <MySelect record={entry} />;
// return storeId;
},
},
{
title: "规格型号",
dataIndex: "specificationModel",
key: "specificationModel",
title: "库位名称",
dataIndex: "storePositionName",
key: "storePositionName",
readonly: true,
},
{
title: "供应商",
dataIndex: "supplierName",
key: "supplierName",
readonly: "supplierName",
title: "米数",
dataIndex: "length",
key: "length",
readonly: "length",
},
{
title: "宽度",
......@@ -654,28 +649,22 @@ function Outstore(props) {
readonly: "width",
},
{
title: "铁损",
dataIndex: "ironLoss",
key: "ironLoss",
readonly: "ironLoss",
title: "下架数量",
dataIndex: "usableNum",
key: "usableNum",
readonly: "usableNum",
},
{
title: "片厚",
dataIndex: "sheetThickness",
key: "sheetThickness",
readonly: "sheetThickness",
title: "出库数量",
dataIndex: "outstroeNum",
key: "outstroeNum",
readonly: "outstroeNum",
},
{
title: "牌号",
dataIndex: "shopSign",
key: "shopSign",
readonly: "shopSign",
},
{
title: "入库数量",
dataIndex: "weight",
key: "weight",
readonly: "weight",
title: "可用库存",
dataIndex: "holdNum",
key: "holdNum",
readonly: "holdNum",
},
{
title: "库存单位",
......@@ -687,7 +676,7 @@ function Outstore(props) {
rowKey: "id",
},
};
}, [drawprops, storeId]);
}, [drawprops]);
//操作完成后刷新
function reload() {
......@@ -845,8 +834,8 @@ function Outstore(props) {
outStoreFields[i].value = detailData[i];
}
}
console.log("storeId", detailData?.storeId);
setstoreId(detailData?.storeId);
setStoreIdFn(detailData?.storeId);
setdrawprops((s) => ({
...s,
visible: true,
......@@ -854,6 +843,7 @@ function Outstore(props) {
val: "edit",
title: `下架采集`,
fields: outStoreFields,
id: record?.id,
}));
setInitialState((s) => {
return {
......@@ -1006,9 +996,7 @@ function Outstore(props) {
];
}
}, [activeTabKey]);
useEffect(() => {
console.log("123123", storeId);
}, [storeId]);
const handlePrint = useReactToPrint({
content: () => printRef.current.dom.current,
});
......@@ -1109,7 +1097,21 @@ function Outstore(props) {
reload();
}
} 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) => {
......
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