Commit 7275ba80 authored by wuhao's avatar wuhao 🎯

sdasere

parent 91478e68
import React, { useEffect, useRef, useState, useMemo } from "react";
import React, { useEffect, useRef, useState, memo } from "react";
import { ProTable } from "@ant-design/pro-components";
import Resizecell from "./Resizecell";
import { Tooltip } from "antd";
......@@ -311,4 +311,4 @@ const Mtable = (props) => {
);
};
export default Mtable;
export default memo(Mtable);
This diff is collapsed.
import React, {
useState,
useImperativeHandle,
forwardRef,
useRef,
} from "react";
import styles from "./index.less";
import { QRCodeSVG } from "qrcode.react";
let PrintQrCode = forwardRef(({ selectedItems }, ref) => {
let printRef = useRef();
useImperativeHandle(ref, () => ({
dom: printRef,
}));
return (
<div className={styles.qrcode} ref={printRef}>
{selectedItems.map((item, i) => {
return (
<div key={item.id}>
<ul>
<li>
<p>
<b>物料编码: </b> <span>{item.materieCode}</span>
</p>
<p>
<b>物料名称: </b> <span>{item.materieName}</span>
</p>
<p>
<b>批次号/SN号: </b> <span>{item.materieControlNo}</span>
</p>
<p>
<b>供应商: </b> <span>{item.supplierName}</span>
</p>
</li>
<li>
<QRCodeSVG value={item.id} size={350}></QRCodeSVG>
</li>
</ul>
</div>
);
})}
</div>
);
});
export { PrintQrCode };
.qrcode{
position: fixed;
width: 1000px;
z-index: 999999;
left: 0;
top: 0;
display: block;
ul{
display: flex;
height: 500px;
border: 4px solid #dadada;
background-color: #ffffff;
box-sizing: border-box;
margin: 0;
padding: 0;
list-style: none;
>li:first-child{
flex: 1;
padding: 50px 0;
display: flex;
flex-direction: column;
font-size: 36px;
padding-left: 24px;
justify-content: space-between;
p{
margin: 0;
}
}
>li:last-child{
width: 400px;
height: 400px;
padding: 75px 50px 50px 0;
}
}
}
\ No newline at end of file
......@@ -256,45 +256,6 @@ const one = {
},
],
rowKey: "id",
},
"materialLists": {
value: [],
title: "物料信息",
type: "checktable",
col: { span: 24 },
name: ["materialLists"],
required: false,
path:"/ngic-workmanship/wmsMaterieInstore/queryList",
columns: [
{
"title": <span>物料编码-名称 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "materieId",
"key": "materieId",
"valueType": "select",
"width": 300,
"selectedRender":"InputNumber"
},
{
"title": "批次号/SN号",
"dataIndex": "materieControlNo",
"key": "materieControlNo"
},
{
"title": <span>入库数量 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "instroeNum",
"key": "instroeNum",
},
{
"title": "库存单位",
"dataIndex": "productionUnitName",
"key": "productionUnitName",
"readonly": 'productionUnitName',
"width": 88
},
],
rowKey: "id",
rowName:"materieInstoreNo",
pagination:true
}
},
two = {
......@@ -721,7 +682,7 @@ const one = {
rowKey: "id",
}
},
detail = {
detail = (setselected, dom) => ({
totalCard: [
//物料详情
{
......@@ -761,11 +722,11 @@ const one = {
{
title: "备注",
key: "remark",
noshow:"100%",
noshow: "100%",
},
{
title: "工单二维码",
noshow:true,
noshow: true,
key: "qrCodeUrl",
type: "img",
width: 100,
......@@ -775,6 +736,7 @@ const one = {
},
{
cardTitle: "物料信息列表",
extraContent: dom,
itemData: [
{
key: "materialList",
......@@ -857,7 +819,12 @@ const one = {
/>,
},
pagination: "false",
rowKey: "id"
rowKey: "id",
rowSelection: {
onChange: (selectedRowKeys, selectedRows) => {
setselected(selectedRows)
},
}
},
],
},
......@@ -978,7 +945,7 @@ const one = {
],
},
]
}, doinsert = (fid, storeId) => ({
}), doinsert = (fid, storeId) => ({
totalCard: [
//物料详情
{
......
......@@ -8,6 +8,7 @@ import getPrem from "@/utils/getPrem"; //权限判断fn
import { useReactToPrint } from "react-to-print";
import { useModel } from "umi";
import PrintDom from "./printdom";
import { PrintQrCode } from "@/components/PrintCode";
const keytoval = {
one: 1,
......@@ -43,6 +44,8 @@ const keytoval = {
function Instore(props) {
const { initialState, setInitialState } = useModel("@@initialState");
const [activeTabKey, onTabChange] = useState("1");
const [selectKeys, setSelectKeys] = useState([]);
let [drawprops, setdrawprops] = useState({
title: "",
visible: false,
......@@ -58,7 +61,8 @@ function Instore(props) {
}),
actionRef = useRef(),
ChildRef = null,
printRef = useRef();
printRef = useRef(),
mutiPrintRef = useRef();
//操作完成后刷新
function reload() {
......@@ -76,6 +80,29 @@ function Instore(props) {
content: () => printRef.current.dom.current,
});
const mutiPrint = useReactToPrint({
content: () => mutiPrintRef.current.dom.current,
});
const PrintButton = (
<Button
disabled={!selectKeys.length}
onClick={() => {
mutiPrint();
}}
>
打印
</Button>
);
useEffect(() => {
const detail = defaultFields.detail(setSelectKeys, PrintButton);
setdrawprops((s) => ({
...s,
...detail,
}));
}, [selectKeys]);
const columns = useMemo(() => {
if (activeTabKey == "1") {
return [
......@@ -87,13 +114,17 @@ function Instore(props) {
return (
<a
onClick={async () => {
const detail = defaultFields.detail(
setSelectKeys,
PrintButton
);
setdrawprops((s) => ({
...s,
visible: true,
//查看详情 props
val: "detail",
title: `查看详情`,
...defaultFields?.detail,
...detail,
totalPath:
"/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById",
totalParams: { id: record.id },
......@@ -144,7 +175,7 @@ function Instore(props) {
key: "storeId",
fieldProps: {
allowClear: true,
showSearch: true
showSearch: true,
},
options: {
database: () =>
......@@ -280,7 +311,7 @@ function Instore(props) {
totalPath:
"/ngic-workmanship/wmsMaterieInstoreHis/getInStoreInfoById",
totalParams: { id: record.id },
extra:null
extra: null,
}));
}}
>
......@@ -319,7 +350,7 @@ function Instore(props) {
key: "storeId",
fieldProps: {
allowClear: true,
showSearch: true
showSearch: true,
},
options: {
database: () =>
......@@ -437,6 +468,11 @@ function Instore(props) {
<div style={{ display: "none" }}>
<PrintDom ref={printRef} {...drawprops} />
</div>
<div style={{ display: "none" }}>
<PrintQrCode ref={mutiPrintRef} selectedItems={selectKeys} />
</div>
<AutoTable
{...tableprops}
actionRef={actionRef}
......
......@@ -47,12 +47,12 @@ const EditUpload = ({ record, fid, storeId }) => {
linkconfig={{
urlchangeval: {
database: (params) => doFetch({ url: "/ngic-workmanship/wmsMaterieStore/queryStoreOne", params }),
params: { "storePositionId": "linked",materieControlNo:"linked"},
params: { "storePositionId": "linked", materieControlNo: "linked" },
effectresult: {
"supplierNo": "supplierNo",
"supplierName": "supplierName",
"stockNum": "stroeNum",
"materieControlNo":"materieControlNo"
"materieControlNo": "materieControlNo"
}
}
}}
......@@ -65,13 +65,13 @@ const EditUpload = ({ record, fid, storeId }) => {
search: false,
valueType: "select",
request: async (params) => {
let res = await doFetch({ url: "/ngic-auth/sysStorePosition/queryByStoreId/selection", params:{storeId:params.storeId} });
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},
params: { storeId: storeId },
"formItemProps": () => {
return {
rules: [{ required: true, message: '此项为必填项' }],
......@@ -85,16 +85,16 @@ const EditUpload = ({ record, fid, storeId }) => {
search: false,
valueType: "select",
request: async (params) => {
let res = await doFetch({ url: "/ngic-workmanship/wmsMaterieStore/queryPCList", params:{materieId:params.materieId,storePositionId:params.storePositionId}});
let res = await doFetch({ url: "/ngic-workmanship/wmsMaterieStore/queryPCList", params: { materieId: params.materieId, storePositionId: params.storePositionId } });
return res?.data?.dataList
},
editable: (text, record, index) => {
return !record.materieOutstoreDetailId
},
params:(row)=>{
return {materieId:record.materieId,storePositionId:row.storePositionId}
params: (row) => {
return { materieId: record.materieId, storePositionId: row.storePositionId }
},
width:200
width: 200
},
{
title: "下架数量",
......@@ -181,7 +181,7 @@ const one = {
database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }),
params: {}
},
"linked":true
"linked": true
},
"businessNo": {
"value": null,
......@@ -214,7 +214,7 @@ const one = {
linkconfig: {
urlchangeval: {//根据url接口 改变某个value
database: (params) => doFetch({ url: "/ngic-workmanship/wmsMaterieStockStore/queryStoreOne", params }),
params: { "materieId": "linked"},
params: { "materieId": "linked" },
effectresult: {
"productionUnit": "productionUnit",//key 为列表更新值 value为response 返回值
"productionUnitName": "productionUnitName",
......@@ -242,7 +242,7 @@ const one = {
rules: [{ required: true, message: '此项为必填项' }],
};
},
editable:true
editable: true
},
{
"title": <span>出库数量 <b style={{ color: "red" }}>*</b></span>,
......@@ -254,7 +254,7 @@ const one = {
};
},
valueType: "digit",
editable:true
editable: true
},
{
"title": "可用库存",
......@@ -645,7 +645,7 @@ const one = {
rowKey: "id",
}
},
detail = {
detail = (setselected, dom) => ({
totalCard: [
//物料详情
{
......@@ -686,13 +686,13 @@ const one = {
{
title: "备注",
key: "remark",
noshow:"100%",
noshow: "100%",
},
{
title: "工单二维码",
key: "qrCodeUrl",
type: "img",
noshow:true,
noshow: true,
width: 100,
height: 100
},
......@@ -700,6 +700,7 @@ const one = {
},
{
cardTitle: "物料信息列表",
extraContent: dom,
itemData: [
{
key: "materialList",
......@@ -734,6 +735,8 @@ const one = {
search: false,
},
],
pagination: "false",
rowKey: "id",
expandable: {
expandedRowRender: record => <Table
style={{ marginLeft: 48 }}
......@@ -775,6 +778,11 @@ const one = {
dataSource={record.downloadList}
pagination={false}
/>,
},
rowSelection: {
onChange: (selectedRowKeys, selectedRows) => {
setselected(selectedRows)
},
}
},
],
......@@ -891,7 +899,7 @@ const one = {
],
},
]
},
}),
dooutside = (fid, storeId) => ({
totalCard: [
//物料详情
......
......@@ -8,6 +8,7 @@ import getPrem from "@/utils/getPrem"; //权限判断fn
import { useReactToPrint } from "react-to-print";
import { useModel } from "umi";
import PrintDom from "./printdom";
import { PrintQrCode } from "@/components/PrintCode";
const keytoval = {
one: 1,
......@@ -43,6 +44,8 @@ const keytoval = {
function Outstore(props) {
const { initialState, setInitialState } = useModel("@@initialState");
const [activeTabKey, onTabChange] = useState("1");
const [selectKeys, setSelectKeys] = useState([]);
let [drawprops, setdrawprops] = useState({
title: "",
visible: false,
......@@ -58,7 +61,8 @@ function Outstore(props) {
}),
actionRef = useRef(),
ChildRef = null,
printRef = useRef();
printRef = useRef(),
mutiPrintRef = useRef();
//操作完成后刷新
function reload() {
......@@ -76,6 +80,28 @@ function Outstore(props) {
content: () => printRef.current.dom.current,
});
const mutiPrint = useReactToPrint({
content: () => mutiPrintRef.current.dom.current,
});
const PrintButton = (
<Button
disabled={!selectKeys.length}
onClick={() => {
mutiPrint();
}}
>
打印
</Button>
);
useEffect(() => {
const detail = defaultFields.detail(setSelectKeys, PrintButton);
setdrawprops((s) => ({
...s,
...detail,
}));
}, [selectKeys]);
const columns = useMemo(() => {
if (activeTabKey == "1") {
return [
......@@ -87,13 +113,17 @@ function Outstore(props) {
return (
<a
onClick={() => {
const detail = defaultFields.detail(
setSelectKeys,
PrintButton
);
setdrawprops((s) => ({
...s,
visible: true,
//查看详情 props
val: "detail",
title: `查看详情`,
...defaultFields?.detail,
...detail,
totalPath:
"/ngic-workmanship/wmsMaterieOutstore/getOutStoreInfoById",
totalParams: { id: record.id },
......@@ -144,7 +174,7 @@ function Outstore(props) {
key: "storeId",
fieldProps: {
allowClear: true,
showSearch: true
showSearch: true,
},
options: {
database: () =>
......@@ -321,10 +351,14 @@ function Outstore(props) {
key: "storeId",
fieldProps: {
allowClear: true,
showSearch: true
showSearch: true,
},
options: {
database: () =>doFetch({url: "/ngic-auth/sysStore/selectionBox",params: { factoryIdList: [] }}),
database: () =>
doFetch({
url: "/ngic-auth/sysStore/selectionBox",
params: { factoryIdList: [] },
}),
params: {},
},
valueType: "select",
......@@ -432,9 +466,12 @@ function Outstore(props) {
return (
<div>
<div style={{ display: "none" }}>
<div style={{ display: "none" }}>
<PrintDom ref={printRef} {...drawprops} />
</div>
<div style={{ display: "none" }}>
<PrintQrCode ref={mutiPrintRef} selectedItems={selectKeys} />
</div>
<AutoTable
{...tableprops}
actionRef={actionRef}
......@@ -502,7 +539,7 @@ function Outstore(props) {
fieldProps: {
allowClear: true,
showSearch: true,
options
options,
},
formItemProps: () => {
return {
......
import React, { useState, useRef, useReducer } from "react";
import { Button, Tooltip, Row, Divider } from "antd";
import AutoTable from "@/components/AutoTable";
import AutoTable from "@/components/Tableform";
import getPrem from "@/utils/getPrem"; //权限判断fn
import { useRequest } from "umi";
import defaultFields from "./fieldstore";
......@@ -10,6 +10,40 @@ import { ProDescriptions } from '@ant-design/pro-components';
import JsBarcode from 'jsbarcode'
import { useReactToPrint } from 'react-to-print';
import PrintProvider, { Print, NoPrint } from 'react-easy-print';
const pageStyle = `
@media all {
.page-break {
display: none;
}
}
@media print {
html, body {
height: initial !important;
overflow: initial !important;
-webkit-print-color-adjust: exact;
}
}
@media print {
.page-break {
margin-top:0;
display: block;
page-break-before: auto;
}
}
@media print {
.page-noprint {
display: none !important;
}
}
@page {
size: auto;
margin: 0px;
}
`;
const initState = {
......@@ -174,8 +208,9 @@ const StoreApp = (props) => {
setTimeout(async () => {
await Promise.all(selectedRowKeys.map(async (it) => {
await JsBarcode("#s" + it.id, it.id, {
width: 2,
height: 100,
width: 4,
height: 200,
fontSize: 36,
});
}))
}, 600)
......@@ -243,7 +278,11 @@ const StoreApp = (props) => {
actionRef={actionRef}
onRef={(node) => (ChildRef = node)}
extraparams={{ storeId: props?.curitem?.id ?? "0" }}
rowSelection={{
onChange: (selectedRowKeys, selectedRows) => {
setselectedRowKeys(selectedRows)
},
}}
></AutoTable>
<DrawInitForm
visible={false}
......@@ -262,18 +301,21 @@ const StoreApp = (props) => {
submitting={loading || !vs}
width={"60%"}
val={iftype.val}
width={iftype.val == "only" ? 380 : 600}
width={iftype.val == "only" ? 690 : 600}
extra={iftype.val == "only" ? <Button
onClick={handlePrint}
>打印</Button> : null}
>
<PrintProvider>
<style type="text/css" media="print">
{pageStyle}
</style>
<div ref={printRef}>
{
selectedRowKeys.map((it,i) => {
selectedRowKeys.map((it, i) => {
return <div key={i}>
<NoPrint>
<span>{it.storePositionName}</span>
<span className="page-noprint">{it.storePositionName}</span>
</NoPrint>
<svg id={"s" + it.id} />
<span className="page-break"></span>
......
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