Commit b932ee57 authored by GuanHua's avatar GuanHua
parents 6b21958e a5e388c5
......@@ -16,6 +16,7 @@ import { SOCKET_URL } from '@/constants';
// layout: 'sidemenu' | 'topmenu';
// }
const NOT_READ_MESSAGE = 1;
const GlobalHeaderRight: React.FC<{}> = (props) => {
// const { theme, layout } = props;
const [message, setMessage] = useState<number>(0);
......@@ -31,13 +32,16 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
const webSocketInit = useCallback(() => {
console.log(ws.current)
if ((!ws.current || ws.current.readyState === 3) && userInfo) {
ws.current = new WebSocket(`${SOCKET_URL}/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.memberRoleId}`);
const url = `${SOCKET_URL}/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.memberRoleId}&token=${userInfo.token}`;
ws.current = new WebSocket(url);
ws.current.onopen = (e) => {
console.log(e)
}
ws.current.onmessage = (e) => {
console.log(e)
setMessage(e.data)
if(e.data.type === NOT_READ_MESSAGE) {
setMessage(e.data.data);
}
};
ws.current.onclose = (e) => {
console.log("关闭连接")
......
......@@ -269,15 +269,26 @@ const Add: React.FC<{}> = () => {
}
setSubmitLoading(true);
const detailList = someLists.map((item) => {
const orderData = values.source === 1
? {
orderId: item.orderId,
orderDetailId: item.fullId,
orderNo: item.orderNo,
productId: item.commodityId,
purchaseCount: item.orderTotal, // 订单数量
surplusProcessNum: item.restTotal, // 剩余加工数量
}
: {
productId: item.id,
purchaseCount:null,
surplusProcessNum:null,
}
return {
orederNo: item.orderNo, // 如果是商品加工,那么他没有订单号
productId: item.id, // skuid
...orderData,
productName: item.name,
category: item.customerCategoryName,
brand: item.brandName,
unit: item.unitName,
purchaseCount:null,
surplusProcessNum:null,
processNum: item.processNum || 0,
processPrice: item.processUnitPrice || 0,
processTotalPrice: item.processTotalPrice,
......
......@@ -52,20 +52,22 @@ const ProcessProducts = ({visible, cancel, rowSelection, ...restProps}) => {
(item) => {
return {
orderNo: record.orderNo,
orderId: record.id, // 订单id
// orderDetailId: item.id, // 订单商品唯一id
commodityId: item.productId, // 商品id
id: item.productId,
id: item.productId, // sku id
name: item.productName,
customerCategoryName: item.category,
brandName: item.brand,
unitName: item.unit,
orderTotal: item.purchaseCount,
orderTotal: item.purchaseCount, // 采购数量
restTotal: item.purchaseCount - (item.processNum || 0),
processNum: '',
processUnitPrice: '',
processTotalPrice: '',
price: item.price, //单价,
hasProcessNum: item.processNum || 0,
fullId: item.id
fullId: item.id, //订单商品唯一id
}
}
)
......
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